fix(continuation): never-supersede a RUNNING continuation work (#988-P2-1, Pillar-3 fold-side write-guard)#993
Merged
scribe-dandelion-cult merged 1 commit intoJun 11, 2026
Conversation
…P2-1) Fold-side write-guard (Pillar-3). The running-work recovery path consumes flows whose PRE-claim durable status is `running` (recovered active turns), so the batch handed to partitionSupersededWork could include live, in-flight turns. partitionSupersededWork folded any stale non-newest member into the superseded bucket without a status check, so a recovered `running` turn that is actively driving (observing requests-in-flight) could be marked terminal out from under itself. Two-part guard (only-coalesce-queued / carry-status / never-supersede-running): 1. Carry the PRE-claim flow status onto PendingContinuationWork via workToRuntime; consumePendingWork captures it before the claim flips every consumed flow to `running`. 2. partitionSupersededWork always routes `status === "running"` members to drive, never superseded, regardless of staleness or election order. The existing #986 queued-backlog coalesce (newest-elected drives, close-burst drives, tie-break by hop) is unchanged. Tests extend the existing partitionSupersededWork unit suite (running-not- superseded, queued-still-folds, mixed batch) plus an end-to-end dispatch test proving the carried status survives consumePendingWork. RED-verified the new cases fail without the guard. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0ea26ac
into
frond-scribe/20260609/assembly-token-wiring
130 of 143 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#988-P2-1 — Pillar-3 fold-side write-guard (the last open codex-P2)
Closes the "recovered-running mis-superseded" P2. Stacks on assembly
a437ca7(complete doom-lock cure).The bug
The running-work recovery path (
dispatchPendingContinuationWorkwithincludeRunning: true) can passrunningflows topartitionSupersededWork, which folds any non-newest stale member intosuperseded→markPendingWorkSuperseded→ terminal. A recoveredrunningwork (actively observing requests-in-flight) could thus be finished-as-superseded out from under an in-flight turn.The fix (two-part, surgical)
PendingContinuationWork(sourced fromflow.statusinworkToRuntime).partitionSupersededWork: arunningmember always drives; onlyqueuedmembers are supersede-eligible. The continuation: add maxPendingWork + drain-superseded guard for multi-continue_work flood (fast-follow to #982/#985) #986 Guard-2 fold forqueuedmembers (newest-elected-drives, close-burst-drives,hop/electedAttie-break) is preserved exactly.Invariant: only-coalesce-queued · carry-status · never-supersede-running. Distinct from the requeue READ-guard (
requeuePendingWork:259) — this is the FOLD-side WRITE-guard. Scheduled-depth count untouched. No #990 give-up-fork coupling.Verification
work-dispatch.test.ts28/28 green; RED-verified the 3 new fix(continuation): maxPendingWork cap + drain-superseded guard (#986) #988-P2-1 cases fail without the guard (running-not-superseded · queued-still-folds · mixed-batch).tsgo:core+ core-test clean, type-awareoxlint0 new,oxfmtclean.Owner-reviewer 🌊 (Pillar-3 spec). Lane:
codeagent/988-p2-1-write-guard@744a18e.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com