Repository navigation
Description
Tier: judgment (needs an owner decision) Found: 2026-09-30, verifying #1233 (PR #1239); tracker #1236 (closed). Restated the same day: the root-cause investigation showed that gating in batch-executor isn't the controlling lever while the exec skill opens PRs itself. That's #1247, which this is blocked by.
Observation. A sequant run in which no qa ran (--phases exec, MCP phases: "spec,exec", whose description suggests exactly that "to skip QA" at src/mcp/tools/run.ts:606-613, a spec recommendation without qa, or --resume past a completed qa) still ends with a PR. Since #1233 such a run records the issue as in_progress, but nothing on the PR says it skipped review.
Why it's blocked. Today the exec skill opens the PR itself (gh pr create, even under the orchestrator), and createPR returns an existing PR untouched. So any policy set in batch-executor's gate (batch-executor.ts:2334) only covers runs where exec happened not to open a PR. #1247 makes the orchestrator the only producer and lets createPR update an existing PR's body. After that, this becomes a pure policy choice with one place to enforce it.
Decision (owner, 2026-10-04): option A, a "QA has not run" note. No draft PRs, and the gate isn't changed.
Re-rooted after #1247. The orchestrator is now the only PR producer. It opens the PR after each successful exec pass, so QA can read the PR body, and updates it after QA with the verdict note (openOrUpdatePR in batch-executor.ts). So every PR is unreviewed between exec and QA. The real gap is that a PR whose run never reaches QA looks the same as a reviewed one. That happens with --phases exec, MCP phases: "spec,exec", a spec recommendation that drops qa, a crash or timeout before qa, or a resume. Local base rate: 1 PR without QA in 61 exec runs (#1198, a deliberate exec-only run later reviewed by a qa-only run on the same PR).
Why not the other options: a draft-until-QA PR needs a new mark-ready verb and a verdict→ready rule, for a guard the owner already gives by approving every merge. "Require qa before a PR" is impossible after #1247, because QA reads the PR body.
AC
- AC-1: When
buildAutomatedPRBodybuilds a body for a run where QA has not run, the body carries one line saying QA has not run and naming the phases that did (for example> **QA has not run** — phases run: spec, exec. ...). "QA has run" means QA reviewed the latest exec. In this run, that is a qa result after the run's last exec result, so a quality-loop iteration's after-exec update shows the line. A qa completed by an earlier run (issue state) counts only when this run ran no exec (--resumepast qa); an exec re-run shows the line. (Amended 2026-10-04 per spec Open Question 1.) Evidence:npx vitest run src/lib/workflow/worktree-manager.build-pr-body.test.ts src/lib/workflow/batch-executor.test.ts - AC-2: The update after QA replaces that line. The body never carries both the not-run line and a verdict note. A READY_FOR_MERGE verdict, which has no verdict note, also removes the line. A later qa-only run on the same PR (the feat(logs): run log records each phase's model and the sequant version #1198 pattern) removes it as well. Evidence:
npx vitest run src/lib/workflow/batch-executor.test.ts, asserting the body passed tocreatePRon the after-exec call and on the post-QA call - AC-3: A run where qa ran leaves the body as today apart from the line's absence, and the PR is never opened as a draft. Evidence:
npx vitest run src/lib/workflow/batch-executor.test.ts src/lib/workflow/worktree-manager.build-pr-body.test.ts - AC-4: The MCP
sequant_runphasesdescription no longer offers'spec,exec'as a plain way to "skip QA". It says a run without qa opens a PR marked as not reviewed. Evidence:npx vitest run src/mcp/tools/run.test.ts
Non-Goals
- Draft PRs, a mark-ready step, or changing the PR-creation gate.
- Fixing spec's phase-recommendation parsing (separate: it can drop qa silently).
- fix(run): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1297 (exec summary missing from the body). It touches
buildAutomatedPRBodytoo, so run it sequentially, not in parallel.
Graph metadata
- Blocked by: fix(run): sequant run has two PR producers — exec opens the PR itself and createPR returns it untouched, dropping the QA note, ready-gate report and summary #1247
- It touches the same
batch-executor.tsregion as 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, so don't run the two in parallel.
May touch
src/lib/workflow/batch-executor.ts,src/lib/workflow/batch-executor.test.tssrc/lib/workflow/worktree-manager.ts(createPR/buildAutomatedPRBody),src/lib/workflow/worktree-manager.build-pr-body.test.tssrc/lib/workflow/platforms/github.ts(only if draft creation needs a flag)src/mcp/tools/run.ts,src/mcp/tools/run.test.ts
Activity
[-]decision(run): an exec-only sequant run opens a PR with no sign that QA never ran[/-][+]decision(run): a sequant run where no qa ran still ends with a PR — draft+note, require qa, or unchanged (blocked by #1247)[/+]admarble commentedon Oct 4, 2026
Runner context (2026-10-04, main @ 058ff7d)
The body was rewritten for the owner's decision (option A). The AC lines above are the contract.
Where things are:
openOrUpdatePRis atsrc/lib/workflow/batch-executor.ts:1125. The after-exec call (:2065) passes no QA info. The post-QA call (:2504) passesqaVerdict, the ready-gate report andfollowups.latestPhaseResultfromsrc/lib/workflow/latest-phase.ts(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) to ask whether qa ran, and pass that tocreatePRthe same wayfollowupsgoes. Don't add another first-match.find.phases.qa.status(state-schema.ts), viastateManager.getIssueState.openOrUpdatePRalready reads that state for theexecSummaryfallback.qaVerdictNoteis atsrc/lib/workflow/worktree-manager.ts:1791, andbuildAutomatedPRBodyis at:2065. The update path rewrites only bodies thatisAutomatedPRBody(:2030) recognises, so a hand-edited body keeps whatever it has. That is fine; don't change it.src/mcp/tools/run.ts:613.run.test.tshas a live-surface tripwire for this schema (feat(run): fresh-session QA — never resume the exec session into qa; expose run.fullQa (setting + --full-qa + MCP param) #982), so update it deliberately.Prior fixes / producers:
buildAutomatedPRBodyis the only producer of the body. The QA note has one prior fix (fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749), which isn't a class yet.Launch constraints:
npm testin exec or QA, because it hits the 30-minute phase wall; CI runs it. Run the AC test files plusnpx tsc --noEmitandnpm run build.batch-executor.test.tsqueueschild_processmocks in order, so a new git or gh call shifts them.SEQUANT_MUTATIONmarkers inside a final## Summaryheading. The PR body is built only from that section (fix(run): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1297).Refs, never a closing keyword, even in examples.admarble commentedon Oct 4, 2026
Complexity: Standard (4 ACs, 2 directories:
src/lib/workflow/,src/mcp/tools/)AC Quality Check
All 4 ACs parse (
extractAcceptanceCriteria: AC-1..AC-4, each with a declaredEvidence:; AC-1/2/3 resolve tounit_test). No vague or open-ended wording.Scope Assessment
Non-Goals: present. No drafts, no mark-ready step, no gate change. Spec's phase-recommendation parsing and #1297 are out of scope.
Verdict: ✅ SCOPE_OK
Dependencies: #1247 is CLOSED (merged), #1245 is CLOSED (merged;
latest-phase.tsis on main). #1297 is OPEN and touchesbuildAutomatedPRBody, so run it sequentially, not in parallel.In-flight: the
feature/1246-…worktree exists at058ff7dewith no changes. No other worktree touches the PR-body region.Acceptance Criteria
AC-1: Not-run line when QA has not reviewed the current code
Verification: Unit Test (
worktree-manager.build-pr-body.test.ts) + Integration (batch-executor.test.ts)Scenario: Given a run with
[spec, exec]→ WhenopenOrUpdatePRruns after exec → Then the body passed tocreatePRcontains> **QA has not run** — phases run: spec, exec. …, and the line is absent when the issue state hasphases.qa.status === "completed"and this run ran no exec (the--resumecase).Assumptions: spec's result is in
phaseResults(batch-executor.ts:1333), so "phases run" can come fromphaseResultsin order, deduplicated.AC-2: The update after QA replaces the line
Verification: Integration Test (
batch-executor.test.ts)Scenario: Given
[exec, qa(READY_FOR_MERGE)]→ When the after-exec call and then the post-QA call happen → Then the first body has the not-run line and the second has neither the line nor a verdict note. WithAC_MET_BUT_NOT_A_PLUS, the second body has only the verdict note. A qa-only run (#1198) has no line.Assumptions:
buildAutomatedPRBodyrebuilds the body from scratch each time andupdateExistingreplaces it wholesale, so "replaces" needs no string surgery. It only has to compute the right signal.AC-3: A reviewed run's body is unchanged and never a draft
Verification: Unit + Integration
Scenario: Given the run reached QA → Then the body equals today's output byte for byte (snapshot the existing build-pr-body cases unchanged), and
createPRpasses no draft flag.AC-4: The MCP
phasesdescription is honestVerification: Unit Test (
run.test.ts)Scenario:
runToolInputSchema.phases.descriptionno longer matches/to skip QA/and does match a phrase likeopens a PR marked as not reviewed.Implementation Plan
Phase 1: Signal (batch-executor + latest-phase)
src/lib/workflow/latest-phase.ts, e.g.qaReviewedLatestExec(phaseResults, priorQaCompleted). It returns true when the latestqaentry comes after the latestexecentry in this run, or when this run has noexecentry and the state records a completed qa from an earlier run. Unit-test it next to the existing latest-phase tests.openOrUpdatePR(batch-executor.ts:1125), readphases.qa.statusfrom thegetIssueStatecall it already makes forexecSummary. Hoist that call so the state is read once, and only whenstateManageris set. Then computeqaNotRun = reviewed ? undefined : { phasesRun }.phasesRunis the distinctphaseResults[].phasevalues in run order. Pass it through createPR'soptsobject, the wayfollowupsgoes. Do not add a positional parameter.git/ghcall. The orderedchild_processmocks inbatch-executor.test.tsstay aligned.Phase 2: Render (worktree-manager)
buildAutomatedPRBodygets anopts.qaNotRun?: { phasesRun: string[] }. Render aqaNotRunNote()next toqaVerdictNote(worktree-manager.ts:1791), in the same slot. Precedence:readyGateReport› verdict note › not-run line, so the body can never hold both the not-run line and a verdict note (AC-2). Suggested text:> **QA has not run** — phases run: spec, exec. This PR has not been reviewed by sequant's QA phase; run \sequant run N --phases qa` before merging.`qaNotRunthroughcreatePR'soptsand update the JSDoc on both functions.Phase 3: MCP surface
src/mcp/tools/run.ts:613: replaceExample: 'spec,exec' to skip QA.with wording that says a run without qa still opens a PR, marked as not reviewed by QA. Add a tripwire case torun.test.tsnext to the feat(run): fresh-session QA — never resume the exec session into qa; expose run.fullQa (setting + --full-qa + MCP param) #982 block.Design Review
openOrUpdatePR, the onlycreatePRcall site, which already holdsphaseResultsand the state. Rendering belongs inbuildAutomatedPRBody, the only body producer. The skills andisAutomatedPRBodystay untouched: a hand-edited body keeps whatever it has, as the runner context requires.ranQaat:2391. It answers a different question ("did this run run qa", deliberately run-local for bug(state): a successful spec-only run marks the issue ready_for_merge, so a later --phases exec skips it #1233 status) and is computed after the after-exec call.qaVerdictNotepattern (git log -S qaVerdictNote: only 733665d/fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749). fix(run): sequant run has two PR producers — exec opens the PR itself and createPR returns it untouched, dropping the QA note, ready-gate report and summary #1247 changed the call site and 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 changed the verdict lookup. Those are different defects, not repeat fixes of the note, so this is not a recurrence class.phaseResults.some(qa)?" Because a quality-loop iteration or a run that re-execs after an earlier review would then show a PR as reviewed when its latest code never went through QA, which is the gap this issue exists to close. See OQ1. They might also ask "why not a draft?" The owner ruled that out.buildAutomatedPRBodyonly (createPR→openOrUpdatePR, both calls)./qa(reads mutation markers, the AC table and test-plan boxes, none of which this line touches), andisAutomatedPRBody(keyed on the trailer, unaffected).ranQa(:2391, status) and theqaVerdictlookups (:2384,:2503). They are kept separate on purpose and the PR should say why.Feature Quality Planning
All standard checks pass. Notable items:
--ready-gate: the gate report replaces the not-run line. The gate only runs after qa, so this cannot hide a missing review.--no-prand the zero-diff skip (fix(run): phase-restricted runs without an implementing phase must skip PR creation — spec-only batches always report failed #920) are unaffected because no body is built.Open Questions
Should "QA has run" mean "QA reviewed the latest exec"? AC-1 says "a qa result exists in this run, or state records a completed qa". Under that definition:
[exec, qa, loop, exec]) has no line and no verdict. If the run then crashes, the PR looks reviewed.--phases execon an issue reviewed earlier:phases.qain state is never reset when exec re-runs, so the line is suppressed on code QA never saw.Recommendation: the ordering rule in Plan step 1. Count a prior-run qa only when this run ran no exec. This still covers every case AC-1/AC-2 list (
--resumepast qa, the feat(logs): run log records each phase's model and the sequant version #1198 qa-only run). Impact if wrong: exec implements AC-1 literally and the two cases above stay silent. Per house rule, the owner should edit the AC-1 line to the ordering definition if they agree. A comment alone won't change what QA checks against.Line text. Recommendation: include the
sequant run N --phases qaremedy (Plan step 3). Impact: wording only.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: This is a small, well-located change: one helper, one note, one description. The tests extend existing files, so testgen stubs add nothing. Per the runner context, exec and qa run the AC test files plus
npx tsc --noEmitandnpm run build, not the fullnpm test.Label Review
Current: enhancement
Recommended: enhancement, planned
Quality Loop: won't auto-enable (SCOPE_OK)
admarble commentedon Oct 4, 2026
QA Review for Issue #1246
AC Coverage
qaNotRunNote(worktree-manager.ts) renders> **QA has not run** — phases run: …;openOrUpdatePRsetsqaNotRununlesslatestPhaseResult(phaseResults,"qa")exists orstate.phases.qa.status === "completed". Tests cover spec,exec, prior completed qa, prior failed qaelse if (qaNotRun && !qaVerdict)slot means a verdict of any kind or a ready-gate report wins. Tests assert the after-exec and post-QAcreatePRbodies, including the #1198 qa-only casebuildAutomatedPRBody(1246,{qaVerdict:"READY_FOR_MERGE"})exactly;createPRhas no draft flagphasesdescription drops "to skip QA"run.ts:613changed; the newrun.test.tscase asserts itCoverage: 4/4 MET
CI Status (PR #1298)
canary, validate-plugin, validate-skills, typecheck, node-floor-guard, tautology-advisory: ✅ pass.
test: ⏳ IN_PROGRESS. No AC depends on CI, but merge needstestgreen.Quality Metrics
Type issues 0 · deleted tests 0 · 7 files · +301/−6 ·⚠️
tsc --noEmit✅ ·npm run build✅ ·npm run lint✅ · branch is 1 commit behind main (eecbb12, an unrelated skills change)Declared-Evidence Execution
npx vitest run …build-pr-body.test.ts …batch-executor.test.ts src/mcp/tools/run.test.tsStatus: Complete
Mutation Verification
isGateTestEvidenceis false for AC-1 to AC-4, so this is Not-Applicable. The PR still carries markers for AC-1, AC-2 and AC-4, andparseMutationMarkersclassifies all three asvalid.Code Review
Strengths: It reuses the existing state read and adds no new git/gh call, so the ordered
child_processmocks stay intact. One render slot keeps the precedence ready-gate → verdict note → not-run line, so the body can never carry both. The spec's crash case ("a qa that fails leaves the after-exec line") has its own test. The comment explains whyranQa(#1233) is kept separate.Issues: none blocking.
Call-Site Review
No new exports.
qaNotRunNoteis private.createPR/buildAutomatedPRBodygained the optionalqaNotRun, and its only producer isopenOrUpdatePR, used at both call sites (after exec at :2079, after QA at :2518).CHANGELOG Verification
[Unreleased] ### Addedentry present with (#1246). ✅Trust-Boundary Check
Finding: Clean. The diff implements only product requirements; no agent-directed external-text instruction was acted on.
Status: Clean
Behavior-Rule Survival Check
The AC-4 description change is the only behavior-rule-shaped AC. The old "to skip QA" string is gone from
run.ts, and the test asserts its absence. Status: CleanRisk Assessment
[exec, qa, loop, exec]) carries neither the line nor a verdict, so a crash after it leaves a PR that looks reviewed; (b)--phases execon an issue QA'd earlier is suppressed by the stalephases.qa=completed. The AC text is met as written; this is the gap the issue exists to close.ranQa(bug(state): a successful spec-only run marks the issue ready_for_merge, so a later --phases exec skips it #1233 status) and the twoqaVerdictlookups uselatestPhaseResult, with no first-match.find. The separation is intentional and commented.openOrUpdatePRcall sites checked.Adversarial Re-Read
Findings:
## Summaryis cut off mid-sentence at "…the PR update after the sec", so OQ1's write-up never reaches the reviewer. This comes from exec-summary extraction (the fix(run): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1297 area), not from this diff.Status: Gaps Found
Follow-up Ledger
Status: Unresolved
Verdict: AC_MET_BUT_NOT_A_PLUS
All 4 ACs are MET and every declared test command ran green (281 passed; tsc, build and lint clean). The verdict is capped because the Follow-up Ledger is Unresolved: spec OQ1 has no terminal state. CI
testis also still running, and the branch is 1 commit behind main. The owner needs to decide OQ1: file it as a follow-up, or drop it with a reason.Next Steps
--phases exec-after-review cases).test, then merge origin/main (1 behind) before merging.admarble commentedon Oct 4, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
fix(#1246): "QA has run" means QA reviewed the latest exec — a loop i…
admarble commentedon Oct 4, 2026
Runner verification and follow-up ledger (PR #1298)
--phases execre-run, look reviewed.--phases qaremedy): fixed in this PR, as recommended.testpending, branch 1 behind main: handled before merge. The branch is updated, and CI re-runs on d1b8201.Commands run: the 4 AC test files passed 291/291, and
tsc --noEmitand eslint are clean.fix(#1302): settle blocks and hook-verdict changes go to exec's final…