Skip to content

fix(server-common): begin message/stream with the Task object - #1353

Open
joulook wants to merge 1 commit into
a2aproject:mainfrom
joulook:issue-1352
Open

joulook wants to merge 1 commit into
a2aproject:mainfrom
joulook:issue-1352

Conversation

@joulook

@joulook joulook commented Nov 22, 2026

Copy link
Copy Markdown

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.

onMessageSendStream now emits the task's Task before the first event when that event is a status or artifact update; a first Task or Message is unchanged. For a new task the Task is built before the agent runs (SUBMITTED, opening message, no artifacts) and registered with the new MainEventBusProcessor.registerInitialTask, so the streamed Task is the one persisted; for a continuation it is the task as the request stored it. No update is sent twice. onSubscribeToTask already does this (§3.1.6).

compat-0.3 streams change the same way. Four tests that expected no leading Task on a continuation are updated (JSONRPCHandlerTest, GrpcHandlerTest, AbstractA2AServerTest, its 0.3 twin).

Tests. Eight new deterministic tests in DefaultRequestHandlerTest; the regression test is streamingNewTaskStatusFirstBeginsWithTask. Built and tested on main 9c7eabf (JDK 17.0.21): mvn -pl server-common test 660 pass (652 before); mvn -B package -fae -DskipDockerTests=true BUILD 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 of f40664f with the patch mirrored (equivalent under the model's abstraction to 586fdd5; the changes up to 9c7eabf do 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 no Task), 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

Copilot AI balanced review requested due to automatic review settings November 22, 2026 01:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: message/stream does not begin with the Task object when the agent opens the task with a status update (spec §3.1.2)

2 participants