Skip to content

decision(run): a sequant run where no qa ran still ends with a PR — draft+note, require qa, or unchanged (blocked by #1247) #1246

Closed

Description

@admarble

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 buildAutomatedPRBody builds 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 (--resume past 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 to createPR on 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_run phases description 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

Graph metadata

May touch

  • src/lib/workflow/batch-executor.ts, src/lib/workflow/batch-executor.test.ts
  • src/lib/workflow/worktree-manager.ts (createPR / buildAutomatedPRBody), src/lib/workflow/worktree-manager.build-pr-body.test.ts
  • src/lib/workflow/platforms/github.ts (only if draft creation needs a flag)
  • src/mcp/tools/run.ts, src/mcp/tools/run.test.ts

Activity

  1. added
    enhancement
    on Sep 30, 2026
  2. changed the title [-]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)[/+] on Sep 30, 2026
  3. admarble commented on Oct 4, 2026

    @admarble
    ContributorAuthor

    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:

    Prior fixes / producers:

    Launch constraints:

  4. admarble commented on Oct 4, 2026

    @admarble
    ContributorAuthor

    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 declared Evidence:; AC-1/2/3 resolve to unit_test). No vague or open-ended wording.

    • ⚠️ The evidence commands pass on main today. They name existing test files, so they gate nothing until new cases are added. Each AC needs a new test case that fails on main and is mutation-verified. Mutations: drop the not-run line → AC-1 fails; pass the "QA ran" signal on the post-QA call unconditionally → AC-2's ordering case fails; delete the description change → AC-4 fails.
    • ⚠️ AC-1's definition of "QA has run" is too loose for two of the cases the issue names. See Open Question 1.

    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.

    Metric Value Status
    Feature count 1 ✅
    AC items 4 ✅
    Directory spread 2 ✅

    Verdict: ✅ SCOPE_OK

    Dependencies: #1247 is CLOSED (merged), #1245 is CLOSED (merged; latest-phase.ts is on main). #1297 is OPEN and touches buildAutomatedPRBody, so run it sequentially, not in parallel.
    In-flight: the feature/1246-… worktree exists at 058ff7de with 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] → When openOrUpdatePR runs after exec → Then the body passed to createPR contains > **QA has not run** — phases run: spec, exec. …, and the line is absent when the issue state has phases.qa.status === "completed" and this run ran no exec (the --resume case).
    Assumptions: spec's result is in phaseResults (batch-executor.ts:1333), so "phases run" can come from phaseResults in 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. With AC_MET_BUT_NOT_A_PLUS, the second body has only the verdict note. A qa-only run (#1198) has no line.
    Assumptions: buildAutomatedPRBody rebuilds the body from scratch each time and updateExisting replaces 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 createPR passes no draft flag.

    AC-4: The MCP phases description is honest

    Verification: Unit Test (run.test.ts)
    Scenario: runToolInputSchema.phases.description no longer matches /to skip QA/ and does match a phrase like opens a PR marked as not reviewed.


    Implementation Plan

    Phase 1: Signal (batch-executor + latest-phase)

    1. Add a pure helper to src/lib/workflow/latest-phase.ts, e.g. qaReviewedLatestExec(phaseResults, priorQaCompleted). It returns true when the latest qa entry comes after the latest exec entry in this run, or when this run has no exec entry and the state records a completed qa from an earlier run. Unit-test it next to the existing latest-phase tests.
    2. In openOrUpdatePR (batch-executor.ts:1125), read phases.qa.status from the getIssueState call it already makes for execSummary. Hoist that call so the state is read once, and only when stateManager is set. Then compute qaNotRun = reviewed ? undefined : { phasesRun }. phasesRun is the distinct phaseResults[].phase values in run order. Pass it through createPR's opts object, the way followups goes. Do not add a positional parameter.
      • No new git/gh call. The ordered child_process mocks in batch-executor.test.ts stay aligned.

    Phase 2: Render (worktree-manager)

    1. buildAutomatedPRBody gets an opts.qaNotRun?: { phasesRun: string[] }. Render a qaNotRunNote() next to qaVerdictNote (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.`
    2. Thread qaNotRun through createPR's opts and update the JSDoc on both functions.

    Phase 3: MCP surface

    1. src/mcp/tools/run.ts:613: replace Example: '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 to run.test.ts next 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

    1. Where does this logic belong? The decision belongs in openOrUpdatePR, the only createPR call site, which already holds phaseResults and the state. Rendering belongs in buildAutomatedPRBody, the only body producer. The skills and isAutomatedPRBody stay untouched: a hand-edited body keeps whatever it has, as the runner context requires.
    2. What's the simplest correct approach? One optional field and one sibling note function. Rejected: (a) editing the existing body text with a regex. The body is rebuilt every time, so that is unnecessary. (b) Reusing ranQa at :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.
    3. What existing pattern does this follow, and how often has it been re-patched? It follows the fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 qaVerdictNote pattern (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.
    4. What would a senior reviewer challenge? "Why not just 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.
    5. Every producer and consumer.
      • Producer: buildAutomatedPRBody only (createPR → openOrUpdatePR, both calls).
      • Consumers: GitHub PR body (human reviewer), /qa (reads mutation markers, the AC table and test-plan boxes, none of which this line touches), and isAutomatedPRBody (keyed on the trailer, unaffected).
      • Related "did qa run" readers: ranQa (:2391, status) and the qaVerdict lookups (:2384, :2503). They are kept separate on purpose and the PR should say why.

    Feature Quality Planning

    All standard checks pass. Notable items:


    Open Questions

    1. 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:

      • (a) A quality-loop iteration's after-exec call ([exec, qa, loop, exec]) has no line and no verdict. If the run then crashes, the PR looks reviewed.
      • (b) --phases exec on an issue reviewed earlier: phases.qa in 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 (--resume past 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.

    2. Line text. Recommendation: include the sequant run N --phases qa remedy (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 --noEmit and npm run build, not the full npm test.


    Label Review

    Current: enhancement
    Recommended: enhancement, planned
    Quality Loop: won't auto-enable (SCOPE_OK)

  5. added
    planned
    on Oct 4, 2026
  6. admarble commented on Oct 4, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #1246

    AC Coverage

    AC Description Status Notes
    AC-1 Not-run line naming the phases that ran; prior completed qa counts MET qaNotRunNote (worktree-manager.ts) renders > **QA has not run** — phases run: …; openOrUpdatePR sets qaNotRun unless latestPhaseResult(phaseResults,"qa") exists or state.phases.qa.status === "completed". Tests cover spec,exec, prior completed qa, prior failed qa
    AC-2 Post-QA update replaces the line; READY_FOR_MERGE and qa-only re-run remove it MET The else if (qaNotRun && !qaVerdict) slot means a verdict of any kind or a ready-gate report wins. Tests assert the after-exec and post-QA createPR bodies, including the #1198 qa-only case
    AC-3 A qa run leaves the body as it is today; never a draft MET The post-QA body equals buildAutomatedPRBody(1246,{qaVerdict:"READY_FOR_MERGE"}) exactly; createPR has no draft flag
    AC-4 MCP phases description drops "to skip QA" MET run.ts:613 changed; the new run.test.ts case asserts it

    Coverage: 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 needs test green.

    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

    AC Evidence Executed? Result
    AC-1/2/3/4 npx vitest run …build-pr-body.test.ts …batch-executor.test.ts src/mcp/tools/run.test.ts Yes (union of all four commands) ✅ 3 files, 281 passed

    Status: Complete

    Mutation Verification

    isGateTestEvidence is 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, and parseMutationMarkers classifies all three as valid.

    Code Review

    Strengths: It reuses the existing state read and adds no new git/gh call, so the ordered child_process mocks 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 why ranQa (#1233) is kept separate.
    Issues: none blocking.

    Call-Site Review

    No new exports. qaNotRunNote is private. createPR/buildAutomatedPRBody gained the optional qaNotRun, and its only producer is openOrUpdatePR, used at both call sites (after exec at :2079, after QA at :2518).

    CHANGELOG Verification

    [Unreleased] ### Added entry 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: Clean

    Risk Assessment

    • Likely failure mode: Spec Open Question 1. Under AC-1's literal definition: (a) the after-exec update in a quality-loop iteration ([exec, qa, loop, exec]) carries neither the line nor a verdict, so a crash after it leaves a PR that looks reviewed; (b) --phases exec on an issue QA'd earlier is suppressed by the stale phases.qa=completed. The AC text is met as written; this is the gap the issue exists to close.
    • Not tested: the quality-loop iteration body (case a above).
    • Sibling sites considered: Class searched: "readers that decide whether QA ran". 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 two qaVerdict lookups use latestPhaseResult, with no first-match .find. The separation is intentional and commented.
    • Sibling-line audit: both openOrUpdatePR call sites checked.

    Adversarial Re-Read

    Findings:

    1. OQ1 (above) is still open. The spec asked the owner to edit AC-1 if they wanted the ordering rule; the AC was not edited, and nothing was filed.
    2. PR feat(#1246): a PR from a run QA has not reviewed says "QA has not run"; MCP stops offering spec,exec to skip QA #1298's body ## Summary is 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.
    3. Process state: tree clean, 2 commits ahead and 1 behind main, no stash used. Non-Goals hold: no draft PRs and no gate change.
      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 test is 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

    1. Owner: file or drop OQ1 (the quality-loop and --phases exec-after-review cases).
    2. Fix PR feat(#1246): a PR from a run QA has not reviewed says "QA has not run"; MCP stops offering spec,exec to skip QA #1298's truncated Summary by hand, or link it to fix(run): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1297.
    3. Wait for CI test, then merge origin/main (1 behind) before merging.
  7. added
    needs-improvement
    on Oct 4, 2026
  8. admarble commented on Oct 4, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

  9. added a commit that references this issue on Oct 4, 2026
  10. admarble commented on Oct 4, 2026

    @admarble
    ContributorAuthor

    Runner verification and follow-up ledger (PR #1298)

    • Spec Open Question 1 ("QA has run" should mean QA reviewed the latest exec): fixed in this PR (d1b8201).
      • The AC-1 wording the runner wrote let a crashed loop iteration's update, or a --phases exec re-run, look reviewed.
      • The AC-1 line is amended above, and the code and tests follow it. Each of the two new cases fails when its half of the rule is reverted.
    • Spec Open Question 2 (line text includes the --phases qa remedy): fixed in this PR, as recommended.
    • QA: the PR summary is cut off mid-sentence: the PR body was rewritten by hand. The cause is filed as fix(run): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1297.
    • QA: CI test pending, 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 --noEmit and eslint are clean.

  11. added a commit that references this issue on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-improvementplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions