You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
a2a: a CancelledError from runner.run_async now leaves the task in TASK_STATE_WORKING #8417
Since 5096169, when runner.run_async raises asyncio.CancelledError on its own (no A2A cancel request, outer task not being cancelled), _consume_runner_with_abort re-raises it. Propagating it is the point of that commit, but neither executor publishes a terminal status before the error leaves execute(): A2aAgentExecutor.execute only handles Exception, and the new-impl executor does the same. The a2a-sdk request handler absorbs the CancelledError and closes the stream, so the client's last update is TASK_STATE_WORKING and the task store keeps the task in WORKING permanently.
Before 5096169 the error was swallowed, and since abort_signal had been set, the executor took the abort path and ended the task as TASK_STATE_CANCELED.
Repro: a real a2a-sdk 1.2.2 server and client in-process over ASGI (using the tests/unittests/a2a/integration helpers). The fake runner yields one partial event and then raises CancelledError:
client's last state stored task state
50961696a~1 (all 4 combos) TASK_STATE_CANCELED TASK_STATE_CANCELED
50961696a / main (all 4) TASK_STATE_WORKING TASK_STATE_WORKING
"All 4 combos" means streaming on and off, legacy and new executor. A stray CancelledError like this can come from an anyio cancel scope (e.g. an MCP client session) or from awaiting a task that was cancelled elsewhere. The new tests in 5096169 check that the error propagates but not the task's final state.
Expected behavior
The task ends in a terminal state (canceled or failed) before the CancelledError is re-raised, as it did before.
May I work on this issue (#8417: a2a: a CancelledError from runner.runasync now leaves the task in TASKSTATEWORKING) and, if I can reproduce it, submit a focused fix with regression coverage? Please let me know if someone is already handling it or if you would prefer a different approach. I would use Codex assistance and disclose that in any PR.
Activity
chelsealong commentedon Nov 28, 2026
May I work on this issue (#8417: a2a: a CancelledError from runner.runasync now leaves the task in TASKSTATEWORKING) and, if I can reproduce it, submit a focused fix with regression coverage? Please let me know if someone is already handling it or if you would prefer a different approach. I would use Codex assistance and disclose that in any PR.