fix: reconcile live scheduled resume cancellation

This commit is contained in:
lda
2026-09-09 18:33:57 +07:00 Verified
parent 82dc5a80ae
commit 86a52adda5
3 changed files with 122 additions and 8 deletions
+5 -7
View File
@@ -221,14 +221,12 @@ class WorkflowRunApi:
store=store,
)
except asyncio.CancelledError:
# Shutdown drain cancelled the execution mid-flight (or the
# caller went away): fence, don't release. The durable
# executing mark and the ACTIVE attempt stay exactly as a
# crash mid-resume would leave them, so restart recovery
# fails the run closed instead of presenting a half-resumed
# run as safe to retry. Cancellation is never swallowed.
# Shutdown cancellation keeps the durable crash shape for
# restart recovery. A caller cancellation while the service is
# still live is reconciled for this run immediately, so its
# ambiguous failure frees capacity without becoming retryable.
if slot_held and gate is not None:
gate.fence(run_id)
gate.reconcile_cancelled(run_id)
raise
except BaseException:
# Pre-persist errors, torn persists, and validation failures: