Repository navigation
Description
Description
A terminal A2A Task snapshot with content in status.message drops that content in A2AAgent.run() and poll_task(). The terminal TaskStatusUpdateEvent path already surfaces the same status content. This can hide a failure explanation, including the kind of message emitted by the repository A2A hosting sample.
Expected: The failure note is available in the response, as it is for a terminal status-update event. Artifacts remain the protocol channel for task outputs.
Actual: The response text is empty although the terminal Task contains Agent execution failed..
Code Sample
This uses a mocked provider/client and makes no service request.
import asyncio
from unittest.mock import AsyncMock, MagicMock
from a2a.types import Message, Part, Role, Task, TaskState, TaskStatus
from agent_framework_a2a import A2AAgent, A2AContinuationToken
async def main():
task = Task(
id="example-task",
context_id="example-context",
status=TaskStatus(
state=TaskState.TASK_STATE_FAILED,
message=Message(
message_id="failure-note",
role=Role.ROLE_AGENT,
parts=[Part(text="Agent execution failed.")],
),
),
)
client = MagicMock()
client.get_task = AsyncMock(return_value=task)
agent = A2AAgent(client=client, http_client=None)
response = await agent.poll_task(A2AContinuationToken(task_id=task.id, context_id=task.context_id))
print(repr(response.text))
assert response.text == "Agent execution failed."
asyncio.run(main())Package Versions
Source checkout e9857bd75a21843803431a2e7dfa41ee9b017ac7: agent-framework-core 1.20.0, agent-framework-a2a 1.0.0b261002; A2A SDK 1.2.1.
Python Version
Python 3.12.12.
Additional Context
I will submit a focused fix with regression coverage for this behavior.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
github-actions commentedon Oct 3, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
The bug reproduces in
python/packages/a2a/agent_framework_a2a/_agent.py::_updates_from_taskwhen a terminal Task has content only instatus.message; bothA2Agent.run()andpoll_task()produce an empty response. Minimal repro: provide a mocked failed Task whose status message containsAgent execution failed., invoke either route, and assert thatresponse.textpreserves the message.python/packages/a2a/tests/test_a2a_agent.py1.0.0b2610021.0.0b261002eavanvalkenburg commentedon Oct 27, 2026
/plan Investigate the smallest backward-compatible fix through existing PR #8999 by quifox (@quifox), not a competing implementation. Current main terminal Task snapshots parse artifacts/history but omit status.message, whereas terminal status events expose it; a failure-only snapshot can therefore lose its explanation. Keep artifacts as task outputs and define supplemental status-message ordering/identity without duplicating history, standalone messages, repeated snapshots or status events. Reuse shared conversion/finalization helpers before adding parallel tracking abstractions; distinguish real final-response duplication from temporary metadata-only updates removed by finalization, and preserve task/message metadata. Compare current main rather than old patch snippets: terminal/background _operation_state and continuation clearing must survive every return path, including empty or fully deduplicated output, in both run modes and poll_task. Candidate PR touches more than a trivial boundary, so report a conservative production-code scope and meaningful compatibility choices before readiness. Reuse its existing tests and review evidence, then identify missing regressions for failed/completed/cancelled snapshots, status/history/artifact identity overlap, event-before-snapshot and reverse ordering, repeated tasks, metadata-only terminal updates and final continuation state. Coordinate with existing owner Eduard van Valkenburg (@eavanvalkenburg) and preserve #9051 closed state. No assignment, ready label, PR approval or reopening is implied.
eavanvalkenburg commentedon Nov 12, 2026
/plan Investigate the smallest backward-compatible fix through existing PR #8999 by quifox (@quifox), not a competing implementation. Current main terminal Task snapshots parse artifacts/history but omit status.message, whereas terminal status events expose it; a failure-only snapshot can therefore lose its explanation. Keep artifacts as task outputs and define supplemental status-message ordering/identity without duplicating history, standalone messages, repeated snapshots or status events. Reuse shared conversion/finalization helpers before adding parallel tracking abstractions; distinguish real final-response duplication from temporary metadata-only updates removed by finalization, and preserve task/message metadata. Compare current main rather than old patch snippets: terminal/background _operation_state and continuation clearing must survive every return path, including empty or fully deduplicated output, in both run modes and poll_task. Candidate PR touches more than a trivial boundary, so report a conservative production-code scope and meaningful compatibility choices before readiness. Reuse its existing tests and review evidence, then identify missing regressions for failed/completed/cancelled snapshots, status/history/artifact identity overlap, event-before-snapshot and reverse ordering, repeated tasks, metadata-only terminal updates and final continuation state. Coordinate with existing owner Eduard van Valkenburg (@eavanvalkenburg) and preserve #9051 closed state. No assignment, ready label, PR approval or reopening is implied.
github-actions commentedon Nov 12, 2026
Summary
A final (terminal) A2A
Tasksnapshot that holds text only instatus.message(for example a failed task saying "Agent execution failed.") returns empty text fromA2AAgent.run()andpoll_task(). The equivalent terminal status-update event does return that text. I read currentmainonly. I did not inspect #8999's diff or reviews, and I ran no code. #9051 stays closed; nothing here assigns, labels, approves or reopens anything.Confirmed on
main(python/packages/a2a/agent_framework_a2a/_agent.py)_updates_from_task(~L882): for terminal states it uses only_parse_messages_from_task(L1373). That returns artifacts, or the last history item only if there are no artifacts.status.messageis read only forINPUT_REQUIREDand for in-progress states withemit_intermediate._updates_from_task_update_event(~L1093): a terminal status event convertsstatus.messageinto an update (message id, role, merged message and event metadata), markedterminal._operation_state="terminal"on the last update. Empty-output paths return a contentless update, but only whenbackground=Truefor the artifact-only and event cases; in non-background mode they return[].run(~L729-745) flushes buffered intermediate updates when the terminal snapshot has no content, and drops them when it has content.poll_task(L1171) calls the same function withbackground=True, so one fix in_updates_from_taskcoversrun(both modes) andpoll_task.Recommendation
Code change is warranted: a small, bounded fix in the A2A package, plus tests. This is a real inconsistency between two terminal paths, and artifacts stay the output channel. No new public API is needed. Review the existing PR #8999 against the points below rather than starting a competing one.
Proposed plan (no changes made)
Conservative production scope. Only
_updates_from_taskin_agent.py, plus at most a small helper shared with the status-event path. Avoid new tracking state inrun, changes to_deduplicate_user_input_request_updates, or changes to hosting. If the PR touches more than this, ask why each extra piece is needed.Reuse conversion. Build the status-message update with the same rules the event path already uses (role,
message_id, message metadata merged with task metadata,merge_mode="replace") instead of a second implementation. Metadata-key precedence should match the event path.Ordering and identity (compatibility choice to decide). Suggested default: artifacts/history first, status message last, since it is a supplemental note. Skip it when it would repeat content already emitted: same
message_idas the history item used, same id as an artifact, or identical parts. Decide explicitly whether text-only equality counts as duplication; id match is the safer minimum. Servers often put the status message in history too, so history/status overlap is the main duplicate risk.Duplicate vs. temporary updates. In
run, the terminal-snapshot branch flushes buffered intermediate updates only when the snapshot has no content. A status message makes the snapshot "have content", which would now drop buffered intermediates. That is correct only if the status message is the real final answer. Tests must show a metadata-only terminal update (empty contents) still flushes pending updates and does not count as content.Final state on every return path. The last update returned (including the contentless fallbacks and the case where everything is deduplicated away) must still carry
terminalstate and no continuation token, in streaming, non-streaming,background=Trueandpoll_task. Check that deduplicating the status message never leaves an empty list in background mode.Missing regressions to add or confirm (reuse the PR's tests where they already cover these):
Messagepayloads unaffected;_operation_stateand continuation token on each path above.Done when the issue's repro returns "Agent execution failed.", the matrix above passes, existing A2A tests are unchanged, and the diff stays within the scope in item 1.
Coordination
Eduard van Valkenburg (@eavanvalkenburg) owns the issue; please confirm the ordering/identity choice in item 3 before the PR is treated as ready. quifox (@quifox), please describe how #8999 maps to items 1-6.