Repository navigation
fix(#748): --chain successors branch from predecessor's committed work, not main - #752
Merged
admarble merged 5 commits intoJun 28, 2026
Conversation
… run (#748) On a fresh `--chain` run, `ensureWorktreesChain` provisions every worktree up-front, branching each successor from its predecessor's branch name. At provisioning time that branch still points at the base (the predecessor hasn't executed yet), so every successor effectively branched from `main` and missed its predecessor's committed work — contradicting the `--chain` help text and the code's own AC comment. No execution-time rebase corrected it: the existing chain-rebase only fired on the re-run path, and `rebaseBeforePR` targets `origin/main`, not the predecessor. `executeSequential` now re-rebases each successor's worktree onto its predecessor's local committed tip just before the successor runs (independent of `--stacked`), via an extracted `rebaseOntoLocalBranch` helper that the re-run path now also reuses. On conflict it aborts + warns rather than silently greening a broken link. - Add real-git integration test asserting `git merge-base --is-ancestor <predecessor-exec-commit> <successor-HEAD>` on a fresh chain run (no mock of the rebase step), plus conflict-abort coverage. - Add orchestrator wiring tests proving each successor is rebased onto its predecessor's local branch (and not rebased when chain mode is off). - Update `--chain` help text to describe actual behavior. Entire-Checkpoint: 301696cea7c0
3 tasks
The #748 helper was inserted between rebaseBeforePR's JSDoc and its declaration, orphaning the doc block. Move rebaseOntoLocalBranch above rebaseBeforePR's JSDoc so each function's doc comment is adjacent again. No behavior change. Entire-Checkpoint: a9f3fce71038
…ccessor on wrong base (#748) QA second-look gaps: - On a chain rebase conflict/failure, executeSequential now warns loudly, records the failed link (abortReason), and breaks — stopping the conflicted successor and all later issues, rather than silently producing a successor built on the wrong base (the original #748 bug) whose break would propagate downstream. Consistent with predecessor exec/qa failure semantics. - A missing worktree-map entry is surfaced with a warning instead of being silently skipped. - Tests: wiring tests for the conflict-break and missing-predecessor paths (the orchestrator's failure branch was previously unexercised — the mock always returned success); integration test for the zero-commit predecessor no-op case. Entire-Checkpoint: 296109918a44
…-chain-successors-branch-from-main-not-pr # Conflicts: # CHANGELOG.md
…cument broken-link behavior (#748) - A missing worktree-map entry now breaks the chain identically to a rebase conflict (was: warn + continue) — both mean the successor cannot be chained, so the asymmetry is removed. Recorded with an abortReason and stops before the successor and later issues run. - Document the chain rebase mechanism and the broken-link stop behavior in docs/reference/run-command.md (Chain Mode), and update the CHANGELOG entry. - Tests: the missing-predecessor wiring test now asserts the chain breaks; pre-existing chain-mode tests gained realistic worktree maps (they relied on the now-removed non-fatal missing-entry path) via a makeChainWorktreeMap helper.
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
sequant run <a> <b> --chainrun, successors were branching frommaininstead of their predecessor's committed work.ensureWorktreesChainprovisions all worktrees up-front, branching each successor from the predecessor's branch name — but at that point the predecessor branch still points at the base (it hasn't executed yet), so every successor effectively branched frommain.executeSequentialnow re-rebases each chain successor's worktree onto its predecessor's local committed tip just before the successor runs — independent of--stacked, targetingfeature/<predecessor>(notorigin/main). Extracted arebaseOntoLocalBranchhelper from the existing chain-rebase block; the re-run path now reuses it too.abortReason) and stop before the conflicted successor (and any later issues) run, rather than silently producing a successor on the wrong base whose break would propagate downstream. A missing worktree-map entry is surfaced with a warning instead of being silently skipped.Acceptance Criteria
--chainrun: successor branch contains predecessor's committed workexecuteSequentialrebase step (run-orchestrator.ts); integration testgit merge-base --is-ancestor <pred-exec-commit> <succ-HEAD>on a fresh run, no mock of the rebase stepchain-rebase.integration.test.ts(3 real-git tests, incl. pre-fix BUG-state assertion + conflict-abort)bin/cli.ts--chainhelp text accurateKey files changed
src/lib/workflow/worktree-manager.ts— newrebaseOntoLocalBranchhelper (+LocalRebaseResult); existing chain-rebase block refactored to reuse it.src/lib/workflow/run-orchestrator.ts— rebase each chain successor (i>0) onto predecessor's local branch before execution.bin/cli.ts—--chainhelp text.src/lib/workflow/chain-rebase.integration.test.ts— real-git integration coverage (new).__tests__/run-orchestrator.test.ts— wiring tests + mock export.Test plan
npm run build— passesnpm run lint— passesnpx vitest run src/lib/workflow/chain-rebase.integration.test.ts— 3/3 passnpx vitest run __tests__/run-orchestrator.test.ts— 22/22 passphase-registry.integration.test.tstsx-spawn timeout flake; passes in isolation)Closes #748
Follow-up: second-look hardening
A QA second-look surfaced that the orchestrator's conflict branch was untested (the wiring mock always returned success) and that continuing on conflict left a contract-violating successor. Addressed in the follow-up commit:
IssueResultwithabortReason, which renders as the failure reason in the run summary and CI output.