Skip to content

Python: fix A2A status message ids - #5960

Closed
Yufeng He (he-yufeng) wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/a2a-status-message-id
Closed

Python: fix A2A status message ids#5960
Yufeng He (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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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,
@moonbox3 Evan Mattson (moonbox3) added the python Usage: [Issues, PRs], Target: Python label May 19, 2026
@he-yufeng
Yufeng He (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.

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/a2a-status-message-id branch 2 times, most recently from 0928516 to 4507db9 Compare May 22, 2026 18:56
@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/a2a-status-message-id branch from 4507db9 to 042c4c7 Compare May 23, 2026 21:18
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased onto current main; no code changes beyond the rebase.\n\nValidation on Windows:\n- .\.venv\Scripts\python.exe -m pytest packages\a2a\tests\test_a2a_agent.py -q -> 88 passed, 2 existing experimental warnings\n- .\.venv\Scripts\python.exe -m ruff check packages\a2a\agent_framework_a2a\_agent.py packages\a2a\tests\test_a2a_agent.py\n- .\.venv\Scripts\python.exe -m py_compile packages\a2a\agent_framework_a2a\_agent.py packages\a2a\tests\test_a2a_agent.py\n- git diff --check upstream/main..HEAD

@giles17

Copy link
Copy Markdown
Contributor

Closing in favor of #6053

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

Labels

python Usage: [Issues, PRs], Target: Python

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

4 participants