Skip to content

fix(#1386): --base creates the worktree from the branch but opens the PR against the repo default branch - #1394

Merged
admarble merged 4 commits into
mainfrom
feature/1386-fix-run-base-creates-the-worktree-from-the-branch-
Oct 10, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/1386-fix-run-base-creates-the-worktree-from-the-branch-

Conversation

@admarble

@admarble admarble commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

sequant run <N> --base <branch> built the worktree from <branch> and rebased onto it, but opened the PR against the repo's default branch. createPR only got a base under --stacked (stackOptions.prBase).

Now the run's one resolved base (ResolvedRun.baseBranch, from --base, then settings.run.defaultBase, then the detected default) reaches createPR. That is the same value worktree creation and rebaseBeforePR already used. resolvePrBase in worktree-manager.ts picks the PR target:

  • the --stacked predecessor if there is one;
  • else the run's base, minus any origin/ prefix, when it isn't the repo default;
  • else nothing, so gh keeps the repo default as before.

It adds no second resolver (graph doc D-2). The create path and the update-existing-PR path (#1247) use the same value.

Fixes #1386

Acceptance criteria

  • AC-1: --base without --stacked opens the PR with base: <branch>, and worktree creation, rebaseBeforePR and createPR all get one value. Covered by batch-executor.test.ts › #1386 AC-1: rebaseBeforePR and createPR receive the run's one resolved base, run-base-parity.integration.test.ts › AC-1, and the resolvePrBase cases in worktree-manager.test.ts.
  • AC-2: settings.run.defaultBase behaves like --base. Covered by run-base-parity.integration.test.ts › AC-2.
  • AC-3: with neither set, the PR base is unchanged. Covered by batch-executor.test.ts › #1386 AC-3, run-base-parity › AC-3, and resolvePrBase returning undefined for the default.
  • AC-4: --stacked still targets the predecessor and wins over --base. The existing feat(cli): --stacked flag — set chain-mode PR base to predecessor branch #605 tests pass, and resolvePrBase checks stackPrBase first.

Mutation-verified: AC-1 — removed baseBranch from the createPR options in runIssueWithLogging (batch-executor.ts); batch-executor.test.ts > #1386 AC-1: rebaseBeforePR and createPR receive the run's one resolved base failed (1 of 210 across the three affected files); restored.

Runner verification (graph-2026-10-freeze)

  • QA verdict: AC_MET_BUT_NOT_A_PLUS (4/4). The runner fixed both QA gaps:
    • Mutation record: run and recorded above.
    • Stale comment: batch-executor.ts said "Last PR keeps main". Fixed in e19cdbea, since under --base the last stacked PR now targets the run's base.
  • Ran batch-executor.test.ts, run-base-parity.integration.test.ts and worktree-manager.test.ts: 210 passed.
  • Plugin freeze (I-1): git diff --name-only origin/main...HEAD | grep -E '^(plugin|\.claude/skills|templates/skills)/' is empty.
  • Serialized before ensureWorktree "recreating fresh" rebuilds a PR branch from base and drops its commits; qa re-run reviews the wrong tree #1380 (same file, ensureWorktree; graph doc D-5).

🤖 Generated with Claude Code

Entire-Checkpoint: 007e4b4eef8e
Entire-Checkpoint: 750054fd873f
Entire-Checkpoint: 3b711153e46a
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): --base creates the worktree from the branch but opens the PR against the repo default branch

1 participant