Skip to content

fix(compat): return result: null for v0.3 pushNotificationConfig/delete - #1481

Open
saquibjawedbit wants to merge 1 commit into
a2aproject:mainfrom
saquibjawedbit:fix/v03-jsonrpc-delete-result
Open

saquibjawedbit wants to merge 1 commit into
a2aproject:mainfrom
saquibjawedbit:fix/v03-jsonrpc-delete-result

Conversation

@saquibjawedbit

Copy link
Copy Markdown

Description

With enable_v0_3_compat=True, a successful v0.3 tasks/pushNotificationConfig/delete was answered with {"id": 1, "jsonrpc": "2.0"}, with neither result nor error. JSON-RPC 2.0 §5 requires result on success, the v0.3 schema requires result: null here, and the SDK's own v0.3 response type rejects the body. The v1.0 JSON-RPC path already returns "result": null.

Cause: JSONRPC03Adapter._process_non_streaming_request dumps the response with exclude_none=True, which also drops the None result of the delete success response.

Fix: keep exclude_none=True (so unset optional fields stay out) and put result back with content.setdefault('result', None). Only success responses go through this code path, so error responses are unaffected; for every other method result is already set.

Testing

New test in tests/compat/v0_3/test_jsonrpc_app_compat.py.

Before the fix:

AssertionError: assert {'id': '5', 'jsonrpc': '2.0'} == {'id': '5', 'jsonrpc': '2.0', 'result': None}

After:

$ pytest tests/compat/v0_3 -k delete
1 passed

Full suite on main (c16cab1):

$ pytest tests --ignore=tests/integration/cross_version
2618 passed, 215 skipped, 4 xfailed, 1 xpassed

ruff check, ruff format and ty check pass on the changed files.

Fixes #1480 🦕

A successful v0.3 `tasks/pushNotificationConfig/delete` was answered with
`{"jsonrpc": "2.0", "id": 1}`: no `result` and no `error`. JSON-RPC 2.0
requires the `result` member on every success response, and the v0.3
schema (`DeleteTaskPushNotificationConfigSuccessResponse`) requires
`result: null`. The SDK's own v0.3 response model rejects the body.

Root cause: `JSONRPC03Adapter._process_non_streaming_request` serializes
the response envelope with `model_dump(exclude_none=True)`. That is meant
to drop unset optional fields inside the result, but for delete the
result itself is `None`, so the whole member is dropped.

Keep `exclude_none` for the payload and put `result` back when it was
dropped. The v1.0 JSON-RPC dispatcher already answers with
`"result": null`.
@saquibjawedbit
saquibjawedbit requested a review from a team as a code owner November 16, 2026 13:43
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/compat/v0_3/jsonrpc_adapter.py 72.87% 75.57% 🟢 +2.70%
src/a2a/server/cluster/database_event_stream.py 97.27% 93.64% 🔴 -3.64%
Total 93.71% 93.70% 🔴 -0.01%

Generated by coverage-comment.yml

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.

[Bug]: v0.3 JSON-RPC tasks/pushNotificationConfig/delete succeeds with no result member

1 participant