Skip to content

fix(#1460): phase agents never get SEQUANT_BASE_BRANCH — skills fall back to main on master-default repos - #1483

Merged
admarble merged 5 commits into
mainfrom
feature/1460-fix-run-phase-agents-never-get-sequant-base-branch
Oct 17, 2026
Merged

admarble merged 5 commits into
mainfrom
feature/1460-fix-run-phase-agents-never-get-sequant-base-branch

Conversation

@admarble

@admarble admarble commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase agents now get SEQUANT_BASE_BRANCH: the base branch name without origin/, taken from resolveBaseRef(cwd), set in executePhase's env block for every phase. That includes spec, which runs in the main checkout with nothing recorded. resolveBaseRef's literal "origin/main" fallback (no recorded base, detached HEAD, or a git error) is now origin/<default branch of cwd>, through detectDefaultBranch(false, cwd). detectDefaultBranch gained an optional cwd that defaults to process.cwd(), so existing callers don't change. Skills that read ${SEQUANT_BASE_BRANCH:-main} stop guessing main on a master-default repo. The skills that read it are #1461, frozen until the plugin freeze lifts.

Runner fix after QA (519fa7e): the zero-diff guard's doc comment no longer says the base "defaults to origin/main".

Fixes #1460

Acceptance criteria

AC Status Evidence
AC-1 Met phase-executor.base-branch.integration.test.ts › phase env carries SEQUANT_BASE_BRANCH: a worktree phase with a recorded origin/master gets master, and a no-worktree spec phase on a repo whose origin/HEAD is master gets master. Mutation recorded below
AC-2 Met phase-executor.test.ts › resolveBaseRef falls back to origin/ of cwd. The integration tests cover a master-default repo with no recorded base and a detached HEAD. Mutation recorded below
AC-3 Met grep -n SEQUANT_BASE_BRANCH docs/reference/run-command.md finds line 660, a row in the phase env table

Runner check: npx vitest run over phase-executor.base-branch.integration.test.ts, phase-executor.test.ts, phase-pause-handle.test.ts, ready-gate-run.test.ts and worktree-manager.test.ts gives 292/292 passed.

Mutation verification

Mutation-verified: AC-1 — deleted the env.SEQUANT_BASE_BRANCH assignment in executePhase; phase-executor.base-branch.integration.test.ts > phase env carries SEQUANT_BASE_BRANCH (#1460 AC-1) > spec phase: no worktree, nothing recorded, origin/HEAD is master — yields master failed, along with the worktree-phase case (2 failed, 205 passed); restored.

Mutation-verified: AC-2 — restored the literal origin/main fallback in resolveBaseRef; phase-executor.test.ts > resolveBaseRef > falls back to origin/<default branch> of cwd when nothing is recorded (#1460) failed, along with both AC-2 integration cases and the spec-phase AC-1 case (4 failed, 203 passed); restored.

Follow-ups

QA verdict: AC_MET_BUT_NOT_A_PLUS. The fix-now gaps (mutation records, stale comment) are closed above.


🤖 Generated by sequant run; body rewritten by the graph runner.

resolveBaseRef falls back to origin/<default branch of cwd> instead of a literal origin/main; detectDefaultBranch takes an optional cwd.

Entire-Checkpoint: fa884d44fbda
…Ref's fallback now reaches them

Entire-Checkpoint: 32d78970d24b
@admarble
admarble merged commit de03af8 into main Oct 17, 2026
8 checks passed
@admarble
admarble deleted the feature/1460-fix-run-phase-agents-never-get-sequant-base-branch branch October 17, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(run): phase agents never get SEQUANT_BASE_BRANCH — skills fall back to main on master-default repos

1 participant