Skip to content

Python: [A2A] Set message_id on AgentResponseUpdate for message-bearing paths#6163

Merged
giles17 merged 1 commit into
microsoft:mainfrom
giles17:fix/a2a-message-id-mapping
May 29, 2026
Merged

Python: [A2A] Set message_id on AgentResponseUpdate for message-bearing paths#6163
giles17 merged 1 commit into
microsoft:mainfrom
giles17:fix/a2a-message-id-mapping

Conversation

@giles17
Copy link
Copy Markdown
Contributor

@giles17 giles17 commented May 28, 2026

Summary

Maps A2A protocol message_id to AgentResponseUpdate.message_id in two paths where it was previously omitted, aligning Python behavior with .NET:

  1. Standalone A2AMessage: set message_id=msg.message_id (matches .NET ConvertToAgentResponseUpdate(Message) which sets both ResponseId and MessageId to message.MessageId)

  2. TaskStatusUpdateEvent (terminal/input_required): set message_id=message.message_id (matches .NET which sets MessageId=statusUpdateEvent.Status.Message?.MessageId)

Motivation

Issue #5949 reported that task_id is correctly mapped to response_id, but message_id from A2A protocol messages is discarded. The .NET side already correctly sets MessageId in both of these paths.

The semantic mapping is:

  • task_idresponse_id (identifies the conversation round)
  • message_id / artifact_idmessage_id (identifies the individual content piece)

Changes

  • _agent.py: Added message_id=msg.message_id to the standalone A2AMessage path
  • _agent.py: Added message_id=message.message_id to the TaskStatusUpdateEvent path
  • test_a2a_agent.py: Updated tests to assert message_id is correctly set

Testing

All 103 tests in test_a2a_agent.py pass.

Fixes #5949

…ng paths

Map A2A protocol message_id to AgentResponseUpdate.message_id in two paths
where it was previously omitted, aligning with .NET behavior:

1. Standalone A2AMessage: set message_id=msg.message_id (matches .NET
   ConvertToAgentResponseUpdate(Message) which sets both ResponseId and
   MessageId to message.MessageId)

2. TaskStatusUpdateEvent (terminal/input_required): set
   message_id=message.message_id (matches .NET which sets
   MessageId=statusUpdateEvent.Status.Message?.MessageId)

Fixes microsoft#5949

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 19:31
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

Maps A2A protocol message_id to AgentResponseUpdate.message_id in two paths (standalone A2AMessage and TaskStatusUpdateEvent terminal/input_required) where it was previously dropped, aligning Python behavior with .NET and fixing #5949.

Changes:

  • Set message_id=msg.message_id on the standalone A2AMessage path in _map_a2a_stream.
  • Set message_id=message.message_id on the TaskStatusUpdateEvent path in _updates_from_task_update_event.
  • Updated tests to assert message_id is propagated.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/packages/a2a/agent_framework_a2a/_agent.py Propagate A2A message_id to AgentResponseUpdate.message_id in the two affected paths.
python/packages/a2a/tests/test_a2a_agent.py Assert message_id on updates and use deterministic ids for affected tests.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 3 | Confidence: 94% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage


Automated review by giles17's agents

@moonbox3
Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/a2a/agent_framework_a2a
   _agent.py3612194%259, 458, 463, 465, 519–520, 550–551, 555, 697, 713, 725, 747, 768, 815, 831, 841, 852, 859–860, 911
TOTAL36857431788% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
7392 34 💤 0 ❌ 0 🔥 1m 51s ⏱️

Copy link
Copy Markdown
Contributor Author

@giles17 giles17 left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 3 | Confidence: 92% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage


Automated review by giles17's agents

@giles17 giles17 added this pull request to the merge queue May 29, 2026
Merged via the queue into microsoft:main with commit dd9a4b6 May 29, 2026
39 checks passed
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

4 participants