Skip to content

Python: preserve status messages in terminal A2A task snapshots - #9051

Closed
Suhas Aggarwal (suhasagg) wants to merge 1 commit into
microsoft:mainfrom
suhasagg:fix-8998-a2a-terminal-status-message
Closed

Suhas Aggarwal (suhasagg) wants to merge 1 commit into
microsoft:mainfrom
suhasagg:fix-8998-a2a-terminal-status-message

Conversation

@suhasagg

Copy link
Copy Markdown
Contributor

Summary

Preserve terminal A2A Task status messages when converting Task snapshots
into Agent Framework messages.

Problem

A terminal A2A Task can carry its final response in task.status.message.

A2AAgent._parse_messages_from_task() currently handles task artifacts
and task history, but when both are absent it does not fall back to the
status message. As a result, a final response contained only in a
completed or failed Task status can be omitted.

Changes

  • Fall back to task.status.message when a Task has no artifacts or history.
  • Preserve the status message role, contents, metadata, and raw representation.
  • Preserve the existing precedence of artifacts and history.
  • Add regression coverage for completed and failed Tasks carrying status messages.

Testing

  • _parse_messages_from_task tests: 3 passed
  • Complete test_a2a_agent.py: 138 passed
  • A2A non-integration tests: 192 passed
  • Ruff check: passed
  • Ruff format check: passed
  • git diff --check: passed

Fixes #8998

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.

Copilot review overview

🟢 Approval recommended

The focused fallback preserves existing precedence and is adequately covered by regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Adds fallback handling so terminal A2A task status messages are retained when artifacts and history are absent.

Changes:

  • Converts terminal status messages into framework messages.
  • Adds completed and failed task regression coverage.
File Description
python/​packages/​a2a/​agent_framework_a2a/​_agent.py Adds status-message fallback conversion.
python/​packages/​a2a/​tests/​test_a2a_agent.py Tests completed and failed status messages.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@eavanvalkenburg

Copy link
Copy Markdown
Member

Suhas Aggarwal (@suhasagg) Thanks for the contribution. This implements the same change as #8999, so we'll continue the work there and close this duplicate.

This branch was previously deployed

1 inactive deployment
github-app-auth — 5d2339fb Deployed Oct 5, 2026 by suhasagg via team_check #6041
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]: Terminal A2A Task snapshots omit status messages

3 participants