Repository navigation
Closed
Description
Tier: judgment Found: 2026-09-30, root-cause investigation of #1244 and #1246 (tracker #1236, closed). Supersedes #1244; #1246 is blocked by this.
Problem: sequant run has two PR producers
- The exec skill opens the PR itself. "PR Creation and Verification" (
.claude/skills/exec/SKILL.md:979-1030) runsgit push -u originthengh pr createunconditionally, withBash(gh pr create:*)allowlisted (:37). The orchestrated-mode rules (:173-179) skip pre-flight checks and worktree creation and reduce comments, but none of them skips the PR. The feat(exec/qa): explicit in-place checkout mode — run a phase on a branch in the current clone without creating or resolving a worktree #1136 in-place section says PR creation is "unchanged" (:262-265). The promptsequant runsends exec says nothing about PRs (src/lib/workflow/phase-registry.ts:221-222). - The orchestrator opens it after QA.
createPR(src/lib/workflow/worktree-manager.ts) is called frombatch-executor.ts:2334-2388with a body built bybuildAutomatedPRBody. But if a PR already exists for the branch,createPRreturns it untouched (worktree-manager.ts:2096-2112). That early return dates from 2026-03-11 (refactor(run): split 3,459-line monolith into focused modules #318's split), before fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 (2026-07-14) and feat(run): --ready-gate — run the post-QA ready gate insidesequant run(automates the any-gaps/fix-gaps second look, stops at human merge) #817 (2026-07-28).
Consequences (from the original bodies via userContentEdits, and the 2026-09-30 run logs):
- When exec opened the PR (PRs fix(#1217): uv ciInstall uses uv sync --frozen with uv.lock, else requirements or skip #1224, feat(#1199): configurable worktree root #1226, fix(#1228): pre-tool.sh reset --hard guard evaluates the directory the reset targets #1237, fix(#1222): a watchdog-killed run writes no run log and half-deletes a clean worktree #1238 and fix(#1223): sequant run PR titles reuse the issue's own type, and the body carries exec's summary #1240, each created before qa started), everything sequant builds for the body is dropped: the non-A+ QA note (fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749), the ready-gate report (feat(run): --ready-gate — run the post-QA ready gate inside
sequant run(automates the any-gaps/fix-gaps second look, stops at human merge) #817), exec's summary (fix(pr): sequant run PRs double the conventional prefix in the title and ship a placeholder body #1223), the stack manifest and the--stackedprBase. fix(#1223): sequant run PR titles reuse the issue's own type, and the body carries exec's summary #1240 ran with AC_MET_BUT_NOT_A_PLUS, and its body has no QA note. - When exec didn't open it (fix(#1195): sequant://install recomputes on every read and reports a broken manifest as {error} #1225, fix(#1233): a successful run without qa leaves the issue in_progress, not ready_for_merge #1239: exec → qa AC_NOT_MET → a later qa-only run), sequant opened the PR from a run whose
phaseResultshas no exec entry, so the body is the placeholder "Automated PR for issue #N." whatever exec printed. feat(exec): under the orchestrator, end the final output with a ## Summary so PR bodies aren't placeholders #1244's skill-text lever can't reach this case. --no-pronly gates the orchestrator's producer (batch-executor.ts:2334). The exec agent never sees it, so exec can still open a PR under--no-pr.- Gating PR creation on "qa ran" (decision(run): a sequant run where no qa ran still ends with a PR — draft+note, require qa, or unchanged (blocked by #1247) #1246) only works for runs where exec happened not to open one.
QA does not need a PR to exist. It reads CI status only when a PR exists (qa/SKILL.md:907-916) and skips that section otherwise (:1067). So making the orchestrator the only producer doesn't break QA; it only defers gh pr checks until the PR exists.
AC
- AC-1: When
SEQUANT_ORCHESTRATORis set, the exec skill commits and pushes but opens no PR by any means: nogh pr create, and no GitHub MCP pull-request tool in in-place mode (feat(exec/qa): explicit in-place checkout mode — run a phase on a branch in the current clone without creating or resolving a worktree #1136). The skip sits at the### PR Creation and Verificationheader, in the same**Skip this section if SEQUANT_ORCHESTRATOR is set**form used at:271/:291. The in-place bullet that now says PR creation is "unchanged" (:262-265) is reworded to match. The text is identical in.claude/skills/exec/SKILL.md,skills/exec/SKILL.mdandtemplates/skills/exec/SKILL.md. Standalone/execkeeps creating the PR. Evidence:npx vitest run src/lib/__tests__/exec-orchestrated-no-pr-skill.test.ts, a gate test scoped to the PR Creation section and the in-place block of each copy - AC-2: When a PR already exists for the branch,
createPRupdates it instead of returning early. That covers both early returns: the Step 1 check (worktree-manager.ts:2098-2112) and the "already exists" race fallback (:2163-2173). The update sets the bodybuildAutomatedPRBodywould have produced (QA note, ready-gate report, exec summary, closing line), the titlebuildPRTitlewould have produced, andprBasewhen--stackedset one. The update goes through a GitHubProvider method that usesgh api -X PATCH(notgh pr edit, which fails on the projectCards deprecation). Overwrite decision (spec): title and body are overwritten only when the existing body is empty or carries the automated trailer (🤖 Generated bysequant run``); otherwise they are left alone,PR #N body was edited by hand; not overwrittenis logged, and `base` is still set under `--stacked`. Evidence: `npx vitest run src/lib/workflow/worktree-manager.test.ts` - AC-3: Exec's summary is saved where a later qa-only run can read it (for example, the last exec summary recorded on the issue's state, or on the branch as a structured marker), and
buildAutomatedPRBodyuses it when the current run has no exec result. The fix(#1195): sequant://install recomputes on every read and reports a broken manifest as {error} #1225/fix(#1233): a successful run without qa leaves the issue in_progress, not ready_for_merge #1239 shape (exec → qa AC_NOT_MET → qa-only run opens the PR) gets exec's summary, not the placeholder. Evidence:npx vitest run src/lib/workflow/batch-executor.test.ts - AC-4:
--no-prmeans no PR from either producer: under the orchestrator withnoPr, nothing runsgh pr create. Evidence:npx vitest run src/lib/workflow/batch-executor.test.tsplus the AC-1 gate test - AC-5: (Owner decision, 2026-10-01: option B.) Under the orchestrator,
batch-executorcallscreatePRright after each successful exec pass, when the branch has commits ahead of base and--no-pris unset. A PR carrying exec's## Summary, its AC table and itsSEQUANT_MUTATIONmarkers therefore exists while qa runs, and QA's PR-body reads (§6i, the precheck AC literal-diff, §2a, test-plan boxes) keep working. The post-QA call goes through the AC-2 update path and adds the QA note and ready-gate report. A failed after-exec call logs a warning and does not fail the run; the post-QA call stays fatal (fix(run): exec that leaves work uncommitted reports success and the run passes with no PR — #534's empty-branch escape, reopened via a new route #879). The after-exec PR opens non-draft, the same as exec-opened PRs today. Draft-vs-ready policy stays with decision(run): a sequant run where no qa ran still ends with a PR — draft+note, require qa, or unchanged (blocked by #1247) #1246. Evidence:npx vitest run src/lib/workflow/batch-executor.test.ts
Non-goals
- The policy for PRs from runs where no qa ran is decision(run): a sequant run where no qa ran still ends with a PR — draft+note, require qa, or unchanged (blocked by #1247) #1246's decision, made once this lands.
- Standalone
/execbehaviour.
Graph metadata
- No dependency edges.
May touch
.claude/skills/exec/SKILL.md,skills/exec/SKILL.md,templates/skills/exec/SKILL.mdsrc/lib/workflow/worktree-manager.ts,src/lib/workflow/worktree-manager.test.ts,src/lib/workflow/worktree-manager.build-pr-body.test.tssrc/lib/workflow/batch-executor.ts,src/lib/workflow/batch-executor.test.tssrc/lib/workflow/platforms/github.ts(a PR-body update call, if needed)src/lib/workflow/state-manager.ts/state-schema.ts(if the exec summary is saved in state)src/lib/__tests__/exec-orchestrated-no-pr-skill.test.ts(new)
Activity
admarble commentedon Oct 1, 2026
Runner context (re-checked against main @ 5e8f0aa)
AC-1 and AC-2 were rewritten before launch to cover producers the original body missed. QA verifies the AC lines as they now read.
Line refs (current):
.claude/skills/exec/SKILL.md: allowlist:37; orchestrated-mode rules:173-179; in-place (feat(exec/qa): explicit in-place checkout mode — run a phase on a branch in the current clone without creating or resolving a worktree #1136) block:240-268(MCP pull-request tool:246, "PR creation… unchanged":262-265); section-skip convention:271,:291;### PR Creation and Verification:979,gh pr create:1007,:1049. The other two copies have the same line numbers..agents/skillsis a tracked symlink, not a fourth copy.src/lib/workflow/worktree-manager.ts:buildPRTitle:1878;extractExecSummary~:1908;buildAutomatedPRBody:2002;createPR:2082. First early return:2098-2112, title built only on create:2143, race-fallback early return:2163-2173.src/lib/workflow/batch-executor.ts: the PR block starts at:2327(wouldCreatePR:2334,#920skip:2346), withqaVerdictat ~:2362,execOutputat ~:2367andcreatePR(at:2371. fix(run): status, PR-body QA note and MCP result use the first qa verdict — a looped AC_NOT_MET→NEEDS_VERIFICATION records ready_for_merge #1245 edits theqaVerdictline next and runs after this.src/lib/workflow/platforms/github.ts: has no PR-update method today (createPR:911).src/lib/workflow/phase-registry.ts:221-222: the exec prompt says nothing about PRs.Prior fixes / producers
--stackedbase), fix(chain): --chain successors branch from main, not predecessor's committed work (up-front worktree provisioning) #748, fix(#879): fail exec on uncommitted-only work and make PR-creation failure fatal #889 (PR failure is fatal), fix(run): phase-restricted runs without an implementing phase must skip PR creation — spec-only batches always report failed #920 (skip with no commits), feat(#1197): opt out of closing keywords — Refs #N for issues a PR should not close #1215 (closing-keyword mode), fix(#1223): sequant run PR titles reuse the issue's own type, and the body carries exec's summary #1240 (title and exec summary). That is a class, not a one-off. The owner iscreatePRas the single producer of the PR under the orchestrator, which is what this issue already frames. Don't add a third path or a second update site.gh pr createand the PR tool):gh pr create(:1007/:1049). AC-1 covers it.:246). AC-1 covers it now.createPRcreate path. AC-2 covers it.createPR's two early returns. AC-2 covers both now.SEQUANT_ORCHESTRATOR:fullsolve/SKILL.md:784,merger/SKILL.md:377,release/SKILL.md:542.hooks/post-tool.sh:224only logs.state-schema.ts, stop and surface it.Implementation traps (each has bitten this repo)
ghcall shifts ordered mocks.worktree-manager.test.ts/batch-executor.test.tsqueuechild_processresults in order (bug(exec): sequant run worktrees never record sequantBase, so the zero-diff/uncommitted guard compares against origin/main and a --base ahead of main disables it #1234: 19 failures from one added git call). Fix the queues; don't stub around them.gh api -X PATCH repos/<o>/<r>/pulls/<n>with the body from a file.gh pr edit --bodyfails on the projectCards GraphQL deprecation.### PR Creation and Verificationsection and the in-place block of each copy, not the whole file.--no-prmust reach the exec agent too. Today onlybatch-executor.ts:2334reads it. Thread it through whatever env or prompt the exec phase gets (for example, aSEQUANT_*var), so both producers honour it.Standard block
npm testin exec or in QA. This applies to the qa phase too: the 30-minute MCP wall kills the phase. Run only the test files named in the ACs plusgrep -rlE 'createPR|buildAutomatedPRBody|viewPRByBranchSync|PR Creation and Verification' --include='*.test.ts' src __tests__ scripts | xargs npx vitest run(zsh: don't rely on$filesword-splitting).failedTestmust start with the test file path:src/lib/__tests__/exec-orchestrated-no-pr-skill.test.ts > … > ….Closes #1247. UseRefsonly for any tracker. Never write a closing keyword next to another real issue number, even as an example; write#<n>.admarble commentedon Oct 1, 2026
Complexity: Standard (4 ACs, 4 directories)
AC Quality Check
batch-executor.test.tsalready hasnoPr: truecases at:2183/:2294), so the citations gate nothing on their own. Exec must add new named cases that fail onmain(listed below).SEQUANT_MUTATIONrecord whosefailedTeststarts with the test file path.Scope Assessment
Non-Goals: present (#1246's policy, standalone
/exec).src/lib/workflow,platforms/,__tests__Verdict: ✅ SCOPE_OK. The spread is mechanical: three mirrored skill copies.
Acceptance Criteria
AC-1: Exec opens no PR under
SEQUANT_ORCHESTRATORVerification: Unit Test (a gate test that reads each SKILL.md copy and slices the section)
Scenario: Given any of the 3 copies → When the test slices
### PR Creation and Verificationup to the next###, plus thein-place-checkout (#1136)block → Then the section opens with**Skip this section if \SEQUANT_ORCHESTRATOR` is set**, and the in-place block no longer lists "PR creation" as unchanged. **Assumptions:** Every orchestrator that sets the var opens the PR itself. Verified forsequant run(phase-executor.ts:1696, and the MCP server'srun.ts:801goes through it) and for/fullsolve(SEQUANT_ORCHESTRATOR=fullsolve`, which opens the PR at §5.1 "Create PR (if not exists)"). Both still produce a PR.AC-2:
createPRupdates an existing PRVerification: Unit Test (
worktree-manager.test.ts)Scenario: Given
viewPRByBranchSyncreturns PR #N → WhencreatePRruns → Then it pushes the branch, then callsgithub.updatePRSync(N, {title, body, base?}), and returns{success, prNumber: N}. The same happens on thealready existsrace path.Overwrite decision (write this into the AC line): title and body are overwritten only when the existing body carries the automated trailer (
🤖 Generated by \sequant run`) **or is empty**. Otherwise sequant leaves the title and body alone, logsPR #N body was edited by hand; not overwritten, and still updatesbaseunder--stacked. Rationale: under AC-1 every PR sequant meets on an orchestrated branch is its own, so an edited body means a human edited it. The leftover exec-made PRs (#1237-style, with theGenerated with [Claude Code]` trailer) are a one-time migration and not worth clobbering human edits for.AC-3: Exec summary persists for a later qa-only run
Verification: Unit Test (
batch-executor.test.ts, plus a state-manager round-trip)Scenario: Given run 1 = exec → qa AC_NOT_MET (state stores the summary) → When run 2 = qa-only with PR creation → Then
createPRreceives the stored summary, and the body has noAutomated PR for issue #N.AC-4:
--no-prmeans no PR from either producerVerification: Unit Test (an existing batch-executor
noPrcase, plus the AC-1 gate)Scenario: Given
noPr→ ThencreatePRisn't called, and exec can't open one because AC-1 suppresses it whenever the orchestrator is set.Implementation Plan
Phase 1: Single producer (skill text)
exec/SKILL.mdcopies: add the skip line under### PR Creation and Verification(:979): the orchestrator opens and updates the PR; commit andgit push -u origin <branch>, then report the branch and stop. Reword the in-place bullet at:262-265and the MCP pull-request-tool sentence at:246so they apply only when standalone. Add bullet 6 to the orchestrated list at:173-179: "Skip PR creation". Keep thegh pr createallowlist entry, since standalone still uses it.src/lib/__tests__/exec-orchestrated-no-pr-skill.test.ts, scoped to the two regions in each copy. Commit, then mutation-verify by deleting the skip line in one copy.Phase 2: Update-in-place (
createPR)GitHubProvider.updatePRSync(prNumber, {title?, body?, base?}, cwd)inplatforms/github.ts. It runsgh api -X PATCH repos/{owner}/{repo}/pulls/<n> -F body=@<tmpfile> -f title=… [-f base=…](the{owner}/{repo}placeholders are resolved by gh from cwd), andviewPRByBranchSyncalso fetchesbody.worktree-manager.ts, factor title, linkMode and body into one place, computed before Step 1. Replace both early returns withupdateExistingPR(): push, check the overwrite policy, PATCH. A failed PATCH returns success with a warning; it doesn't fail the run, because the PR exists (fix(run): exec that leaves work uncommitted reports success and the run passes with no PR — #534's empty-branch escape, reopened via a new route #879 is about a missing PR). Note that the current early return never pushes, so qa-loop commits made after exec's PR stay local today. The update path fixes that.child_processmock queues inworktree-manager.test.ts, where the new push and gh calls shift them (bug(exec): sequant run worktrees never record sequantBase, so the zero-diff/uncommitted guard compares against origin/main and a --base ahead of main disables it #1234 trap). Add cases for both early returns, a hand-edited body,--stackedbase, and a PATCH failure.Phase 3: Persist exec summary
execSummary: z.string().optional()toIssueStateSchema: the extracted, sanitized summary, capped byEXEC_SUMMARY_MAX_LENGTH. AddStateManager.updateExecSummary(). Batch-executor writes it after a successful exec. At PR time it uses the current run's exec output if there is one, otherwisestate.execSummary. Thread it asopts.execSummary(already extracted) next toexecOutput.noPr+ orchestrated (AC-4), then run the grep-scoped suite from the runner comment.Design Review
createPRinworktree-manager.tsas the only producer, withGitHubProviderowning theghcall (Consolidate remaining gh CLI calls into GitHubProvider #443). The skill only gives up PR creation.SEQUANT_NO_PRenv var: the runner comment suggests threadingnoPrto exec, but once exec never opens a PR under an orchestrator there is nothing for the flag to gate. Rejected: (a) let exec create the PR and have the orchestrator only edit it, which keeps two producers; (b) aSEQUANT_NO_PRenv var, which adds one more rule to keep in sync for no behavior.**Skip this section if SEQUANT_ORCHESTRATOR is set**header (:271/:291);gh api PATCHwith a body file (memoryfeedback_gh_pr_edit_projectcards); additive optional state fields (capped, feat(orchestrator): preserve partial output for turn-capped phases in phase-executor #739).pr/phasesalready rely on, and qa-only re-runs happen from the same checkout. A branch marker would need a commit or a PR to exist first. Second: "PATCH on a human PR?" That's the overwrite policy above.ADR: the plan chooses between designs (exec-as-producer vs orchestrator-as-producer; state vs branch marker), so the exec PR includes
docs/adr/NNNN-single-pr-producer-under-orchestrator.md.Feature Quality Planning
fullsolve/SKILL.md:784gives exec-created PRs no update path either. Under AC-1, exec stops creating them in fullsolve, and fullsolve's own §5.1 still runs.merger/releaseare standalone.docs/mentions of exec creating the PR undersequant run. GrepPR creationindocs/and the CHANGELOG entry.Open Questions
execSummaryon the issue state or inphases.exec? Recommendation: issue-level, sincePhaseStateis a status record. Impact: minor.Recommended Workflow
Phases: spec → exec → qa
Quality Loop: disabled
Reasoning: It's a bug fix whose design is set above. The tests are named per AC, so testgen stubs add nothing.
Conflict note: no open worktree touches
worktree-manager.ts/batch-executor.tspastmainexcept #1222/#1223/#1233, which are already merged. #1245 edits theqaVerdictline next and lands after this one.admarble commentedon Oct 1, 2026
QA Verdict: NEEDS_VERIFICATION
AC coverage: 4/4 met
Gaps:
chore(#1247): wip open the PR after exec (owner option B)
fix(#1247): open the PR right after exec so qa has a body to read (AC-5)
admarble commentedon Oct 1, 2026
Follow-up ledger: QA's gap 2 ("qa runs before any PR exists, so §6i resolves Missing") is fixed in PR #1252, not filed. The owner chose option B: the orchestrator opens the PR right after exec and updates it after QA. That is AC-5, added to the AC list above. QA's gap 1 (CI pending) is resolved by CI on the new head. The draft-until-QA policy stays with #1246.
docs(run,abort): --no-pr help and PR-creation page match the after-ex…