Skip to content

Commit a13055f

Browse files
committed
fix(server): suppress CancelledError in cleanup and fix test expectation
1 parent 7cc5d03 commit a13055f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/a2a/server/request_handlers/default_request_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,10 @@ async def _cleanup_producer(
447447
"""Cleans up the agent execution task and queue manager entry."""
448448
if cancel:
449449
producer_task.cancel()
450-
await producer_task
450+
try:
451+
await producer_task
452+
except asyncio.CancelledError:
453+
pass
451454
await self._queue_manager.close(task_id)
452455
async with self._running_agents_lock:
453456
self._running_agents.pop(task_id, None)

tests/server/request_handlers/test_jsonrpc_handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ async def streaming_coro():
322322

323323
self.assertIsInstance(response.root, JSONRPCErrorResponse)
324324
assert response.root.error == UnsupportedOperationError() # type: ignore
325-
mock_agent_executor.execute.assert_called_once()
326325

327326
@patch(
328327
'a2a.server.agent_execution.simple_request_context_builder.SimpleRequestContextBuilder.build'

0 commit comments

Comments
 (0)