Repository navigation
Conversation
The JSON-RPC transport never looked at the status of a response. An
error that something in front of the agent answers itself (an
authenticating proxy's 401, a gateway's 429 or 502) carries no
JSON-RPC envelope, so the caller got "failed to parse JSON-RPC
response" and could not tell a credential or rate-limit problem from
a broken server. A streaming call answered that way without a content
type was handed to the SSE parser and came back as an empty stream.
A body that is not a JSON-RPC envelope is now reported with its
status, as the REST transport already does ("HTTP 429 Too Many
Requests: <body>"); a JSON-RPC envelope is still decoded whatever the
status, and a non-success status is never treated as a stream.
Fixes: a2aproject#404
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: gulldan <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The streaming test matched on the result and panicked in an `Ok` arm that a passing run never reaches, so that line stayed uncovered. Taking the error with `.err().expect()` keeps the assertion and needs no `Debug` on the stream. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: gulldan <[email protected]>
This was referenced Oct 31, 2026
This was referenced Nov 1, 2026
Member
|
Superseded by #439, which carries the same commit on an in-repo branch so the stack can be reviewed one commit at a time. |
This was referenced Nov 5, 2026
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.
Fixes #404.
Problem
JsonRpcTransportnever looked at the HTTP status of a response. When something in front of the agent answers an error itself — an authenticating proxy's401, a gateway's429or502— the body is not a JSON-RPC envelope, so the caller gotINTERNAL_ERROR"failed to parse JSON-RPC response: …" and could not tell an expired credential or a rate limit from a broken server. A streaming call answered that way withoutContent-Typewent to the SSE parser and came back asOkwith an empty stream.Fix
parse_jsonrpc_response(status, body)replaces the three copies of the envelope parse (call_value_with_payload, the non-SSE branch ofcall_streaming,delete_push_config). A body that is a JSON-RPC envelope is decoded whatever the status, as before; one that is not is reported with its status —HTTP 429 Too Many Requests: <body>— the same textparse_rest_errorgives on the HTTP+JSON transport. A success that fails to parse keeps today's message.call_streaming, a non-success status is never treated as an event stream, so it reaches that parse instead of the SSE parser.The error code stays
INTERNAL_ERROR, as on the REST transport; mapping statuses to A2A codes would be a separate change.Tests
test_http_error_without_jsonrpc_body_reports_the_status:GetTaskanswered with429 Too Many Requestsand a plain body. Onmain:failed to parse JSON-RPC response: expected value at line 1 column 1.test_streaming_http_error_reports_the_status_not_an_empty_stream:SubscribeToTaskanswered with a bare401and no content type. Onmainit gets a stream (expected error, got a stream).test_subscribe_to_task_surfaces_unparseable_non_streaming_body(a200with a non-JSON-RPC body) still passes with its message unchanged.HTTP 429 Too Many Requests: {"error":"budget exceeded"},HTTP 401 Unauthorized:, andHTTP 401 Unauthorized:for the subscription.cargo metadata --locked,cargo hack check --all-targets --each-feature,cargo fmt --check,cargo hack clippy --all-targets --each-feature -- -D warnings,cargo test --workspace --exclude itk-rust-current-agent, copyright headers — all green.Overlap with the A2A 1.1 stack
#384–#397 also edit
a2a-client/src/jsonrpc.rs, and this diff does not apply as is onrefs/pull/396/head; the status handling there is unchanged, so the same three call sites need it. Happy to rebase onto the stack once it lands.🤖 Generated with Claude Code