Repository navigation
Conversation
1 task done
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: andy <linux2011@qq.com>
Signed-off-by: andy <linux2011@qq.com>
Linux2010
force-pushed
the
codex/validate-jsonrpc-response-id
branch
from
November 19, 2026 11:33
1ac021a to
53edcdb
Compare
muscariello
reviewed
Nov 19, 2026
muscariello
left a comment
Member
There was a problem hiding this comment.
Checking the response ID against the request ID is what JSON-RPC 2.0 requires, and the shape is right: a mismatched ID, or a null ID on a success, is INVALID_AGENT_RESPONSE; a null ID on an error is accepted, since a server that could not read the request has nothing to echo; and a bad ID ends the stream. Both commits are signed off now, and the multiline SSE tests cover the data-line joining.
- The stream ends by reading the error code back.
parse_stream_tailmarks an itemterminalwhenerr.code == INVALID_AGENT_RESPONSE. That is the client's own mismatch error, but a server can send the same code in an error event (this repo'sapply_event_to_taskproduces it), and that would be treated as a mismatch too. Harmless if the server closes the stream after an error anyway, but a flag from the parse step avoids the coupling. - The mock server rewrites every canned response ID to the request's, unless it is
nullor"another-request". That keeps the existing tests green but hides which of them depend on a fixed ID. Passing the ID explicitly in the tests that need it would keep the intent visible. - A server that sends
"id": nullwith a success result now fails on unary and streaming calls. That is correct per the spec, but it is a behaviour change that needs a release note.
The a2a-client unit tests pass locally on this head.
Signed-off-by: andy <linux2011@qq.com>
This branch has not been deployed
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.
Summary
The JSON-RPC client generates a request ID but did not verify it on responses. A response for a different request could therefore be accepted as the current result or error.
Validate the ID for normal responses, stream preflight errors, SSE envelopes, unframed stream tails and push-config deletion. Preserve null-ID errors and existing bare StreamResponse SSE compatibility. Reject malformed envelopes rather than treating them as bare events, and stop and release the stream after locally detected protocol failures. Server-returned errors with the same numeric code are distinguished from local correlation failures. Test servers explicitly choose whether to echo a request ID or send the supplied ID. The client changelog calls out the stricter success-response validation.
Validation
cargo test -p a2a-client-lf --locked --offline: 144 unit tests and 10 integration tests passed.cargo clippy -p a2a-client-lf --all-targets --features fuzzing --locked --offline -- -D warnings.cargo fmt --all -- --checkandgit diff --check.Tests used the local cached registry mirror and a temporary macOS SDK wrapper.