Repository navigation
Description
Tier: judgment
Problem
The exec zero-diff/uncommitted guard (classifyExecChanges, phase-executor.ts) compares resolveBaseRef(cwd)..HEAD. resolveBaseRef reads branch.<branch>.sequantBase and falls back to origin/main. That config key is written only by the legacy templates/scripts/new-feature.sh:203. The TypeScript worktree path sequant run uses (worktree-manager.ts) never writes it:
grep -rn sequantBase src --include='*.ts' | grep -v test # reader only, no writer
So for every sequant run worktree, the guard compares against origin/main, whatever --base says. When the base branch is ahead of main, the base's own commits count as "commits ahead", and the guard returns commits. The none (no work) and uncommitted (#879 fail + #1032 WIP rescue) branches never fire.
Observed 2026-09-30 in the #1138 Phase 0 bench. Each run used --base bench-arm, a local branch one commit ahead of main. In 3 of 18 runs, exec backgrounded the test suite, waited for a notification, and ended with all its work uncommitted. That's the #1032 stranding mode; the fixture skills predate #1032. The guard should have failed the phase and committed the files as WIP. Instead exec reported success, the files stayed uncommitted, and qa reviewed the dirty tree and returned READY_FOR_MERGE twice and AC_MET_BUT_NOT_A_PLUS once.
Expected by the same mechanism, not reproduced: chain mode bases each successor on its predecessor's branch, so a successor exec that commits nothing sees the predecessor's commits and passes.
Secondary, same flag: the post-phase rebase in worktree-manager.ts always fetches and rebases onto origin/<base>. For a local --base it prints Could not fetch origin/bench-arm … Rebase failed: invalid upstream 'origin/bench-arm' after every phase. It's harmless but noisy.
Acceptance criteria
- AC-1: Worktrees created by
sequant runrecord the exact base ref the worktree was cut from (thebaseRefstringworktree-manager.tscomputes:origin/main,origin/x, or a localfeature/x) underbranch.<branch>.sequantBaseRef. Evidence:npx vitest run src/lib/workflow/worktree-manager.test.tsasserts the recorded value for no--base,--base origin/xand a local--base feature/x - AC-2:
resolveBaseRefusessequantBaseRefverbatim when it resolves (git rev-parse --verify). Otherwise it keeps today's behavior: legacysequantBase(written bynew-feature.sh) getsorigin/prepended, and with neither key it falls back toorigin/main. A local branch is never inferred from a bare name, so a stale localmainis never used. Evidence:npx vitest run src/lib/workflow/phase-executor.test.ts - AC-3: An exec that leaves only uncommitted work on a worktree whose base is a branch ahead of main fails the phase and WIP-commits the paths (fix(exec): phase agent that backgrounds the test suite and waits for a notification strands uncommitted work — block Monitor/run_in_background under the orchestrator, WIP-commit on the no-commit guard #1032). Evidence:
npx vitest run src/lib/workflow/phase-executor.test.tswith a temp repo whose base branch is one commit ahead of main - AC-4: The post-phase rebase uses the local base ref when
--basenames a local branch, and prints no fetch or rebase warning. Evidence:npx vitest run src/lib/workflow/worktree-manager.test.ts
Non-goals
- Changing qa to refuse a dirty tree. With the guard working, exec fails before qa runs. File that separately if it's still wanted.
Relates to #537, #879, #1032, #1138.
AC-1/AC-2 revised 2026-09-30 before implementation: the original AC-2 ("return a local branch unchanged when one exists") would have compared against a stale local
mainin most checkouts. The exact ref is now recorded under a new key and read verbatim, and the legacy key keeps its meaning.
Activity
fix(#1234): pre-PR rebase falls back to a local base only when origin…
fix(#1406): a non-default bare --base is cut from local <base> but co…