Repository navigation
Conversation
Re-running `sequant run … --chain` after a mid-chain failure now skips the contiguous prefix of links that are already ready_for_merge/merged and resumes at the first incomplete link, rebased onto the last completed link's committed tip (reusing the #748 rebaseOntoLocalBranch path). The existing pre-flight state guard was chain-unaware: it dropped completed links before worktree provisioning, leaving the first incomplete link at index 0 where the #748 successor-rebase never fires, so it silently rebuilt on main (the #748 wrong-base bug). A new pure `computeChainResumePlan` (chain-resume.ts) peels the completed prefix, provisions the incomplete tail from the resume base, and executeSequential explicitly rebases the first active link onto that tip with fail-fast (a provisioning-time rebase failure only warns, so this is the authoritative correctness gate). - AC-1/AC-5: resume rebases first active link onto last completed link's tip; real-git integration test (3-link chain, force link 2 fail, re-run, assert link 1 skipped + link 2 branches from link 1's checkpoint via merge-base --is-ancestor). - AC-2: skipped links reported with issue number, reason, and resume commit. - AC-3: merged prefix resumes from the base branch (work is in origin/main); ready_for_merge link whose branch/checkpoint is destroyed fails fast with a clear message instead of wrong-basing the successor. Unit-tested via injected branch resolver. - AC-4: createCheckpointCommit failure is no longer verbose-gated — the commit step warns prominently and the call site records checkpointFailed on the IssueResult, since resume depends on the checkpoint. --force still bypasses resume entirely. Non-chain skip guard unchanged. Entire-Checkpoint: 815b3132b40c
This was referenced Jul 15, 2026
…-fast QA on PR #765 found the AC-4 checkpoint warning states the opposite of what happens, plus three smaller loose ends. All four addressed. 1. The warning claimed "chain resume from this link is unavailable" and "re-running the chain will redo #N". Neither was true: the status is written ready_for_merge *before* the checkpoint is attempted, so a re-run reads the link as a completed prefix, skips it, and takes its branch tip as the resume base. Since createCheckpointCommit only fails when it has in-scope dirty work it could not commit, that tip is missing exactly the work the checkpoint would have captured — and the user was told a re-run would handle it, so they'd do nothing. The message now states the real outcome (work is off-branch, the link stays ready_for_merge, resume will stop here until it is committed, or --force), and computeChainResumePlan no longer takes that on trust: a ready_for_merge resume base whose worktree is dirty now fails fast, symmetric with the existing destroyed-branch fail-fast, instead of rebasing the successor onto an incomplete tip. Only the resume base is checked — an earlier prefix link's dirt is irrelevant, since the chain rebases onto the last link's tip alone, and a merged prefix resumes from the base branch regardless. 2. checkpointFailed was set on IssueResult and read by nobody. It is now restated in the run summary, where the user is actually looking by the time a multi-hour chain ends and the per-issue warning has scrolled away. 3. The state→plan step had no coverage — there were no orchestrator tests at all, which is why the seam the original #748 bug lived in went untested. Extracted planChainResumeFromState so it is testable without standing up an orchestrator, and covered it, including the previously untested rule that a failed state lookup treats a link as incomplete rather than skipping it. 4. Documented the contiguous-prefix-only rule in the CHANGELOG: a completed link sitting after an incomplete one is re-executed, not silently dropped. Tests: 30 in the touched files (was 17); full suite 3777 passing; build and lint clean. Entire-Checkpoint: 030e1c082ab8
…me-a-partially-completed-chain-from-its-l # Conflicts: # CHANGELOG.md
admarble
added a commit
that referenced
this pull request
Sep 9, 2026
…-fast QA on PR #765 found the AC-4 checkpoint warning states the opposite of what happens, plus three smaller loose ends. All four addressed. 1. The warning claimed "chain resume from this link is unavailable" and "re-running the chain will redo #N". Neither was true: the status is written ready_for_merge *before* the checkpoint is attempted, so a re-run reads the link as a completed prefix, skips it, and takes its branch tip as the resume base. Since createCheckpointCommit only fails when it has in-scope dirty work it could not commit, that tip is missing exactly the work the checkpoint would have captured — and the user was told a re-run would handle it, so they'd do nothing. The message now states the real outcome (work is off-branch, the link stays ready_for_merge, resume will stop here until it is committed, or --force), and computeChainResumePlan no longer takes that on trust: a ready_for_merge resume base whose worktree is dirty now fails fast, symmetric with the existing destroyed-branch fail-fast, instead of rebasing the successor onto an incomplete tip. Only the resume base is checked — an earlier prefix link's dirt is irrelevant, since the chain rebases onto the last link's tip alone, and a merged prefix resumes from the base branch regardless. 2. checkpointFailed was set on IssueResult and read by nobody. It is now restated in the run summary, where the user is actually looking by the time a multi-hour chain ends and the per-issue warning has scrolled away. 3. The state→plan step had no coverage — there were no orchestrator tests at all, which is why the seam the original #748 bug lived in went untested. Extracted planChainResumeFromState so it is testable without standing up an orchestrator, and covered it, including the previously untested rule that a failed state lookup treats a link as incomplete rather than skipping it. 4. Documented the contiguous-prefix-only rule in the CHANGELOG: a completed link sitting after an incomplete one is re-executed, not silently dropped. Tests: 30 in the touched files (was 17); full suite 3777 passing; build and lint clean. Entire-Checkpoint: 030e1c082ab8
4 tasks
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.
Summary
Re-running
sequant run … --chainafter a mid-chain failure now skips the completed prefix and resumes at the first incomplete link, rebased onto the last completed link's committed tip — turning "chain dead, 1–3 hours wasted" into "re-run picks up where it broke" (the dominant chain failure class from the #604 forensics).main(the fix(chain): --chain successors branch from main, not predecessor's committed work (up-front worktree provisioning) #748 wrong-base bug). A new purecomputeChainResumePlan(chain-resume.ts) makes the skip chain-correct.executeSequentialexplicitly rebases the first active link onto the resume base with fail-fast (provisioning-time rebase only warns, so this is the authoritative correctness gate).createCheckpointCommitfailure is no longer verbose-gated — resume depends on it.AC Verification
chain-resume.ts+run-orchestrator.tsfirst-active-link rebase;chain-resume.integration.test.ts(merge-base --is-ancestor)run-orchestrator.tsskip +↻ Resuming chain at #N from <sha>linescomputeChainResumePlanmerged/fail-fast branches; unit + integration testscreateCheckpointCommitfailure loud, reflected in resultworktree-manager.ts+ call-site warning + run-summary notice +checkpointFailedonIssueResultchain-resume.integration.test.ts(#752 real-git pattern)QA follow-up (commit 2)
QA on this PR found the AC-4 warning stated the opposite of what happens, plus three smaller loose ends. All four are fixed in
33bd40e:Honest checkpoint warning + dirty-tip fail-fast. The status is written
ready_for_mergebefore the checkpoint is attempted, so a re-run reads the link as a completed prefix, skips it, and takes its branch tip as the resume base — the warning's claims that "resume is unavailable" and "a re-run will redo #N" were both false. SincecreateCheckpointCommitonly fails when it has in-scope dirty work it couldn't commit, that tip is missing exactly the work the checkpoint would have captured, and the user was told a re-run would handle it.The message now states the real outcome, and
computeChainResumePlanno longer takes the tip on trust: aready_for_mergeresume base whose worktree is dirty fails fast, symmetric with the existing destroyed-branch fail-fast. Only the resume base is checked — an earlier prefix link's dirt is irrelevant (the chain rebases onto the last link's tip alone), and a merged prefix resumes from the base branch regardless.checkpointFailedis now consumed. It was set onIssueResultand read by nobody; it's restated in the run summary, where the user is actually looking once the per-issue warning has scrolled away.The state→plan seam is now tested. There were no orchestrator tests at all — which is why the layer the original fix(chain): --chain successors branch from main, not predecessor's committed work (up-front worktree provisioning) #748 bug lived in went uncovered. Extracted
planChainResumeFromStateso it's testable without standing up an orchestrator, including the previously untested rule that a failed state lookup treats a link as incomplete rather than skipping it.Documented the contiguous-prefix-only rule: a completed link sitting after an incomplete one is re-executed, not silently dropped.
Design notes
--forcestill bypasses resume entirely (redo the whole chain) — resume logic sits inside the!mergedOptions.forcebranch. Non-chain skip guard unchanged.--forceis used. Deliberate — an incomplete resume base is the failure this issue exists to prevent, and the message names the file and the two ways out.Test plan
npm run build— cleannpm run lint— clean (0 warnings)npx vitest run— full suite: 185 files, 3777 passed, 1 expected fail, 2 skippedchain-resume.test.ts(16),chain-resume.integration.test.ts(6, real git),checkpoint.integration.test.tsAC-4 case,run-display.test.ts(3, new)Closes #760
🤖 Generated with Claude Code