Skip to content

Python: fix A2A status message ids#5960

Open
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/a2a-status-message-id
Open

Python: fix A2A status message ids#5960
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/a2a-status-message-id

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

  • preserve the A2A status message ID when a streaming TaskStatusUpdateEvent is converted to AgentResponseUpdate
  • preserve the same ID for in-progress task status messages surfaced from Task payloads
  • add regression coverage for both status-event and in-progress-task streaming paths

Fixes #5949.

Validation

  • uv run pytest tests\test_a2a_agent.py -q -k "streaming_working_update_user_role_mapping or streaming_status_update_event_yields_content"
  • uv run ruff check agent_framework_a2a\_agent.py tests\test_a2a_agent.py
  • uv run ruff format --check agent_framework_a2a\_agent.py tests\test_a2a_agent.py
  • python -m py_compile python\packages\a2a\agent_framework_a2a\_agent.py python\packages\a2a\tests\test_a2a_agent.py
  • git diff --check upstream/main..HEAD

Copilot AI review requested due to automatic review settings May 19, 2026 18:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes A2A status message IDs not being preserved when streaming events are converted to AgentResponseUpdate, so downstream consumers can correlate updates to their originating A2A message.

Changes:

  • Propagate message_id from TaskStatus.message in _updates_from_task.
  • Propagate message_id from TaskStatusUpdateEvent.status.message in _updates_from_task_update_event.
  • Add regression tests asserting message_id is preserved on streaming updates.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
python/packages/a2a/agent_framework_a2a/_agent.py Forwards the A2A message ID to AgentResponseUpdate in both task and status-update conversion paths.
python/packages/a2a/tests/test_a2a_agent.py Updates existing test to use an explicit message ID and adds assertions verifying message_id propagation.

contents=contents,
role="assistant" if status.message.role == A2ARole.ROLE_AGENT else "user",
response_id=task.id,
message_id=status.message.message_id or None,
@he-yufeng he-yufeng force-pushed the fix/a2a-status-message-id branch from 9387a33 to 625d2ea Compare May 20, 2026 05:05
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Updated to address the inline comment and rebased on current main. Local validation: targeted A2A tests for the affected streaming paths passed, plus ruff check/format, py_compile, and git diff --check.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: [A2A] Correctly Handle task_id and message_id Returned by A2A

3 participants