Repository navigation
fix(compat): return A2A error codes from the v0.3 JSON-RPC adapter - #1369
Open
shwetangsinha0509 wants to merge 1 commit into
Open
shwetangsinha0509 wants to merge 1 commit into
shwetangsinha0509 wants to merge 1 commit into
Conversation
A2AErrors raised while handling v0.3 JSON-RPC requests fell through to the generic handler and were returned as -32603 InternalError, so v0.3 clients could not tell e.g. TaskNotFoundError (-32001) apart from a server failure. Map them to their JSON-RPC codes in the non-streaming and streaming paths, keeping -32603 for errors that have no v0.3 equivalent.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/compat/v0_3/jsonrpc_adapter.py | 66.67% | 68.22% | 🟢 +1.55% |
| Total | 92.90% | 92.87% | 🔴 -0.03% |
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
A2A errors raised while handling v0.3 JSON-RPC requests fell through to the generic
except ExceptioninJSONRPC03Adapterand were returned as-32603 InternalError. v0.3 clients could not distinguish e.g.TaskNotFoundError(-32001) from a server failure.This maps
A2AErrors to their JSON-RPC codes viaJSON_RPC_ERROR_CODE_MAPin both paths, matching whatJsonRpcDispatcherdoes for v1.0:handle_requestcatchesA2AErrorbefore the generic handler, and_generate_error_responsebuilds a v0.3JSONRPCErrorfrom itevent_generatoryields the mapped error event instead ofInternalErrorErrors that only exist in v1.0 (
-32008ExtensionSupportRequired,-32009VersionNotSupported) are not part of the v0.3 spec, so they still map to-32603. This keeps the existing expectation intests/integration/test_version_header.py.Tests (
tests/compat/v0_3/test_jsonrpc_app_compat.py):tasks/getnot found,tasks/cancelwithTaskNotFoundError/TaskNotCancelableError/UnsupportedOperationError, and an error raised mid-stream onmessage/stream. All fail onmainand pass with this change. Full suite passes locally;ruff check,ruff formatandty checkare clean.CONTRIBUTINGGuide.Fixes #1368 🦕