Fix missing session_id in UserMessage by Leela0o5 · Pull Request #1403 · anthropics/claude-agent-sdk-python · GitHub
Skip to content

Fix missing session_id in UserMessage - #1403

Open
Leela0o5 wants to merge 1 commit into
anthropics:mainfrom
Leela0o5:fix/user-message-session-id
Open

Leela0o5 wants to merge 1 commit into
anthropics:mainfrom
Leela0o5:fix/user-message-session-id

Conversation

@Leela0o5

Copy link
Copy Markdown

Fixes #1402

Summary

parse_message() was missing session_id in UserMessage. This PR adds the field and updates the parser to preserve it for both string and list content.

The field is optional, so existing code remains compatible.

Test Plan

  • Added tests for session IDs in user messages and when the field is missing.
  • tests/test_message_parser.py: 82 passed.
  • Ruff, formatting checks, and mypy pass.
  • The full suite has 30 unrelated session-file test failures on Windows, which also occur on main.

Copilot AI balanced review requested due to automatic review settings October 17, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python[Bug]: UserMessage drops session_id that the CLI sends on user messages

2 participants