Repository navigation
fix(jsonrpc): return JSON-RPC errors as HTTP 200 and dispatch on A2A-Version - #747
Merged
Merged
Conversation
🧪 Code Coverage
Generated by coverage-comment.yml |
bartek-gralewicz
approved these changes
Sep 23, 2026
…ncy with JSON-RPC error handling
bartek-gralewicz
pushed a commit
that referenced
this pull request
Sep 24, 2026
🤖 I have created a release *beep* *boop* --- ## [1.2.1](v1.2.0...v1.2.1) (2026-09-24) ### Bug Fixes * issue that status or artifact events do not propagate the metatadata to the task ([#748](#748)) ([72588af](72588af)) * **jsonrpc:** return JSON-RPC errors as HTTP 200 and dispatch on A2A-Version ([#747](#747)) ([733259d](733259d)) * **rest:** ensure taskId is correctly set from path parameters when creating push notification configs ([#740](#740)) ([4a42ec1](4a42ec1)) * **server:** add optional media type validation against agent defaultInputModes ([#745](#745)) ([27659a2](27659a2)) * validate JSON-RPC response version ([#698](#698)) ([e0cdc91](e0cdc91)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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
Two distinct bugs, both confined to the Express JSON-RPC handler.
1. JSON-RPC errors escaped as HTTP 4xx/5xx
JSONRPC-ERR-002andVER-NEG-001.§9.5 expresses a JSON-RPC failure in the envelope, so the HTTP status stays a transport concern. Two paths bypassed the transport handler — which already answers 200 — and leaked their own status instead:
express.json()returned 400 with a correct-32700body;handle()(user builder, card lookup, version validation) returned 500, so a refusedA2A-Versioncame back as a server fault carrying-32009.Both now return 200. The 500 is kept for genuine crashes, discriminated on the mapped code rather than the error class: anything that degrades to
INTERNAL_ERROR(-32603) is a server fault and keeps its 500, everything else is an outcome the envelope names. Discriminating oninstanceof A2AErrorwas the first attempt and was wrong — a bareA2AErrormaps to-32603, and an existing test correctly insisted that stays a 500.2. JSON-RPC dispatched on method-name grammar instead of the version
VER-NEG-002.The handler chose between the v1.0 and v0.3 dispatchers by inspecting the shape of
body.method— PascalCaseSendMessagemeant 1.0,message/sendmeant 0.3 — and ignoredA2A-Versionentirely. A request omitting the header therefore means 0.3 per §3.6.1, but aSendMessagein its body still got 1.0 semantics and succeeded. §3.6.2 requires processing a request with the semantics of the version it asked for.Routing is now the version: 0.3 (explicit, or by omitting the header) goes to the compat dispatcher, which does not recognise the 1.0 method name and refuses with
-32601. This is what the REST handler and the card handler already do; JSON-RPC was the odd one out.isLegacyRequestandshouldUseLegacyFallbackare deleted with their only caller.The visible behavior change: a 1.0 client that omits
A2A-Versionwas previously served as 1.0 and now gets-32601. That is the point of the test, and it is what §3.6.1 asks for. a2a-js's ownClientsends the header on every call (multitransport-client.ts:375), so no js-to-js traffic is affected, and the e2e and compat suites confirm it.Before:
After: