Cancelling a run leaves the child runs its workflow.call steps started #2086

Closed
opened 2026-11-21 04:02:15 +00:00 by sam · 1 comment
Owner

workflow.call (#2044) links a child run to its parent through parent_run_id. A child's ending signals the parent, but cancelling the parent does nothing to a child that is still running or waiting, so the child carries on for a caller that no longer exists.

Done when: cancelling a run cancels its running and waiting children recursively, in the same transaction as the parent's cancellation, and a child that has already ended is left as it is.

`workflow.call` (#2044) links a child run to its parent through `parent_run_id`. A child's ending signals the parent, but cancelling the parent does nothing to a child that is still running or waiting, so the child carries on for a caller that no longer exists. Done when: cancelling a run cancels its running and waiting children recursively, in the same transaction as the parent's cancellation, and a child that has already ended is left as it is.
sam added the mediumbug labels 2026-11-21 04:02:15 +00:00
Author
Owner

Fixed in b6907d836. Store.Cancel takes its target rows from a recursive CTE over parent_run_id, limited to the call depth of 5, so cancelling a run cancels its descendants in the same transaction. Queued, waiting, parked and waiting_approval descendants end at once. A running descendant gets cancel_requested and its worker ends it at the next step, the same as a held parent. Descendants that have already ended are left alone. Only the named run signals its own caller. signalParent no longer writes a signal into a parent that has already ended, so a child finishing late can't wake or change a cancelled parent.

Verified: task check passed on the merged tree. The SQL has not been run against a database; there is no test, because DB-backed tests are banned and the cascade has no domain-level logic to fake.

Fixed in b6907d836. `Store.Cancel` takes its target rows from a recursive CTE over `parent_run_id`, limited to the call depth of 5, so cancelling a run cancels its descendants in the same transaction. Queued, waiting, parked and waiting_approval descendants end at once. A running descendant gets `cancel_requested` and its worker ends it at the next step, the same as a held parent. Descendants that have already ended are left alone. Only the named run signals its own caller. `signalParent` no longer writes a signal into a parent that has already ended, so a child finishing late can't wake or change a cancelled parent. Verified: `task check` passed on the merged tree. The SQL has not been run against a database; there is no test, because DB-backed tests are banned and the cascade has no domain-level logic to fake.
sam closed this issue 2026-11-21 04:22:05 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#2086