Skip to content

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

Closed
gulldan wants to merge 2 commits into
a2aproject:mainfrom
gulldan:fix/rest-stream-error-event
Closed

gulldan wants to merge 2 commits into
a2aproject:mainfrom
gulldan:fix/rest-stream-error-event

Conversation

@gulldan

@gulldan gulldan commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #479.

Problem

The error frame of an HTTP+JSON stream had no event name. a2a-python's REST client dispatches on the name: error goes to its error handler, anything else is parsed as a StreamResponse, so the google.rpc.Status body that #449 introduced was read as an empty event and the error never reached the caller. a2a-python's REST server names the frame error.

Fix

  • sse::sse_from_stream takes the stream's error type as a serializable value and sends an Err item under the event name error, with the body as given.
  • rest_sse maps an A2AError to the {"error": Status} envelope and leaves it on the Err side, so the frame is named. The body is unchanged from fix(rest): send stream errors as google.rpc.Status #449, and sse_jsonrpc_stream is untouched: a JSON-RPC error stays inside the envelope, where its client reads it.

The Rust client ignores event: lines and already maps the body (#449), so it is unaffected; a2a-go's client reads the body regardless of the name.

Tests

  • test_stream_error_event_is_a_google_rpc_status now also checks that the error frame, and only it, is named error. On main no frame is named.
  • sse unit tests exercise the named frame and the per-response ids with a serializable error.
  • CI steps on Linux, stable 1.99.1, on top of main 3f3dea6: all green (868 tests). Patch coverage as coverage.yml builds it: 27 coverable added lines, 0 missed.

Overlap

One commit on main, after #449. a2a-server/src/sse.rs and rest_sse only; #468 does not touch either.

🤖 Generated with Claude Code

gulldan and others added 2 commits November 3, 2026 21:41
An error inside an HTTP+JSON stream was sent as an unnamed SSE frame
carrying the google.rpc.Status body (a2aproject#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.

Co-Authored-By: Claude Mythos 5.1 <[email protected]>
Signed-off-by: gulldan <[email protected]>
@gulldan
gulldan requested a review from a team as a code owner November 3, 2026 16:00
@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

Copy link
Copy Markdown
Member

Replaced by #490, which carries these commits plus one that keeps the signature of the public sse_from_stream unchanged: the named error frame goes through a new pub(crate) function instead.

@muscariello muscariello closed this 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]: an error inside an HTTP+JSON stream is an unnamed SSE frame, which a2a-python's REST client drops

2 participants