Repository navigation
Description
What happened?
#1458 made CompatRestTransport (the v0.3 REST client) percent-encode task ids and push config ids in URL paths, at six sites. delete_task_push_notification_config was not one of them, because the v0.3 REST server only got its DELETE route in #1442. It still builds the path from raw ids:
a2a-python/src/a2a/compat/v0_3/rest_transport.py
Lines 303 to 307 in a59bb68
| await self._execute_request( | |
| 'DELETE', | |
| f'/v1/tasks/{request.task_id}/pushNotificationConfigs/{request.id}', | |
| context=context, | |
| ) |
So an id with #, ? or % names a different resource. Deleting the config alerts#ops sends DELETE /v1/tasks/t1/pushNotificationConfigs/alerts (httpx treats #ops as a fragment), and the server deletes the config alerts. The config the caller asked to delete is left, and notifications keep going to its webhook. The get, list and create calls on the same transport, and RestTransport.delete_task_push_notification_config (#1436), already encode their ids.
Repro (real DefaultRequestHandler behind create_rest_routes(..., enable_v0_3_compat=True), called through httpx.ASGITransport):
import asyncio, httpx
from starlette.applications import Starlette
from a2a.compat.v0_3.rest_transport import CompatRestTransport
from a2a.server.context import ServerCallContext
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.routes import create_rest_routes
from a2a.server.tasks import InMemoryPushNotificationConfigStore, InMemoryTaskStore
from a2a.types.a2a_pb2 import (
AgentCapabilities, AgentCard, DeleteTaskPushNotificationConfigRequest,
ListTaskPushNotificationConfigsRequest, Task, TaskPushNotificationConfig,
TaskState, TaskStatus,
)
async def main():
store = InMemoryTaskStore()
await store.save(Task(id='t1', context_id='c1', status=TaskStatus(state=TaskState.TASK_STATE_WORKING)), ServerCallContext())
card = AgentCard(capabilities=AgentCapabilities(push_notifications=True))
handler = DefaultRequestHandler(None, store, card, push_config_store=InMemoryPushNotificationConfigStore())
app = Starlette(routes=create_rest_routes(handler, enable_v0_3_compat=True))
async with httpx.AsyncClient(transport=httpx.ASGITransport(app=app), base_url='http://agent') as http:
client = CompatRestTransport(http, card, 'http://agent')
for cid in ('alerts', 'alerts#ops'):
await client.create_task_push_notification_config(
TaskPushNotificationConfig(task_id='t1', id=cid, url='https://example.com/hook'))
ids = lambda r: sorted(c.id for c in r.configs)
print('before:', ids(await client.list_task_push_notification_configs(ListTaskPushNotificationConfigsRequest(task_id='t1'))))
await client.delete_task_push_notification_config(DeleteTaskPushNotificationConfigRequest(task_id='t1', id='alerts#ops'))
print("after delete('alerts#ops'):", ids(await client.list_task_push_notification_configs(ListTaskPushNotificationConfigsRequest(task_id='t1'))))
asyncio.run(main())Output on main (a59bb68):
before: ['alerts', 'alerts#ops']
after delete('alerts#ops'): ['alerts#ops']
Expected: after delete('alerts#ops'): ['alerts']. Delete Push Notification Config "MUST permanently remove the specified push notification configuration" (https://a2a-protocol.org/latest/specification/#3110-delete-push-notification-config), and ids are opaque strings, so any id the server accepted on create should be deletable by that id.
Actual: the config named by the id's prefix is deleted, and the requested one stays.
The fix is the same _quote_id call the other six paths use. I have a fix with a test and can open a PR.
Activity
rohityan commentedon Nov 18, 2026
Hi @saquibjawedbit, Thank you for the detailed report and minimal reproduction script. I was able to reproduce the issue.
The
CompatRestTransport.delete_task_push_notification_config()interpolatesrequest.task_idandrequest.iddirectly into the path format string without escaping. Unlike the other endpoints updated in earlier PRs,request.idis not passed through_quote_id(). When anIDcontains#(such as 'alerts#ops'),httpxinterprets#opsas a URI fragment and strips it from the outgoing path. As a result,DELETE /v1/tasks/t1/pushNotificationConfigs/alertsis issued, mistakenly deleting 'alerts' while leaving 'alerts#ops' active.Thank you for contributing towards a fix in PR #1486 , it correctly wraps
request.task_idandrequest.idwith_quote_id(). Assigning the issue to you till the PR is reviewed.As a workaround till PR merges you can manually percent-encode configuration IDs using
urllib.parse.quote(..., safe='')prior to callingdelete_task_push_notification_config().