Skip to content

feat(#1136): explicit in-place checkout mode for exec, qa, loop and testgen - #1139

Merged
admarble merged 4 commits into
mainfrom
feature/1136-feat-exec-qa-explicit-in-place-checkout-mode-
Sep 24, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/1136-feat-exec-qa-explicit-in-place-checkout-mode-

Conversation

@admarble

@admarble admarble commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds an explicit in-place checkout mode. With SEQUANT_CHECKOUT=in-place, /exec works on feature/<N>-<slug> in the current clone, and /qa, /loop and /testgen treat $PWD as the worktree. This is the mode a claude.ai cloud session needs: a fresh clone with no ../worktrees/ and no sequant binary. feat(drivers): claude-cloud AgentDriver — run a phase as a claude.ai cloud session instead of a nested local CLI #1137's claude-cloud driver consumes it.
  • Opt-in only, never inferred. Every mention of the flag sits inside a delimited in-place-checkout… region. With the flag unset, each entry block is a no-op. The skill diff is purely additive (0 deleted lines), and every bug(fullsolve/exec): the worktree is never created and never verified — skill-driven runs execute in the main checkout, or in another repo's worktree #899 worktree-* region hashes identically to origin/main in all 3 roots × 4 skills.
  • /exec names the branch the way sequant run does. It uses worktree-manager.ts's slugify, which cuts the slug at 50 characters and is now exported @internal so the gate asserts parity. A later local sequant run phase therefore reuses a pushed cloud branch instead of forking a second one. QA's corpus check caught the first version, which copied new-feature.sh's 58-character branch cut and differed on 10 of 10 recent branches. It now matches 10 of 10. It halts if it cannot read the issue title rather than create an empty-slug branch. It skips the dev-server smoke test unless SEQUANT_SMOKE=1, never invokes /test, and turns parallel-group isolation off because isolation runs git worktree add.
  • /qa, /loop and /testgen halt unconditionally on the base branch or a detached HEAD. qa's Phase 0 status check also skips its worktree resolve call.
  • In every skill, an unrecognized SEQUANT_CHECKOUT value halts. So does SEQUANT_CHECKOUT=in-place together with SEQUANT_WORKTREE, because the two modes are mutually exclusive.
  • Dogfood finding, fixed here. The first real cloud session (cse_01W6MSXo6CpVP1WmyNMwxWVz, Sonnet 5) confirmed SEQUANT_CHECKOUT=in-place reaches the sandbox and git worktree list shows one entry, then halted inside the entry block with gh: command not found: cloud sandboxes have no gh. The title is now an <issue-title> placeholder the agent fills from gh or the GitHub MCP issue_read tool, the block never names gh, and the gate's gh shim fails like a missing binary.
  • New reference page docs/reference/checkout-modes.md with the three-mode table. It is linked from docs/README.md and has a CHANGELOG entry.

Acceptance criteria

Mutation verification

Each mutation was applied to templates/skills (or the docs page) on a clean tree at the last commit. The run failed exactly the one listed test (36/37 pass), then git checkout restored the file.

AC Mutation Failed test
AC-1 deleted git checkout -b "$BRANCH" "origin/$BASE" from the exec region exec > creates feature/<N>-<slug> …
AC-1 deleted the "Never run new-feature.sh / git worktree add / worktree resolve" bullet exec > never invokes …
AC-2 deleted the base-branch halt from the qa region qa > treats $PWD as the worktree and halts on the base branch
AC-3 deleted the BEGIN/END markers of exec's parallel-isolation skip region never inferred > every mention of the flag sits inside …
AC-3 replaced qa's flag-unset guard with if true never inferred > is a no-op with the flag unset …
AC-1 restored the old new-feature.sh rule (cut -c1-58 on the whole branch) after the slug fix exec > creates feature/<N>-<slug> …
AC-1 restored the gh issue view title fetch in place of the <issue-title> placeholder exec > creates feature/<N>-<slug> …
AC-5 deleted the in-place row of the docs table checkout modes reference page (AC-5) > lists the three modes …

Mutation-verified: AC-1 — deleted the git checkout -b line from the exec in-place region; creates feature/- test failed; restored.
Mutation-verified: AC-2 — deleted the qa base-branch halt; treats $PWD as the worktree test failed; restored.
Mutation-verified: AC-3 — deleted the parallel-isolation skip region delimiters; containment test failed; restored.
Mutation-verified: AC-5 — deleted the in-place row of the docs table; reference page test failed; restored.

Checks

Test Files  337 passed (337)
     Tests  8376 passed | 1 expected fail | 3 skipped (8380)
  • npm run lint, lint:skill-sync, lint:skill-calls, lint:skill-gates: all exit 0.
  • Tautology detector: WARN, 5/11 blocks (45.5%), non-blocking, exit 0. The five are pure text gates: smoke-skip placement, skip-site ordering, the qa status-check marker, the "never inferred" wording, and the docs table. No production function exists behind them. An earlier revision with only text assertions was 9/9 tautological and failed tautology-detector-cli.test.ts in the full suite. That failure is why the behavioural runs exist.

Notes for review

  • sequant run spreads process.env into every phase and sets SEQUANT_WORKTREE. A user who exports SEQUANT_CHECKOUT in their shell therefore gets a loud mutual-exclusion halt in every phase. That fails safe and is documented. Stripping the var in phase-executor.ts would be a production change outside this issue's scope.
  • No hook change, per the issue. The pre-tool.sh commit guard already allows commits on a non-base branch in the main checkout (bug(codex): workspace-write disables network, so every phase runs offline — no gh, no comments, no push #1079).

Closes #1136

🤖 Generated with Claude Code

…estgen

SEQUANT_CHECKOUT=in-place runs a phase on a feature branch in the current clone. exec creates feature/<N>-<slug> from origin/<base>; qa, loop and testgen treat $PWD as the worktree and halt on the base branch. Opt-in only; every mention of the flag sits in a delimited region, and the #899 guards are unchanged. Gate tests, a checkout-modes reference page and a CHANGELOG entry.
The gate tests now run each skill's in-place bash block against a fresh clone and judge the result with the real resolver and verifier (listWorktrees, resolveIssueWorktree, verifyWorktreePath), and sweep every mirrored file via collectFiles. exec halts when it cannot read the issue title instead of creating an empty-slug branch. Docs note the sequant run env pass-through.
QA's corpus check found 10/10 recent sequant-run branches differ from the in-place rule copied from new-feature.sh (branch cut at 58). sequant run's slugify cuts the slug at 50 and looks branches up by exact name, so a long-titled cloud branch would be forked, not reused. The block now cuts the slug at 50 (10/10 match). slugify is exported @internal and the gate asserts parity with it using a title whose slug exceeds 50.
…er, never calls gh

The first dogfood session (cse_01W6MSXo6CpVP1WmyNMwxWVz) halted inside the exec in-place block with 'gh: command not found': claude.ai cloud sandboxes have no gh CLI. The title is now an <issue-title> placeholder the agent fills from gh or the GitHub MCP issue_read tool, so the block runs the same way in both places. The gate's gh shim now fails like a missing binary and the test asserts the block never names gh.
@admarble
admarble merged commit 6fa3d00 into main Sep 24, 2026
10 checks passed
@admarble
admarble deleted the feature/1136-feat-exec-qa-explicit-in-place-checkout-mode- branch September 24, 2026 17:16
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.

feat(exec/qa): explicit in-place checkout mode — run a phase on a branch in the current clone without creating or resolving a worktree

1 participant