Skip to content

fix(compat): map v0.3 JSON-RPC error bodies sent with a non-2xx status - #1519

Open
ConnorMoss02 wants to merge 1 commit into
a2aproject:mainfrom
ConnorMoss02:fix/v03-jsonrpc-error-body
Open

ConnorMoss02 wants to merge 1 commit into
a2aproject:mainfrom
ConnorMoss02:fix/v03-jsonrpc-error-body

Conversation

@ConnorMoss02

Copy link
Copy Markdown
Contributor

Fixes #1517

CompatJsonRpcTransport now raises the mapped A2A error when a v0.3 server sends a JSON-RPC error with a non-2xx status, for both unary and streaming calls, using the same check as #1476. Other bodies, like a gateway's HTML or an unknown code, still raise HTTP Error: <status>.

The new tests in tests/compat/v0_3/test_jsonrpc_transport.py fail on main. tests/ passes: 2723 passed.

@ConnorMoss02
ConnorMoss02 requested a review from a team as a code owner November 24, 2026 17:55
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/compat/v0_3/jsonrpc_transport.py 79.63% 80.79% 🟢 +1.16%
Total 94.12% 94.13% 🟢 +0.01%

Generated by coverage-comment.yml

@chrikrah chrikrah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ConnorMoss02 Approving: a straight port of #1476 that keeps HTTP Error: <status> for unmapped bodies.

# head b769225 (base eaa71bc), git archive, uv sync --locked --group httpx2, a2a.__file__ under the tree
$ pytest -q -n 4 tests
2723 passed, 215 skipped, 4 xfailed, 1 xpassed
# compat/v0_3/jsonrpc_transport.py from eaa71bc, tests kept
$ pytest -q tests/compat/v0_3/test_jsonrpc_transport.py
3 failed, 40 passed   # unary 404 and 500, streaming
$ ruff check && ruff format --check   # ruff 0.15.16
All checks passed! / 290 files already formatted
# not run: the ITK and TCK jobs

non-blocking: the 502 fallback cases are unary only. Add a streaming one?

@Iwaniukooo11 Iwaniukooo11 self-assigned this Nov 26, 2026
known A2A code is mapped; any other body, such as a gateway's own
error, raises the generic HTTP error. Error bodies are mapped the same
way as in the 1.0 transport.
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please trim to one line

This branch has not been deployed

No deployments
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.

v0.3 JSON-RPC client ignores the error body when the HTTP status is not 2xx

3 participants