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
A cancelled queue write can make a workflow report success #425
On 66311bd, run a Start → Answer graph and have the ready queue raise asyncio.CancelledError when it receives the Answer task.
The dispatcher exits, but Engine.run() still yields GraphRunSucceededEvent.
If the queue cancels during startup or resume, the caller can miss the failed event altogether.
The caller should get a failed event and the scheduling error.
If the graph was already failing or aborted, an error while draining another node should preserve the original reason.
There are two exception boundaries involved here, so changing only the dispatcher would leave startup/resume uncovered:
The dispatcher catches only Exception. asyncio.CancelledError bypasses that handler, but its finally still calls complete() and closes the event stream. With no recorded error or abort, _emit_terminal_events() selects success. [1][2]
Startup/resume scheduling happens before self._dispatcher.start(). Both the startup cleanup handler and the outer handler that yields GraphRunFailedEvent also catch only Exception, so cancellation bypasses both. Simply storing the cancellation would not suffice either: terminal-event emission re-raises the stored error through those same handlers. [2]
The original-reason requirement needs separate attention: GraphExecution.fail() unconditionally replaces error, while abort() stores its reason in that same field. A secondary drain error therefore needs to leave an existing failure or abort reason intact. [3]
Related regression context: #404 reports the same dispatcher-finalization path producing false success after GeneratorExit. That makes consumer closure worth keeping distinct from queue-write cancellation when adjusting these boundaries. [4]
I'm wondering what's the rationale behind handling asyncio.CancelledError in Graphon. AFAIK, the base assumption of Graphon is that it only support synchronous function call, and utilize (either native or gevent-patched) thread for concurrency / paralleism. In such runtime, asyncio.CancelledError should not be raised.
Besides, BaseException in Python is special since many CPython runtime components depend on correct handling of those exceptions. This is exactly the reason why BaseException is not a subclass of Exception: to avoid unintentional capture of those exceptions.
Activity
dosubot commentedon Nov 24, 2026
There are two exception boundaries involved here, so changing only the dispatcher would leave startup/resume uncovered:
Exception.asyncio.CancelledErrorbypasses that handler, but itsfinallystill callscomplete()and closes the event stream. With no recorded error or abort,_emit_terminal_events()selects success. [1] [2]self._dispatcher.start(). Both the startup cleanup handler and the outer handler that yieldsGraphRunFailedEventalso catch onlyException, so cancellation bypasses both. Simply storing the cancellation would not suffice either: terminal-event emission re-raises the stored error through those same handlers. [2]The original-reason requirement needs separate attention:
GraphExecution.fail()unconditionally replaceserror, whileabort()stores its reason in that same field. A secondary drain error therefore needs to leave an existing failure or abort reason intact. [3]Related regression context: #404 reports the same dispatcher-finalization path producing false success after
GeneratorExit. That makes consumer closure worth keeping distinct from queue-write cancellation when adjusting these boundaries. [4]To reply, just mention @dosu.
Docs are dead. Just use Dosu.
QuantumGhost commentedon Nov 24, 2026
I'm wondering what's the rationale behind handling
asyncio.CancelledErrorin Graphon. AFAIK, the base assumption of Graphon is that it only support synchronous function call, and utilize (either native or gevent-patched) thread for concurrency / paralleism. In such runtime, asyncio.CancelledError should not be raised.Besides,
BaseExceptionin Python is special since many CPython runtime components depend on correct handling of those exceptions. This is exactly the reason whyBaseExceptionis not a subclass ofException: to avoid unintentional capture of those exceptions.