Repository navigation
fix(client): report the HTTP status of a non-JSON-RPC error response - #439
Merged
Merged
Conversation
This was referenced Nov 1, 2026
muscariello
force-pushed
the
stack/01-client-jsonrpc-http-status
branch
from
November 1, 2026 21:28
ba652a5 to
a513c27
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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: #404
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: gulldan <[email protected]>
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]>
muscariello
force-pushed
the
stack/01-client-jsonrpc-http-status
branch
from
November 2, 2026 12:02
a513c27 to
30726b0
Compare
msardara
approved these changes
Nov 2, 2026
Merged
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. Replaces #406, restacked on in-repo branches so the stack can be reviewed one commit at a time.
Cause:
JsonRpcTransportnever read the HTTP status. A401,429or502from a proxy or gateway is not a JSON-RPC envelope, so callers gotINTERNAL_ERROR"failed to parse JSON-RPC response", and a streaming call answered that way without a content type reached the SSE parser and returned an empty stream.Fix: one
parse_jsonrpc_response(status, body)replaces three copies of the envelope parse. A JSON-RPC body is decoded whatever the status, as before; anything else is reported asHTTP <status>: <body>, the text the REST transport already uses. A non-success status incall_streamingno longer goes to the SSE parser. The error code staysINTERNAL_ERROR.Unproven: the new tests (a
429onGetTask, a bare401onSubscribeToTask) and the before/after results in #406 were not run locally. CI is the check.