Surface Status.Message text from non-streaming A2A task responses - #552
Surface Status.Message text from non-streaming A2A task responses#552PratikDhanave wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves response fidelity and usage accounting in provider implementations: it makes non-streaming A2A task responses surface Status.Message text (matching the streaming path), and it extends Gemini usage mapping to include reasoning/thought token counts.
Changes:
- A2A provider: in non-streaming
*a2a.Taskresponses, extractStatus.Messageparts forInputRequiredand terminal task states and propagate theMessageID. - A2A provider: add a regression test covering an
InputRequiredtask whose response is carried only inStatus.Message. - Gemini provider: map
thoughtsTokenCounttoUsageDetails.ReasoningTokenCountand add a test to verify the mapping.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| provider/geminiprovider/agent.go | Adds Gemini usage mapping for reasoning/thought token counts. |
| provider/geminiprovider/agent_test.go | Adds coverage ensuring thoughtsTokenCount is surfaced as ReasoningTokenCount. |
| provider/a2aprovider/a2a.go | Updates non-streaming task handling to include Status.Message content and message ID for input-required/terminal states. |
| provider/a2aprovider/a2a_test.go | Adds regression test verifying Status.Message text is returned for non-streaming input-required tasks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0636dbe to
f7fa87f
Compare
This comment has been minimized.
This comment has been minimized.
f7fa87f to
5acf6e9
Compare
This comment has been minimized.
This comment has been minimized.
yieldTask, which handles the *a2a.Task object path used by non-streaming SendMessage and the GetTask continuation, built its ResponseUpdate only from task.Artifacts and ignored task.Status.Message. When an A2A server returns a Task in an input-required or terminal state that carries its text in Status.Message with no artifacts (e.g. a follow-up question), the text was silently dropped. The streaming TaskStatusUpdateEvent path already extracts Status.Message for these states. Mirror that in yieldTask so the streaming and non-streaming paths agree.
5acf6e9 to
064bdd2
Compare
Parity Review — PR #552Scope: Internal A2A provider fix — Change summary: Surfaces No exported Go API changes — no Cross-repo parity: The PR explicitly references .NET upstream issue Anthropic/OpenAI diffs: These appear in ✅ No parity issues found. The Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
The streaming path already extracts
Status.Messagetext for input-required and terminal task states — added deliberately (TestRunStreamingWithTaskStatusUpdateEvent_WithMessage, mirroring .NET microsoft/agent-framework#6043):But
yieldTask— the*a2a.Taskobject path used by non-streamingSendMessageand theGetTaskcontinuation — built its update only fromtask.Artifactsand never readtask.Status.Message:Per the A2A spec a server may return a
Task(not aMessage) fromSendMessage/GetTask, andTaskStatus.Messageis the natural place for an input-required follow-up question or a terminal summary when there are no artifacts. In that case the non-streaming caller got an update with empty contents — the agent’s question was silently lost — while the exact same logical response over streaming surfaced it. A pure streaming-vs-non-streaming parity gap.Fix
Mirror the streaming branch in
yieldTask: set the message ID fromStatus.Messageand, for input-required/terminal states, extract its parts before appending any artifact contents.Test
TestRunWithInputRequiredTaskMessagereturns a non-streaming*a2a.TaskinInputRequiredstate whoseStatus.Messageholds a question and no artifacts, then asserts the response text equals the question. It fails on the old code (empty) and passes with the fix. Full package tests remain green (no existing*a2a.Tasktest exercisedStatus.Message).