Skip to content

fix(server): reject a message that does not answer the request alone - #464

Merged
muscariello merged 1 commit into
stack/18-stream-history-lengthfrom
stack/19-message-after-task-invalid-response
Nov 3, 2026
Merged

muscariello merged 1 commit into
stack/18-stream-history-lengthfrom
stack/19-message-after-task-invalid-response

Conversation

@muscariello

Copy link
Copy Markdown
Member

Fixes #437. Replaces #438.

Cause: A2A §3.1.2 says a response is exactly one Message, or a Task followed by its updates. drive_execution passed a Message through after task events, so a blocking send returned the late message and left the task WORKING. It also let events follow a Message that had already answered the request.

Fix: drive_execution tracks which kind of response the executor started. A Message after task events, or any event after an answering Message, ends the execution with InvalidAgentResponseError (-32006), and the task fails as in #459.

Tests: test_message_after_task_events_is_an_invalid_agent_response (WORKING, then a Message: send_message answers -32006) and test_event_after_an_answering_message_is_an_invalid_agent_response (a Message, then a status update: the stream carries the message, then -32006). Both fail with the fix reverted.

Unproven: the Python SDK applies the same two rules; the Go SDK only rejects a Message on a stored task. #438 says the A2A 1.1 handler/updates.rs still accepts both cases; not checked here.

@muscariello
muscariello requested a review from a team as a code owner November 3, 2026 09:34
@muscariello
muscariello added this pull request to stack #465 November 3, 2026 09:34
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

lgecse
lgecse previously approved these changes Nov 3, 2026
A2A §3.1.2: a response is exactly one Message, or a Task followed by its
updates. drive_execution passed a Message through after task events, so a
blocking send returned the late message and left the task WORKING, and it
let events follow a Message that had already answered. Either now ends the
execution with InvalidAgentResponseError (-32006), and the task fails.

Signed-off-by: gulldan <5641375+gulldan@users.noreply.github.com>
@muscariello
muscariello force-pushed the stack/19-message-after-task-invalid-response branch from 1beecd3 to c8c88d2 Compare November 3, 2026 11:16
@muscariello
muscariello added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 3335b59 Nov 3, 2026
22 checks passed
@muscariello
muscariello deleted the stack/19-message-after-task-invalid-response branch November 3, 2026 13:00
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
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]: a Message after a Task is accepted from the executor instead of InvalidAgentResponseError

3 participants