Repository navigation
fix(client): send A2A-Version from the JSON-RPC and REST transports - #1508
Open
saquibjawedbit wants to merge 1 commit into
Open
saquibjawedbit wants to merge 1 commit into
saquibjawedbit wants to merge 1 commit into
Conversation
The spec requires clients to send A2A-Version with each request. The gRPC transport adds it to every call, but the JSON-RPC and REST transports relied on ClientFactory setting it on the httpx client. A transport built with any other httpx client sent no version, so a v1.0 server read the request as 0.3 and answered VersionNotSupportedError. Add the header per request unless the call's service parameters or the httpx client already set one.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/transports/http_helpers.py | 93.51% | 93.83% | 🟢 +0.32% |
| src/a2a/server/agent_execution/active_task_registry.py | 100.00% | 97.80% | 🔴 -2.20% |
| Total | 94.11% | 94.09% | 🔴 -0.01% |
Generated by coverage-comment.yml
1 task done
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.
Description
The spec says "Clients MUST send the
A2A-Versionheader with each request" (§3.6.1), and a missing value means 0.3 (§3.6.2). The gRPC transport and the v0.3 transports add it to every call, but the v1.0JsonRpcTransportandRestTransportnever did: they only sent it whenClientFactoryhad already put it on the httpx client. Built directly with your ownhttpx.AsyncClient(both classes are public exports), every request was read as 0.3 by a v1.0 server and rejected withVersionNotSupportedError. The integration tests worked around this by adding the header to the hand-built httpx clients.Fix: a small helper in
http_helpers.pyaddsA2A-Versionto each request built by the two transports (unary, streaming, extended card). Precedence matchesClientFactory'ssetdefault: a value in the call's service parameters wins, then one on the httpx client, then ours. The integration-test workaround is removed, so those tests now cover this end to end.Testing
New tests per transport: the header is sent on unary and streaming calls, and a caller-supplied
a2a-version: 0.3service param is kept; plus a JSON-RPC extended-card test.Before the fix (main's source, new tests + integration tests without the workaround):
Repro with a real v1.0 server and a hand-built httpx client:
Full suite, rebased on main (06cd528):
ruff checkandruff formatpass.CONTRIBUTINGGuide.Fixes #1507 🦕