Skip to content

Python: preserve A2A message context_id - #4686

Merged
Giles Odigwe (giles17) merged 2 commits into
microsoft:mainfrom
eavanvalkenburg:copilot/issue-4679-a2a-context-id
Mar 16, 2026
Merged

Python: preserve A2A message context_id#4686
Giles Odigwe (giles17) merged 2 commits into
microsoft:mainfrom
eavanvalkenburg:copilot/issue-4679-a2a-context-id

Conversation

@eavanvalkenburg

@eavanvalkenburg Eduard van Valkenburg (eavanvalkenburg) commented Mar 13, 2026

Copy link
Copy Markdown
Member

Motivation and Context

This change fixes #4679 by preserving the context_id attached to outbound A2A messages, which keeps multi-turn A2A conversations correlated correctly.

Description

Forward context_id from the framework Message into the generated A2AMessage and add a regression test that verifies _prepare_message_for_a2a() preserves it.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings March 13, 2026 11:08
@markwallace-microsoft Mark Wallace (markwallace-microsoft) added the python Usage: [Issues, PRs], Target: Python label Mar 13, 2026

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

This PR fixes #4679 by preserving the A2A context_id when converting framework Message objects to outbound A2AMessage, keeping multi-turn A2A conversations correctly correlated.

Changes:

  • Forward context_id from Message.additional_properties["context_id"] into the generated A2AMessage.context_id.
  • Add a regression unit test to ensure _prepare_message_for_a2a() preserves context_id.

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 Adds forwarding of context_id into outbound A2A message construction.
python/packages/a2a/tests/test_a2a_agent.py Adds regression coverage for context_id preservation in _prepare_message_for_a2a().

You can also share your feedback on Copilot code review. Take the survey.

Comment thread python/packages/a2a/agent_framework_a2a/_agent.py
@markwallace-microsoft

Mark Wallace (markwallace-microsoft) commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/a2a/agent_framework_a2a
   _agent.py1841392%383, 404, 425, 445, 459, 473, 485–486, 528–529, 558–560
TOTAL23919262789% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
5219 20 💤 0 ❌ 0 🔥 1m 21s ⏱️

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@giles17
Giles Odigwe (giles17) added this pull request to the merge queue Mar 16, 2026
Merged via the queue into microsoft:main with commit 0fdcfd0 Mar 16, 2026
31 checks passed
@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) deleted the copilot/issue-4679-a2a-context-id branch June 30, 2026 09:01
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]: A2AAgent Drops context_id in Message Preparation

5 participants