You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NEEDS_VERIFICATION maps to ready_for_merge, blocking QA re-runs; MCP sequant_run ignores force #972
Two interacting frictions, observed across a 20-issue production run (vid-gen, 2026-08-28, sequant 2.12.0 via the Claude Code plugin):
1. A NEEDS_VERIFICATION QA verdict sets issue state to ready_for_merge. The verdict semantically means "a human/orchestrator must execute the ACs before merge" — but the state guard then refuses any follow-up run:
! #16: already ready_for_merge — skipping (use --force to re-run)
So the exact issues that most need a QA re-run (after the orchestrator's real execution finds and fixes problems) are the ones the guard blocks. Empirical note from this run: every NEEDS_VERIFICATION verdict (3 of 3, plus a 4th on a later issue) concealed a real integration bug that only real execution surfaced — imagined vendor APIs behind mocked tests. Treating the verdict as merge-ready understates it.
2. The MCP sequant_run tool silently ignores a force input. The CLI has -f/--force, but callers on the MCP path (which is also the #856-safe launch path — backgrounded CLI launches die to the bg-pty watchdog) have no equivalent. Passing force: true neither errors nor forces:
{"issues":[16],"phases":"qa","force":true}
→ "already ready_for_merge — skipping (use --force to re-run)"
Workaround used (4×): hand-edit .sequant/state.json — set the issue's status to in_progress and the qa phase to pending — then re-invoke MCP sequant_run. Works, but is undocumented surgery on internal state.
Suggested ACs
AC-1: NEEDS_VERIFICATION maps to a distinct state (e.g. awaiting_verification) that (a) is excluded from "already completed" skipping for qa-phase runs, and (b) is surfaced distinctly in sequant_status.
AC-2: MCP sequant_run accepts force (or rejects it loudly as unsupported — silent-ignore is the worst of both).
AC-3: docs state what each verdict does to workflow state (READY_FOR_MERGE / AC_MET_BUT_NOT_A_PLUS / NEEDS_VERIFICATION / AC_NOT_MET → state + what re-runs are permitted).
Environment
sequant 2.12.0 (plugin + npx [email protected] serve MCP), Claude Code, macOS. Repro is deterministic: any QA run returning NEEDS_VERIFICATION, then attempt sequant_run phases=qa via MCP.
Extension proposal: verdict-triggered verify routing (beyond the state fix)
AC-1's awaiting_verification state fixes the blocking, but the same run's evidence suggests going one step further: NEEDS_VERIFICATION should route to an automated verify phase dispatch, not only to a distinct state. The human/orchestrator real-execution pass that this verdict demands is mechanizable, and the mechanism already exists in the shipped driver:
Phase is an open string (src/lib/workflow/types.ts:65), and the phase-mapper executes whatever chain a spec recommends. In the same vid-gen run, issue Document MCP dependencies and make them optional #15's spec recommended testgen → exec → verify → qa and the 2.12.0 driver ran the verify phase (passed, 124s, in the run log). So verify-as-a-phase is proven; what's missing is only the verdict-triggered dispatch.
The routing that would have converted all four hidden-bug cases from "orchestrator hand-verifies, hand-edits state.json, re-invokes" into one automated loop: QA returns NEEDS_VERIFICATION → state awaiting_verification → driver dispatches a verify phase (execute the ACs' literal verify commands, real dependencies, no mocks) → verify pass feeds evidence into a QA re-run; verify fail returns findings to exec/loop.
Failure semantics worth pinning in the design: a verify-phase failure is a deterministic signal (command exit codes, not LLM judgment) — which also makes it a candidate capability-bound trigger for feat(run): model escalation ladder on capability-bound non-convergence #971's ladder without reopening the semantic-comparison objection rejected there.
Phase-0 check that re-orders the lever (measured 2026-08-28)
Before treating routing as the fix, I measured whether the ACs a verify phase would execute actually exist outside vid-gen (whose ACs were verification-paired by construction):
AC executability in sequant's own corpus: across the 150 most recent closed issues, 867 AC checkbox lines; only 107 (~12%) are machine-executable without interpretation (37 with an inline backticked verify command, 70 referencing a named test). The rest are prose. (Heuristic grep; directionally solid even with classifier noise.)
The verdict recurs beyond vid-gen: in the 95 retained .sequant/logs run logs, NEEDS_VERIFICATION is 21 of 134 verdicts (~16%) — this is a standing slice of QA outcomes, not a one-run artifact.
So the routing below only pays on repos whose ACs are executable — on a ~12%-executability corpus it mostly dispatches into a void. The first lever is #943 (constitution enforcing verification-paired ACs); verdict-triggered verify is its dependent, not a standalone fix. vid-gen is the existence proof of the combination, not of routing alone.
Suggested additional AC (sequenced after/with #943)
AC-4: a QA run returning NEEDS_VERIFICATION triggers a verify phase dispatch (opt-in via settings, e.g. run.verifyOnNeedsVerification), whose result either unlocks the QA re-run (pass, with captured command output attached as evidence) or routes findings back to the fix loop (fail) — no manual state surgery in either path; when an AC carries no executable verify command, the verify phase reports that AC as NOT-EXECUTABLE (honest gap, per the feat(setup): constitution with teeth — generated Definition of Done + AC standard replace the boilerplate #943 standard) rather than reasoning it passed.
One more datum for the motivation section
The body's 4/4 count can also carry the contrast case: in the same run, the two passing verdicts weren't fully clean either (one AC_MET_BUT_NOT_A_PLUS with an unimplemented AC clause whose command only passed because QA's tests self-seeded the input; one READY_FOR_MERGE with an imageless contact sheet). Verdict-triggered verify on NEEDS_VERIFICATION is the priority, but it's the same underlying gap: verdicts assert what was reasoned, the verify phase asserts what was executed.
Scoping note for the implementation run (2026-08-29): this pass implements AC-1, AC-2, AC-3 only (state mapping, MCP force loudness, verdict→state docs). The AC-4 verify-routing extension in the comment above is explicitly sequenced behind #943 (AC-standard constitution) and is out of scope here — do not implement or partially implement it in this PR.
All three ACs are clear and measurable. No vague language, no unmeasurable thresholds, no open-ended scope. Linter: 3/3 passed.
Scope Assessment
Non-Goals (from scoping comment 2026-08-29): AC-4 verify-routing (dispatch a verify phase on NEEDS_VERIFICATION) is explicitly out of scope — sequenced behind #943. Do not implement or partially implement it here.
AC-1: NEEDS_VERIFICATION maps to awaiting_verification
Verification: Integration Test Scenario: Given a QA phase that emits Verdict: NEEDS_VERIFICATION → When the run completes → Then state.json shows status: "awaiting_verification" for the issue (not ready_for_merge), and sequant_status returns that distinct status with a nextAction hint to re-run the qa phase; and a subsequent sequant run <N> --phases qa (without --force) proceeds instead of skipping. Assumptions: The awaiting_verification status must be added to IssueStatusSchema and must NOT appear in COMPLETED_ISSUE_STATUSES (so the skip-guard in run-orchestrator.ts does not block the re-run).
AC-2: MCP sequant_run accepts force
Verification: Integration Test Scenario: Given sequant_run called with {issues: [N], phases: "qa", force: true} → When the MCP handler builds the CLI args → Then --force appears in the spawned CLI command (verifiable via test inspection of the args array), and passing force: true with a completed issue overrides the skip-guard rather than being silently ignored. Assumptions: The existing CLI --force flag in RunOptions/bin/cli.ts already works; only the MCP schema + arg-forwarding is missing.
AC-3: Docs cover verdict → state → re-run policy
Verification: Manual Test Scenario: Given docs/features/qa-verdict-workflow-states.md exists → When a reader looks up any of the four verdicts → Then the doc states (a) which IssueStatus each verdict maps to, and (b) whether a re-run is permitted without --force. Assumptions: A new file under docs/features/ is the right location (matches the pattern of docs/features/exec-qa-phase-guards.md for similar phase-outcome docs).
Implementation Plan
Phase 1: State schema + status display (2 files)
src/lib/workflow/state-schema.ts:51–60 — Add "awaiting_verification" to IssueStatusSchema. Position it after "waiting_for_human_merge" for conceptual grouping with the other "not-done-but-action-needed" statuses.
src/lib/workflow/reconcile.ts:168–178 (getNextActionHint) — Add case "awaiting_verification": return \sequant run ${issue.number} --phases qa`sosequant_status's nextAction` field is actionable instead of falling through to the empty-string default.
Phase 2: Verdict → status mapping fix (1 file)
src/lib/workflow/batch-executor.ts:1866–1870 — Change finalStatus derivation. The variable phaseResults is already in scope at that line. Extract const qaVerdict = phaseResults.find((p) => p.phase === "qa")?.verdict; (this same extraction happens again at line 1971 — the earlier one can be shared or duplicated; prefer duplication over premature extraction). Then:
Note: completed-status.ts need not change — awaiting_verification is intentionally absent from COMPLETED_ISSUE_STATUSES, so the skip-guard in run-orchestrator.ts:884 and chain-resume.ts:26 already correctly treats it as incomplete.
force: z.boolean().optional().describe("Re-run even if the issue is already in a completed state (mirrors CLI --force)"),
src/mcp/tools/run.ts:542–584 (handler) — Destructure force from the input params and add:
if(force){args.push("--force");}
Place this after the existing if (qualityLoop) block (line ~579) for consistency.
Phase 4: Documentation (1 new file)
docs/features/qa-verdict-workflow-states.md — New file. Minimum required content:
A table: Verdict → IssueStatus → Re-run without --force?
READY_FOR_MERGE → ready_for_merge → No (already done)
AC_MET_BUT_NOT_A_PLUS → ready_for_merge → No (PR is ready, polish skipped)
NEEDS_VERIFICATION → awaiting_verification → Yes (qa re-run permitted; human must execute ACs first)
AC_NOT_MET → in_progress → Yes (fix and re-run)
Brief prose explaining what each status means for the next action
Design Review
Where does this logic belong? The verdict → status mapping lives in batch-executor.ts's runPhases function, which already owns the finalStatus decision. IssueStatusSchema in state-schema.ts is the canonical vocabulary. Both are the right layers.
Simplest correct approach? Check qaVerdict === "NEEDS_VERIFICATION" at the finalStatus branch in batch-executor.ts. No new abstraction, no new interface — one conditional. For AC-2, add the param to the schema and pass through to CLI args (same pattern as qualityLoop). For AC-3, a new doc file is the lowest-friction path given docs/features/exec-qa-phase-guards.md is the direct precedent.
What a senior reviewer will challenge? "Why not make NEEDS_VERIFICATION fail the phase (like AC_NOT_MET) so the quality loop handles it?" — NEEDS_VERIFICATION means QA reasoning succeeded but execution was not witnessed; the quality loop re-runs QA reasoning against the same code without executing ACs, so it can't resolve the gap. The new status signals "pause for real execution," not "fix the code." The loop would spin uselessly.
Feature Quality Planning
All standard checks pass. Notable items:
awaiting_verification must be verified absent from COMPLETED_ISSUE_STATUSES (gate: check completed-status.ts after the schema edit)
The chain-resume.ts completed-status guard uses the same isCompletedIssueStatus import — verify it picks up the absence automatically (no separate list)
MCP force type is boolean | undefined, consistent with qualityLoop — no coercion needed
Open Questions
Should awaiting_verification issues be re-runnable for non-qa phases? — The current plan excludes awaiting_verification from COMPLETED_ISSUE_STATUSES, so any phase re-run proceeds. If you only want to permit qa re-runs (exec would redo the implementation), we'd need phase-specific skip logic. Recommendation: exclude from completed (permit all phases). Impact: low — a user explicitly re-running exec on an awaiting_verification issue is intentional.
Recommended Workflow
Phases: exec → qa Quality Loop: enabled Reasoning: Three-AC bug fix spanning state schema, orchestration logic, MCP tool, and docs. Quality loop guards against the state-schema change having broader skip-guard implications missed in the first pass.
Label Review
Current:bug Recommended:bug, planned Quality Loop: Will auto-enable (complex enough to warrant a second QA pass)
src/lib/workflow/state-schema.ts — add awaiting_verification to IssueStatusSchema
src/lib/workflow/batch-executor.ts — derive awaiting_verification when qaVerdict === "NEEDS_VERIFICATION"
src/lib/workflow/reconcile.ts — add nextAction hint for awaiting_verification
src/commands/status.ts — add color + priority-order entry for awaiting_verification
dashboard/server.ts — add awaiting_verification to exhaustive byStatus record
src/mcp/tools/run.ts — add force param to schema + arg forwarding
docs/features/qa-verdict-workflow-states.md — new docs file (AC-3)
src/lib/workflow/batch-executor.test.ts — 2 new tests for state mapping
src/lib/workflow/reconcile.test.ts — 1 new test for awaiting_verification hint
src/mcp/server-extended.test.ts — 2 new tests for force arg forwarding
Build / Lint / Tests
Check
Status
npm run build
✅ Clean
npm run lint
✅ Clean (0 errors)
New tests (reconcile, server-extended, batch-executor #972)
✅ 5/5 pass
Pre-existing withActivityHook failure
⚠️ Pre-existing on main (confirmed via stash)
Quality Plan Alignment
Quality Plan Alignment: N/A — No quality plan section in spec comment.
Notable: awaiting_verification correctly absent from COMPLETED_ISSUE_STATUSES (verified in completed-status.ts), so chain-resume.ts and run-orchestrator.ts skip-guards both pick up the non-completed treatment automatically without further changes.
NEEDS_VERIFICATION → distinct awaiting_verification state, excluded from "already completed" skipping for qa, surfaced distinctly in sequant_status
MET
state-schema.ts:56 adds the enum; batch-executor.ts:1866-1873 maps qaVerdict === "NEEDS_VERIFICATION" → awaiting_verification; absent from COMPLETED_ISSUE_STATUSES (completed-status.ts:41-45) so the skip-guard at run-orchestrator.ts:884 / chain-resume.ts:113 does not fire; reconcile.ts:162 gives sequant_status a nextAction hint; status.ts adds display color + order. Production path confirmed: phase-executor.ts:970-979 returns success:true for NEEDS_VERIFICATION, so the mapping fires in prod, not just under mocks.
AC-2
Original
MCP sequant_run accepts force; forwards to CLI
MET
run.ts:517-524 adds the zod force boolean; run.ts:590-592 pushes --force. Forwarding target verified: run command registers -f, --force at bin/cli.ts:409 ("bypass pre-flight state guard"), consumed at run-orchestrator.ts:785. Silent-ignore eliminated.
AC-3
Original
Docs cover verdict → state → re-run policy
MET (manual doc review)
docs/features/qa-verdict-workflow-states.md: table maps all four verdicts to their IssueStatus and states re-run-without---force per verdict; prose accurate against code (READY_FOR_MERGE/AC_MET_BUT_NOT_A_PLUS→ready_for_merge, NEEDS_VERIFICATION→awaiting_verification, AC_NOT_MET→in_progress).
Coverage: 3/3 AC items fully met. Non-goal (AC-4 verify-routing) correctly not implemented.
CI Status
Check
State
Impact
build (22.x)
SUCCESS
✅ MET
typecheck
SUCCESS
✅ MET
validate-skills
SUCCESS
✅ MET
validate-plugin
SUCCESS
✅ MET
node-floor-guard
SUCCESS
✅ MET
tautology-advisory
SUCCESS
✅ MET
CI Summary: 6 passed, 0 pending, 0 failed (waited for build (22.x) to settle before verdict).
Quality Metrics
Metric
Value
Status
Type issues (any)
0
OK
Deleted tests
0
OK
Files changed
10
OK
Lines added
+176
-
Lines deleted
-1
-
Security patterns
0 critical / 0 warn / 1 info
OK
Sub-agent checks: type-safety PASS, scope SMALL/SCOPE_OK, security PASS (the force boolean is zod-validated and pushes a static "--force" string — no injection surface).
✅ reconcile.test.ts (awaiting_verification hint + all-statuses edge case)
run.ts (MCP force)
Standard
✅ server-extended.test.ts (force:true adds --force, force:false does not)
state-schema.ts
Optional
– (enum only, exercised by consumers + typecheck)
status.ts / dashboard/server.ts
Optional
– (display plumbing; exhaustive Record enforced by compiler)
All new tests pass locally (4 targeted + 2 batch-executor).
Code Review
Strengths:
Minimal, surgical change: one conditional at the single finalStatus derivation site, one zod field + one arg-push, one enum value, one docs file.
awaiting_verification correctly excluded from COMPLETED_ISSUE_STATUSES, so both skip-guards (run-orchestrator.ts, chain-resume.ts) pick up the non-completed treatment via the shared isCompletedIssueStatus predicate — no second list to keep in sync.
Exhaustive-Record compile errors were correctly resolved in both status.ts and dashboard/server.ts.
reconcile.ts hint uses --phases qa (the registered flag at bin/cli.ts:274), which is actually more correct than the pre-existing waiting_for_qa_gate hint's --phase qa.
Issues:
CHANGELOG: No [Unreleased] entry for this user-facing change (new MCP force param + new status). Demotes from READY_FOR_MERGE per the §10a gate.
Cross-file sibling site (non-blocking):state-rebuild.ts:118 maps issueLog.status === "success" → "ready_for_merge" unconditionally. Because a NEEDS_VERIFICATION run logs issue status: "success", rebuilding state.json from run logs would re-introduce the AC-1 bug in that recovery path. Outside AC-1's literal scope (primary run→state write + sequant_status, both fixed) — recommend a follow-up issue rather than widening this PR.
Suggestions:
Add a CHANGELOG [Unreleased] entry before merge.
File a follow-up for the state-rebuild.ts NEEDS_VERIFICATION mapping (the run-log schema would need to carry the qa verdict to reconstruct awaiting_verification).
CHANGELOG Verification
Check
Status
CHANGELOG.md exists
✅ Found
User-facing changes
✅ Yes (fix(#972) commit)
[Unreleased] entry
⚠️ Missing
Result: Missing entry for user-facing changes — add to ## [Unreleased] before merging.
Trust-Boundary Check
Finding: Clean — diff implements only the three product ACs; no agent-directed instruction from issue/comment text was acted on. The force param traces to AC-2's stated requirement, and the scoping comment ("implement AC-1/2/3 only") was honored (AC-4 not implemented).
Status: Clean
Risk Assessment
Likely failure mode: If a user's state.json is lost and rebuilt from run logs, a prior NEEDS_VERIFICATION issue would be resurrected as ready_for_merge (see state-rebuild.ts:118) — the recovery path, not the primary path, which is correct.
Not tested:state-rebuild.ts NEEDS_VERIFICATION handling (untouched by this PR); status.ts/dashboard display of the new status has no dedicated assertion (compiler-enforced exhaustiveness only).
Sibling sites considered:state-rebuild.ts:118 (issueLog.status === "success" → ready_for_merge) — real cross-file sibling of the same root cause; recommended as a follow-up, non-blocking.
Findings: Traced the full production data-flow (phase-executor verdict→success semantics → batch-executor finalStatus → state write; skip-guard exclusion; MCP→CLI --force forwarding target exists) rather than trusting the AC descriptions. Ran the new tests. Surfaced two real gaps the structured pipeline flagged: the missing CHANGELOG entry and the state-rebuild.ts cross-file sibling site. Neither is a severe gap — no unrun verbatim fixture, no evidence-claim-that-is-a-repro, and no AC marked MET without the verification its text required (AC-3's manual doc check was performed; AC-1/AC-2 are integration-tested).
Status: Gaps Found
Verdict: AC_MET_BUT_NOT_A_PLUS
All three in-scope ACs are fully MET with correct production data-flow, clean CI (6/6), zero type/security/scope issues, and passing tests. Two non-A+ items hold it back from READY_FOR_MERGE:
Missing CHANGELOG [Unreleased] entry for a user-facing change (§10a gate demotes the verdict).
A cross-file sibling site (state-rebuild.ts:118) that would re-introduce the bug in the state-recovery path — out of AC-1's literal scope, recommended as a follow-up.
Per break-to-PR policy, this does not feed the quality loop — address the CHANGELOG entry and (optionally) file the follow-up, then merge.
(Optional, follow-up issue) Make state-rebuild.ts reconstruct awaiting_verification for NEEDS_VERIFICATION runs — requires the run-log schema to carry the per-issue qa verdict.
Activity
admarble commentedon Aug 28, 2026
Extension proposal: verdict-triggered verify routing (beyond the state fix)
AC-1's
awaiting_verificationstate fixes the blocking, but the same run's evidence suggests going one step further: NEEDS_VERIFICATION should route to an automatedverifyphase dispatch, not only to a distinct state. The human/orchestrator real-execution pass that this verdict demands is mechanizable, and the mechanism already exists in the shipped driver:Phaseis an open string (src/lib/workflow/types.ts:65), and the phase-mapper executes whatever chain a spec recommends. In the same vid-gen run, issue Document MCP dependencies and make them optional #15's spec recommendedtestgen → exec → verify → qaand the 2.12.0 driver ran the verify phase (passed, 124s, in the run log). So verify-as-a-phase is proven; what's missing is only the verdict-triggered dispatch.awaiting_verification→ driver dispatches averifyphase (execute the ACs' literal verify commands, real dependencies, no mocks) → verify pass feeds evidence into a QA re-run; verify fail returns findings to exec/loop.Phase-0 check that re-orders the lever (measured 2026-08-28)
Before treating routing as the fix, I measured whether the ACs a verify phase would execute actually exist outside vid-gen (whose ACs were verification-paired by construction):
.sequant/logsrun logs, NEEDS_VERIFICATION is 21 of 134 verdicts (~16%) — this is a standing slice of QA outcomes, not a one-run artifact.So the routing below only pays on repos whose ACs are executable — on a ~12%-executability corpus it mostly dispatches into a void. The first lever is #943 (constitution enforcing verification-paired ACs); verdict-triggered verify is its dependent, not a standalone fix. vid-gen is the existence proof of the combination, not of routing alone.
Suggested additional AC (sequenced after/with #943)
verifyphase dispatch (opt-in via settings, e.g.run.verifyOnNeedsVerification), whose result either unlocks the QA re-run (pass, with captured command output attached as evidence) or routes findings back to the fix loop (fail) — no manual state surgery in either path; when an AC carries no executable verify command, the verify phase reports that AC as NOT-EXECUTABLE (honest gap, per the feat(setup): constitution with teeth — generated Definition of Done + AC standard replace the boilerplate #943 standard) rather than reasoning it passed.One more datum for the motivation section
The body's 4/4 count can also carry the contrast case: in the same run, the two passing verdicts weren't fully clean either (one AC_MET_BUT_NOT_A_PLUS with an unimplemented AC clause whose command only passed because QA's tests self-seeded the input; one READY_FOR_MERGE with an imageless contact sheet). Verdict-triggered verify on NEEDS_VERIFICATION is the priority, but it's the same underlying gap: verdicts assert what was reasoned, the verify phase asserts what was executed.
admarble commentedon Aug 29, 2026
Scoping note for the implementation run (2026-08-29): this pass implements AC-1, AC-2, AC-3 only (state mapping, MCP force loudness, verdict→state docs). The AC-4 verify-routing extension in the comment above is explicitly sequenced behind #943 (AC-standard constitution) and is out of scope here — do not implement or partially implement it in this PR.
admarble commentedon Aug 29, 2026
Complexity: Standard (3 ACs, 3 directories)
AC Quality Check
All three ACs are clear and measurable. No vague language, no unmeasurable thresholds, no open-ended scope. Linter: 3/3 passed.
Scope Assessment
Non-Goals (from scoping comment 2026-08-29): AC-4 verify-routing (dispatch a
verifyphase on NEEDS_VERIFICATION) is explicitly out of scope — sequenced behind #943. Do not implement or partially implement it here.src/lib/workflow/,src/mcp/tools/,docs/features/)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: NEEDS_VERIFICATION maps to
awaiting_verificationVerification: Integration Test
Scenario: Given a QA phase that emits
Verdict: NEEDS_VERIFICATION→ When the run completes → Thenstate.jsonshowsstatus: "awaiting_verification"for the issue (notready_for_merge), andsequant_statusreturns that distinct status with anextActionhint to re-run the qa phase; and a subsequentsequant run <N> --phases qa(without--force) proceeds instead of skipping.Assumptions: The
awaiting_verificationstatus must be added toIssueStatusSchemaand must NOT appear inCOMPLETED_ISSUE_STATUSES(so the skip-guard inrun-orchestrator.tsdoes not block the re-run).AC-2: MCP
sequant_runacceptsforceVerification: Integration Test
Scenario: Given
sequant_runcalled with{issues: [N], phases: "qa", force: true}→ When the MCP handler builds the CLI args → Then--forceappears in the spawned CLI command (verifiable via test inspection of the args array), and passingforce: truewith a completed issue overrides the skip-guard rather than being silently ignored.Assumptions: The existing CLI
--forceflag inRunOptions/bin/cli.tsalready works; only the MCP schema + arg-forwarding is missing.AC-3: Docs cover verdict → state → re-run policy
Verification: Manual Test
Scenario: Given
docs/features/qa-verdict-workflow-states.mdexists → When a reader looks up any of the four verdicts → Then the doc states (a) whichIssueStatuseach verdict maps to, and (b) whether a re-run is permitted without--force.Assumptions: A new file under
docs/features/is the right location (matches the pattern ofdocs/features/exec-qa-phase-guards.mdfor similar phase-outcome docs).Implementation Plan
Phase 1: State schema + status display (2 files)
src/lib/workflow/state-schema.ts:51–60— Add"awaiting_verification"toIssueStatusSchema. Position it after"waiting_for_human_merge"for conceptual grouping with the other "not-done-but-action-needed" statuses.src/lib/workflow/reconcile.ts:168–178(getNextActionHint) — Addcase "awaiting_verification": return \sequant run ${issue.number} --phases qa`sosequant_status'snextAction` field is actionable instead of falling through to the empty-string default.Phase 2: Verdict → status mapping fix (1 file)
src/lib/workflow/batch-executor.ts:1866–1870— ChangefinalStatusderivation. The variablephaseResultsis already in scope at that line. Extractconst qaVerdict = phaseResults.find((p) => p.phase === "qa")?.verdict;(this same extraction happens again at line 1971 — the earlier one can be shared or duplicated; prefer duplication over premature extraction). Then:Note:
completed-status.tsneed not change —awaiting_verificationis intentionally absent fromCOMPLETED_ISSUE_STATUSES, so the skip-guard inrun-orchestrator.ts:884andchain-resume.ts:26already correctly treats it as incomplete.Phase 3: MCP
forceparam (1 file)src/mcp/tools/run.ts:503–521(runToolInputSchema) — Add:src/mcp/tools/run.ts:542–584(handler) — Destructureforcefrom the input params and add:Place this after the existing
if (qualityLoop)block (line ~579) for consistency.Phase 4: Documentation (1 new file)
docs/features/qa-verdict-workflow-states.md— New file. Minimum required content:--force?READY_FOR_MERGE→ready_for_merge→ No (already done)AC_MET_BUT_NOT_A_PLUS→ready_for_merge→ No (PR is ready, polish skipped)NEEDS_VERIFICATION→awaiting_verification→ Yes (qa re-run permitted; human must execute ACs first)AC_NOT_MET→in_progress→ Yes (fix and re-run)Design Review
Where does this logic belong? The verdict → status mapping lives in
batch-executor.ts'srunPhasesfunction, which already owns thefinalStatusdecision.IssueStatusSchemainstate-schema.tsis the canonical vocabulary. Both are the right layers.Simplest correct approach? Check
qaVerdict === "NEEDS_VERIFICATION"at thefinalStatusbranch inbatch-executor.ts. No new abstraction, no new interface — one conditional. For AC-2, add the param to the schema and pass through to CLI args (same pattern asqualityLoop). For AC-3, a new doc file is the lowest-friction path givendocs/features/exec-qa-phase-guards.mdis the direct precedent.Existing pattern?
waiting_for_human_mergewas added via a similar "verdict inspection at finalStatus" change (fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837). The MCPforcewiring follows thequalityLoopparameter pattern exactly (schema field → conditional CLI arg push).What a senior reviewer will challenge? "Why not make
NEEDS_VERIFICATIONfail the phase (likeAC_NOT_MET) so the quality loop handles it?" —NEEDS_VERIFICATIONmeans QA reasoning succeeded but execution was not witnessed; the quality loop re-runs QA reasoning against the same code without executing ACs, so it can't resolve the gap. The new status signals "pause for real execution," not "fix the code." The loop would spin uselessly.Feature Quality Planning
All standard checks pass. Notable items:
awaiting_verificationmust be verified absent fromCOMPLETED_ISSUE_STATUSES(gate: checkcompleted-status.tsafter the schema edit)chain-resume.tscompleted-status guard uses the sameisCompletedIssueStatusimport — verify it picks up the absence automatically (no separate list)forcetype isboolean | undefined, consistent withqualityLoop— no coercion neededOpen Questions
awaiting_verificationissues be re-runnable for non-qaphases? — The current plan excludesawaiting_verificationfromCOMPLETED_ISSUE_STATUSES, so any phase re-run proceeds. If you only want to permit qa re-runs (exec would redo the implementation), we'd need phase-specific skip logic. Recommendation: exclude from completed (permit all phases). Impact: low — a user explicitly re-running exec on anawaiting_verificationissue is intentional.Recommended Workflow
Phases: exec → qa
Quality Loop: enabled
Reasoning: Three-AC bug fix spanning state schema, orchestration logic, MCP tool, and docs. Quality loop guards against the state-schema change having broader skip-guard implications missed in the first pass.
Label Review
Current:
bugRecommended:
bug,plannedQuality Loop: Will auto-enable (complex enough to warrant a second QA pass)
→
gh issue edit 972 --add-label plannedadmarble commentedon Aug 29, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Aug 29, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Aug 29, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Aug 29, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Aug 29, 2026
Exec Phase Complete
AC Coverage
awaiting_verificationstate, excluded from completed, surfaced in statusstate-schema.ts:55,batch-executor.ts:1866–1873,reconcile.ts:163,status.ts:119,264sequant_runacceptsforce, forwards--forceto CLIsrc/mcp/tools/run.ts:517–524, 583–585docs/features/qa-verdict-workflow-states.md— verdict→state table + re-run policydocs/features/qa-verdict-workflow-states.mdFiles Changed
src/lib/workflow/state-schema.ts— addawaiting_verificationtoIssueStatusSchemasrc/lib/workflow/batch-executor.ts— deriveawaiting_verificationwhenqaVerdict === "NEEDS_VERIFICATION"src/lib/workflow/reconcile.ts— addnextActionhint forawaiting_verificationsrc/commands/status.ts— add color + priority-order entry forawaiting_verificationdashboard/server.ts— addawaiting_verificationto exhaustivebyStatusrecordsrc/mcp/tools/run.ts— addforceparam to schema + arg forwardingdocs/features/qa-verdict-workflow-states.md— new docs file (AC-3)src/lib/workflow/batch-executor.test.ts— 2 new tests for state mappingsrc/lib/workflow/reconcile.test.ts— 1 new test forawaiting_verificationhintsrc/mcp/server-extended.test.ts— 2 new tests forforcearg forwardingBuild / Lint / Tests
npm run buildnpm run lintwithActivityHookfailuremain(confirmed via stash)Quality Plan Alignment
Quality Plan Alignment: N/A — No quality plan section in spec comment.
Notable:
awaiting_verificationcorrectly absent fromCOMPLETED_ISSUE_STATUSES(verified incompleted-status.ts), sochain-resume.tsandrun-orchestrator.tsskip-guards both pick up the non-completed treatment automatically without further changes.PR
#977
admarble commentedon Aug 29, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Aug 29, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Aug 29, 2026
QA Review for Issue #972
AC Coverage
awaiting_verificationstate, excluded from "already completed" skipping for qa, surfaced distinctly insequant_statusstate-schema.ts:56adds the enum;batch-executor.ts:1866-1873mapsqaVerdict === "NEEDS_VERIFICATION"→awaiting_verification; absent fromCOMPLETED_ISSUE_STATUSES(completed-status.ts:41-45) so the skip-guard atrun-orchestrator.ts:884/chain-resume.ts:113does not fire;reconcile.ts:162givessequant_statusanextActionhint;status.tsadds display color + order. Production path confirmed:phase-executor.ts:970-979returnssuccess:truefor NEEDS_VERIFICATION, so the mapping fires in prod, not just under mocks.sequant_runacceptsforce; forwards to CLIrun.ts:517-524adds the zodforceboolean;run.ts:590-592pushes--force. Forwarding target verified:runcommand registers-f, --forceatbin/cli.ts:409("bypass pre-flight state guard"), consumed atrun-orchestrator.ts:785. Silent-ignore eliminated.docs/features/qa-verdict-workflow-states.md: table maps all four verdicts to theirIssueStatusand states re-run-without---forceper verdict; prose accurate against code (READY_FOR_MERGE/AC_MET_BUT_NOT_A_PLUS→ready_for_merge, NEEDS_VERIFICATION→awaiting_verification, AC_NOT_MET→in_progress).Coverage: 3/3 AC items fully met. Non-goal (AC-4 verify-routing) correctly not implemented.
CI Status
build (22.x)typecheckvalidate-skillsvalidate-pluginnode-floor-guardtautology-advisoryCI Summary: 6 passed, 0 pending, 0 failed (waited for
build (22.x)to settle before verdict).Quality Metrics
any)Sub-agent checks: type-safety PASS, scope SMALL/SCOPE_OK, security PASS (the
forceboolean is zod-validated and pushes a static"--force"string — no injection surface).Test Coverage Analysis
batch-executor.ts(finalStatus mapping)batch-executor.test.ts(#972 describe: NEEDS_VERIFICATION→awaiting_verification, READY_FOR_MERGE→ready_for_merge)reconcile.ts(nextAction hint)reconcile.test.ts(awaiting_verification hint + all-statuses edge case)run.ts(MCP force)server-extended.test.ts(force:true adds--force, force:false does not)state-schema.tsstatus.ts/dashboard/server.tsRecordenforced by compiler)All new tests pass locally (4 targeted + 2 batch-executor).
Code Review
Strengths:
finalStatusderivation site, one zod field + one arg-push, one enum value, one docs file.awaiting_verificationcorrectly excluded fromCOMPLETED_ISSUE_STATUSES, so both skip-guards (run-orchestrator.ts,chain-resume.ts) pick up the non-completed treatment via the sharedisCompletedIssueStatuspredicate — no second list to keep in sync.Recordcompile errors were correctly resolved in bothstatus.tsanddashboard/server.ts.reconcile.tshint uses--phases qa(the registered flag atbin/cli.ts:274), which is actually more correct than the pre-existingwaiting_for_qa_gatehint's--phase qa.Issues:
[Unreleased]entry for this user-facing change (new MCPforceparam + new status). Demotes from READY_FOR_MERGE per the §10a gate.state-rebuild.ts:118mapsissueLog.status === "success"→"ready_for_merge"unconditionally. Because a NEEDS_VERIFICATION run logs issuestatus: "success", rebuildingstate.jsonfrom run logs would re-introduce the AC-1 bug in that recovery path. Outside AC-1's literal scope (primary run→state write +sequant_status, both fixed) — recommend a follow-up issue rather than widening this PR.Suggestions:
[Unreleased]entry before merge.state-rebuild.tsNEEDS_VERIFICATION mapping (the run-log schema would need to carry the qa verdict to reconstructawaiting_verification).CHANGELOG Verification
fix(#972)commit)Result: Missing entry for user-facing changes — add to
## [Unreleased]before merging.Trust-Boundary Check
Finding: Clean — diff implements only the three product ACs; no agent-directed instruction from issue/comment text was acted on. The
forceparam traces to AC-2's stated requirement, and the scoping comment ("implement AC-1/2/3 only") was honored (AC-4 not implemented).Status: Clean
Risk Assessment
state.jsonis lost and rebuilt from run logs, a prior NEEDS_VERIFICATION issue would be resurrected asready_for_merge(seestate-rebuild.ts:118) — the recovery path, not the primary path, which is correct.state-rebuild.tsNEEDS_VERIFICATION handling (untouched by this PR);status.ts/dashboarddisplay of the new status has no dedicated assertion (compiler-enforced exhaustiveness only).state-rebuild.ts:118(issueLog.status === "success"→ready_for_merge) — real cross-file sibling of the same root cause; recommended as a follow-up, non-blocking.finalStatusderivation is a single site; the QA-verdict comment paths (batch-executor.ts:~1971, bug(run): orchestrated 'sequant run --phases qa' re-run computes a fresh verdict but never posts it, contradicting the stale comment left visible #964 compact comment) read the verdict but do not write issue status, so no intra-file survivor.Adversarial Re-Read
Findings: Traced the full production data-flow (phase-executor verdict→success semantics → batch-executor finalStatus → state write; skip-guard exclusion; MCP→CLI
--forceforwarding target exists) rather than trusting the AC descriptions. Ran the new tests. Surfaced two real gaps the structured pipeline flagged: the missing CHANGELOG entry and thestate-rebuild.tscross-file sibling site. Neither is a severe gap — no unrun verbatim fixture, no evidence-claim-that-is-a-repro, and no AC marked MET without the verification its text required (AC-3's manual doc check was performed; AC-1/AC-2 are integration-tested).Status: Gaps Found
Verdict: AC_MET_BUT_NOT_A_PLUS
All three in-scope ACs are fully MET with correct production data-flow, clean CI (6/6), zero type/security/scope issues, and passing tests. Two non-A+ items hold it back from READY_FOR_MERGE:
[Unreleased]entry for a user-facing change (§10a gate demotes the verdict).state-rebuild.ts:118) that would re-introduce the bug in the state-recovery path — out of AC-1's literal scope, recommended as a follow-up.Per break-to-PR policy, this does not feed the quality loop — address the CHANGELOG entry and (optionally) file the follow-up, then merge.
Documentation
docs/features/qa-verdict-workflow-states.md)[Unreleased]entry — needed before mergeNext Steps
[Unreleased]entry, e.g. under### Fixed: "NEEDS_VERIFICATION QA verdict now maps toawaiting_verification(unblocks qa re-runs); MCPsequant_runacceptsforce(NEEDS_VERIFICATION maps to ready_for_merge, blocking QA re-runs; MCP sequant_run ignores force #972)."state-rebuild.tsreconstructawaiting_verificationfor NEEDS_VERIFICATION runs — requires the run-log schema to carry the per-issue qa verdict.Structured Gap Findings
admarble commentedon Aug 29, 2026
QA Verdict: NEEDS_VERIFICATION
AC coverage: 3/3 met
531 remaining items
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Sep 20, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Sep 20, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Sep 20, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Sep 20, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Sep 20, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Sep 20, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE
admarble commentedon Sep 20, 2026
QA Verdict: NEEDS_VERIFICATION
admarble commentedon Sep 20, 2026
QA Verdict: READY_FOR_MERGE