Skip to content

fix(server): enforce A2A-Version on the REST and gRPC bindings - #443

Merged
muscariello merged 1 commit into
stack/03a-rest-error-media-typefrom
stack/04-a2a-version-rest-grpc
Nov 2, 2026
Merged

muscariello merged 1 commit into
stack/03a-rest-error-media-typefrom
stack/04-a2a-version-rest-grpc

Conversation

@muscariello

@muscariello muscariello commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #410. Replaces #411. Stacked on #455: review only the last commit.

Cause: only the JSON-RPC binding checked A2A-Version. HTTP+JSON and gRPC served a request with A2A-Version: 99.0, or with no version, as a 1.0 request, although §3.6.2 requires every interface to answer VersionNotSupportedError and to read an empty value as 0.3.

Fix: check_a2a_version moves from jsonrpc.rs to middleware.rs and becomes pub. rest_router runs it in a route_layer ahead of every route, falling back to the A2A-Version query parameter (§3.6.1). GrpcHandler runs it on the metadata of every method before dispatch. Rejections reuse the existing mappings: 400 / FAILED_PRECONDITION with reason VERSION_NOT_SUPPORTED.

Behavior change: a REST or gRPC client that sends no A2A-Version is now rejected, as JSON-RPC clients already are. Tests that call the transports directly now send 1.0.

Unproven: #411 says the a2a-python and a2a-go clients send the header on every transport, that #388 adds the same check on the 1.1 line, and reports an ITK 12/12 run. None of that was checked or run locally.

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Only the JSON-RPC binding read A2A-Version: HTTP+JSON and gRPC served
a request with `A2A-Version: 99.0`, or with no version at all, as a
1.0 request, although 3.6.2 requires every interface to answer
VersionNotSupportedError and to read an empty value as 0.3.

The JSON-RPC check moves unchanged to middleware::check_a2a_version.
rest_router runs it ahead of every route and, when the header is
absent, reads the A2A-Version query parameter that 3.6.1 allows
instead; GrpcHandler runs it on the metadata of every method. Both
answer with the existing VERSION_NOT_SUPPORTED mapping (400 /
FAILED_PRECONDITION). Tests that call the transports directly now send
the version, as the JSON-RPC ones already do.

Fixes: #410

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: gulldan <[email protected]>
@muscariello
muscariello force-pushed the stack/04-a2a-version-rest-grpc branch from fab84ab to 6781b86 Compare November 2, 2026 14:28
@muscariello
muscariello removed this pull request from stack #442 November 2, 2026 15:00
@muscariello
muscariello changed the base branch from stack/03-inmemory-task-store-limit to stack/03a-rest-error-media-type November 2, 2026 15:01
@muscariello
muscariello added this pull request to stack #456 November 2, 2026 15:01
@muscariello
muscariello added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit ad72f57 Nov 2, 2026
25 checks passed
@muscariello
muscariello deleted the stack/04-a2a-version-rest-grpc branch November 2, 2026 17:44
@github-actions github-actions Bot mentioned this pull request Nov 2, 2026
muscariello added a commit to gulldan/a2a-rs that referenced this pull request Nov 3, 2026
§3.6.1 lets a client send A2A-Version as a request parameter instead of
a header. The HTTP+JSON binding honors the query form since a2aproject#443; the
JSON-RPC binding read only the header, so POST /?A2A-Version=1.0 without
the header was refused with -32009 "version not supported: 0.3".

The query fallback moves from rest.rs into middleware::add_query_version,
which both HTTP bindings call before check_a2a_version. The header still
wins when both are present.

Signed-off-by: gulldan <[email protected]>
Co-authored-by: Luca Muscariello <[email protected]>
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]: A2A-Version is checked on JSON-RPC only; HTTP+JSON and gRPC run any version

3 participants