Repository navigation
Conversation
When the agent opens a task with a status or artifact update (e.g. AgentEmitter.startWork()), onMessageSendStream relayed that update as the first stream item, so the client received an update of a task it was never sent. A2A spec 3.1.2 requires: "If the agent returns a Task, the stream MUST begin with the Task object." Emit the task's Task (for a new task, the Task the TaskStore creates for it; for an existing task, the task as the request updated it) before a first status or artifact update. A first Task or Message is unchanged. This fixes a2aproject#1352
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change was found and re-checked with Daavar, a conformance checker we develop at MPI-SWS (https://github.com/joulook/daavar); the issue it fixes is #1352.
CONTRIBUTINGGuide.onMessageSendStreamnow emits the task'sTaskbefore the first event when that event is a status or artifact update; a firstTaskorMessageis unchanged. For a new task theTaskis built before the agent runs (SUBMITTED, opening message, no artifacts) and registered with the newMainEventBusProcessor.registerInitialTask, so the streamedTaskis the one persisted; for a continuation it is the task as the request stored it. No update is sent twice.onSubscribeToTaskalready does this (§3.1.6).compat-0.3 streams change the same way. Four tests that expected no leading
Taskon a continuation are updated (JSONRPCHandlerTest,GrpcHandlerTest,AbstractA2AServerTest, its 0.3 twin).Tests. Eight new deterministic tests in
DefaultRequestHandlerTest; the regression test isstreamingNewTaskStatusFirstBeginsWithTask. Built and tested onmain9c7eabf(JDK 17.0.21):mvn -pl server-common test660 pass (652 before);mvn -B package -fae -DskipDockerTests=trueBUILD SUCCESS, 4 041 tests run (4 033 before), 0 failures. TCK not run locally.Re-check (evidence at tag
a2a-fixes-2026-11-21). Model off40664fwith the patch mirrored (equivalent under the model's abstraction to586fdd5; the changes up to9c7eabfdo not touch the send-stream path). Unit: N/M = behaviours of the SDK's visible roles (sequences of sends and receives with final statuses) that the specification program does not produce, out of M explored: one server 11/18 before, 0/18 after; summed over all 14 scenarios, 97 before (every one a stream starting with a status and noTask), 0 after. The model has one streaming send per task, so continuation turns are covered by the unit tests only. The ACTS suite does not catch this: its streaming tests check event counts, monotonic states and the final event (STREAM-SSE-001), and the first event of a subscribe (STREAM-SSE-004, which also accepts a status update there).Fixes #1352