fix(errors): emit JSON-RPC error.data as typed-details array per A2A 1.0 spec hot-fix#1058
Open
sokoliva wants to merge 6 commits intoa2aproject:mainfrom
Open
fix(errors): emit JSON-RPC error.data as typed-details array per A2A 1.0 spec hot-fix#1058sokoliva wants to merge 6 commits intoa2aproject:mainfrom
sokoliva wants to merge 6 commits intoa2aproject:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request standardizes error responses across REST and JSON-RPC transports by introducing a structured error details format. It adds a build_error_details utility to generate google.rpc.ErrorInfo and google.rpc.BadRequest objects, ensuring consistent field-level violation reporting. The JSON-RPC client was also updated to correctly extract metadata from this new format. Feedback recommends adding the new JSONParseError class, the build_error_details function, and associated constants to the __all__ export list in src/a2a/utils/errors.py to properly expose them as part of the public API.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/transports/jsonrpc.py | 91.39% | 93.29% | 🟢 +1.90% |
| src/a2a/utils/error_handlers.py | 96.05% | 96.67% | 🟢 +0.61% |
| Total | 93.03% | 93.08% | 🟢 +0.05% |
Generated by coverage-comment.yml
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
Aligns the JSON-RPC and REST transports with the A2A 1.0 spec hot-fix which makes
error.data(JSON-RPC) anderror.details(REST) carry an array of typed-detail objects using the ProtoJSONAnyrepresentation.Server side
build_error_responseandbuild_rest_error_payloadnow emit a leadinggoogle.rpc.ErrorInfocarrying the canonical A2A reason anderror.dataasmetadata. ForInvalidParamsErrorwith validation details, both transports also append agoogle.rpc.BadRequestClient side
The JSON-RPC client now extracts
ErrorInfo.metadatafrom the array ontoA2AError.data.Also adds the missing
JSONParseError(-32700)exception class so JSON-RPC clients receive a typed exception for the standard parse-error code instead of falling back to a genericA2AClientError.Fixes #1027. 🦕