Repository navigation
fix(client): accept an empty body when deleting a push notification config - #1445
Merged
mykytanetipa merged 2 commits intoNov 13, 2026
Merged
mykytanetipa merged 2 commits into
mykytanetipa merged 2 commits into
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/transports/rest.py | 89.57% | 89.95% | 🟢 +0.38% |
| Total | 93.63% | 93.63% | ⚪️ 0.00% |
Generated by coverage-comment.yml
…onfig
The spec leaves the result of DeleteTaskPushNotificationConfig to the
implementation. This SDK's server answers `{}`, a2a-js answers 204 No
Content and a2a-go a 200 with no body. RestTransport parsed every
success response as JSON, so against the other two servers the config
was deleted but the call raised `A2AClientError: JSON Decode Error`.
The delete now checks the status and does not read the body. Error
responses still map to A2A errors through _handle_http_error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
coder-abu
force-pushed
the
fix/rest-delete-push-config-empty-body
branch
from
November 12, 2026 12:24
f9619f5 to
7b4082f
Compare
4 tasks done
Iwaniukooo11
added a commit
that referenced
this pull request
Nov 23, 2026
…ig (#1502) # Description `CompatRestTransport.delete_task_push_notification_config` goes through `_execute_request`, which always calls `response.json()`. #1445 fixed this in `RestTransport`. The v0.3 transport still has it. v0.3 REST servers confirm a delete in different ways: - this SDK's v0.3 compat server answers 200 with `{}`; - a2a-go's v0.3 compat server answers 204 No Content ([`handleDeleteTaskPushConfig`](https://github.com/a2aproject/a2a-go/blob/c746bfd5e4db3806d423d0cea15dbf0919f9bbfa/a2acompat/a2av0/rest_server.go#L392-L408)); - a2a-js v0.3.14 answers 204 No Content ([`rest_handler.ts`](https://github.com/a2aproject/a2a-js/blob/cfeed0d70c8747ccd72cbc31774c025676e15fdc/src/server/express/rest_handler.ts#L500-L518)). Against the last two, the config is deleted, but the Python client then raises `A2AClientError: JSON Decode Error: Expecting value: line 1 column 1 (char 0)`. A caller that retries or reports the failure is acting on a delete that succeeded. | Response | Before | After | |---|---|---| | 200 `{}` | ok | ok | | 204, no body | `A2AClientError: JSON Decode Error` | ok | | 200, no body | `A2AClientError: JSON Decode Error` | ok | | 404 `{"type": "TaskNotFoundError", ...}` | `TaskNotFoundError` | `TaskNotFoundError` | ## Fix All in `src/a2a/compat/v0_3/rest_transport.py`: - The delete now sends its request, checks the status, and does not read the body, the same way `RestTransport` does since #1445. Error responses still go through `_handle_http_error`, so a mapped error such as `TaskNotFoundError` is still raised. - The header and request building moves out of `_execute_request` into a new `_build_request`, so the delete still sends the `A2A-Version: 0.3` and legacy extension headers. `_execute_request` calls it and is otherwise unchanged. ## Tests - `test_compat_rest_transport_delete_task_push_notification_config` used to mock `_execute_request`. It now runs against an `httpx.MockTransport` for each response in the table, and checks the method, the path and the `A2A-Version` header. The `no_content` and `empty_200` cases fail on main with the error above and pass with the fix: ``` $ pytest tests/compat/v0_3/test_rest_transport.py # src change reverted FAILED ...::test_compat_rest_transport_delete_task_push_notification_config[no_content] FAILED ...::test_compat_rest_transport_delete_task_push_notification_config[empty_200] 2 failed, 42 passed $ pytest tests/compat/v0_3/test_rest_transport.py # this branch 44 passed ``` - `test_compat_rest_transport_delete_task_push_notification_config_error` checks that a 404 with `TaskNotFoundError` still raises `TaskNotFoundError`. It passes before and after. - `uv run pytest tests/compat/v0_3`: 362 passed (with the `httpx2` group installed, `test_rest_transport.py` and `tests/client/transports/test_rest_client.py` also pass: 97 passed) - `ruff check`, `ruff format --check` and `ty check` pass. `ty` prints only the three existing unused `type: ignore` warnings in `client_factory.py` and `transports/__init__.py`. - `uv run pytest` on Windows, Python 3.11, skipping `tests/integration/cross_version` and `tests/integration/push_notifications` because they need `os.killpg` and fork-based multiprocessing: 2646 passed, 215 skipped, 4 xfailed, 1 xpassed (with `PYTHONUTF8=1`, which `test_samples_smoke.py` needs on a cp1252 console) - [x] Follow the [`CONTRIBUTING` Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md). - [x] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - [x] Ensure the tests and linter pass (Run `bash scripts/format.sh` from the repository root to format) - [x] Appropriate docs were updated (if necessary) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Mateusz Iwaniuk <45974414+Iwaniukooo11@users.noreply.github.com>
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
RestTransport.delete_task_push_notification_configgoes through_execute_request, which always callsresponse.json(). The spec leaves the result to the server (3.1.10: "Confirmation of deletion (implementation-specific)"), and the SDKs answer differently:{};rest_handler.ts);handleDeleteTaskPushConfig).Against a2a-js or a2a-go servers, the config is deleted, but the Python client then raises
A2AClientError: JSON Decode Error. A caller that retries or reports the failure is acting on a delete that succeeded.The delete now sends its request, checks the status, and does not read the body. Error responses still go through
_handle_http_error, so a 404 withTASK_NOT_FOUNDstill raisesTaskNotFoundError.send_http_requestand the JSON-RPC transport are unchanged.The repro at the end of this description answers the delete the way each server does. On main (2cc1dd5):
On this branch, all three print
ok.The new tests also cover a mapped error and a closed client on this path. I left the cross-version tests out because their servers don't start within the 3 s timeout on my machine; the same happens on main.
ruff check,ruff formatandty checkpass.typrints only the three existing unusedtype: ignorewarnings.#1439 touches
send_http_requestand the transport type hints. This change stays insidedelete_task_push_notification_configto keep out of its way, apart from one added import. #1436 percent-encodes the ids in this method's path, so whichever of the two lands second has a one-line conflict there; I'll rebase this one if #1436 goes first.CONTRIBUTINGGuide.bash scripts/format.shfrom the repository root to format)No issue exists, since the new tests reproduce it.
Repro script
🤖 Generated with Claude Code