Skip to content

fix(rest): name an error frame in a stream "error" - #490

Merged
muscariello merged 3 commits into
stack/21-rest-delete-push-config-bodyfrom
stack/22-rest-stream-error-event
Nov 4, 2026
Merged

muscariello merged 3 commits into
stack/21-rest-delete-push-config-bodyfrom
stack/22-rest-stream-error-event

Conversation

@muscariello

Copy link
Copy Markdown
Member

Fixes #479. Replaces #480.

Cause: the error frame of an HTTP+JSON stream had no event name. a2a-python's REST client sends error to its error handler and reads any other frame as a StreamResponse, so the google.rpc.Status body from #449 was read as an empty event and the error never reached the caller. Its REST server names the frame error. §11.7 does not name it, so this is interoperability, not a MUST.

Fix: rest_sse sends an Err item under event: error through a new pub(crate) sse_from_rest_stream, body unchanged from #449. sse_from_stream and sse_jsonrpc_stream keep their signatures, so nothing public changes.

Tests: test_stream_error_event_is_a_google_rpc_status also checks that only the error frame is named error (on main none is); test_sse_from_rest_stream_names_the_error_frame covers the new function.

Unproven: not run against a2a-python's client. From their source, the .NET and Go clients read only each frame's data, so the name does not affect them.

@muscariello
muscariello requested a review from a team as a code owner November 3, 2026 19:54
@muscariello
muscariello added this pull request to stack #492 November 3, 2026 19:55
@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!

@muscariello
muscariello force-pushed the stack/22-rest-stream-error-event branch from d9ed174 to 44c1859 Compare November 3, 2026 20:52
@muscariello
muscariello requested a review from lgecse November 3, 2026 22:22
@muscariello
muscariello force-pushed the stack/22-rest-stream-error-event branch from 44c1859 to 0a2610f Compare November 3, 2026 22:39
@muscariello
muscariello force-pushed the stack/22-rest-stream-error-event branch from 0a2610f to af33efa Compare November 4, 2026 08:16
gulldan and others added 3 commits November 4, 2026 12:57
An error inside an HTTP+JSON stream was sent as an unnamed SSE frame
carrying the google.rpc.Status body (#449). a2a-python's REST client
treats a frame as an error only when its event name is "error" and reads
every other frame as a StreamResponse, so the error was dropped on the
floor and the consumer got an empty event instead. a2a-python's own REST
server names the frame; this does the same. The JSON-RPC binding is
unchanged: its error travels inside the envelope.

Signed-off-by: gulldan <[email protected]>
Naming the error frame needs a serializable error type, which changed the
signature of the public sse_from_stream. Leave it as it was, give rest_sse
its own pub(crate) sse_from_rest_stream, and test the frame name there, so
the fix is not a breaking change to a2a-server-lf.

Signed-off-by: Luca Muscariello <[email protected]>
@muscariello
muscariello force-pushed the stack/22-rest-stream-error-event branch from af33efa to 728f5ff Compare November 4, 2026 11:57
@muscariello
muscariello added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 3a25ef2 Nov 4, 2026
22 checks passed
@muscariello
muscariello deleted the stack/22-rest-stream-error-event branch November 4, 2026 14:20
@github-actions github-actions Bot mentioned this pull request Nov 4, 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]: an error inside an HTTP+JSON stream is an unnamed SSE frame, which a2a-python's REST client drops

3 participants