Repository navigation
Description
Summary
A QA verdict of AC_MET_BUT_NOT_A_PLUS is treated as a phase failure in the sequant run path. With -Q (quality loop) this feeds the loop, fails repeatedly, and exits with status=failure and no PR — even though acceptance criteria are met. Documented/expected behavior is to break out and proceed to PR (do NOT run /loop on it).
Repro / evidence
sequant run 125 126 --chain --qa-gate -Q --testgen
#126 phase sequence from the run log:
spec(success) → testgen(success) → exec(success) → test(success)
→ qa(FAILURE, verdict=AC_MET_BUT_NOT_A_PLUS)
→ testgen(FAILURE 38s) → testgen(FAILURE 5s)
→ status=failure, no PR
By contrast #125's QA returned NEEDS_VERIFICATION and did ship PR #127.
Root cause (single load-bearing line)
src/lib/workflow/phase-executor.ts:396-412, mapAgentSuccessToPhaseResult():
if (verdict && verdict !== "READY_FOR_MERGE" && verdict !== "NEEDS_VERIFICATION") {
return { phase, success: false, error: `QA verdict: ${verdict}`, ... };
}The success allowlist is only {READY_FOR_MERGE, NEEDS_VERIFICATION}. AC_MET_BUT_NOT_A_PLUS falls through to success: false. That asymmetry is exactly why #125 (NEEDS_VERIFICATION) shipped while #126 (AC_MET_BUT_NOT_A_PLUS) failed.
Cascade (downstream routers are correct given the wrong input)
batch-executor.ts:1010-1090: non-success qa setsphasesFailed=true; with-Qanditeration < maxIterations, spawns/loopand restarts the pipeline.- Each iteration re-runs phases from index 0. Because
--testgendoesphases.unshift("testgen")(batch-executor.ts:759), each retry starts with testgen — these are the two trailingtestgenfailures (loop iterations 2 and 3), not qa retries. batch-executor.ts:1095-1115:successonly true if an iteration finishes with zero failures; it never does → statein_progress, no checkpoint, no rebase, no PR (shouldCreatePR, line 1160 false).run-orchestrator.ts:1002-1009: with--qa-gate --chain, the qa-non-success also breaks the chain.
Correct logic already exists
src/lib/workflow/ready-gate.ts:155-162 (the ac policy) already treats AC_MET_BUT_NOT_A_PLUS as a stopping/ready state. But that gate is only wired into sequant ready (#683), not sequant run. The two engines disagree.
This also matches the project's documented policy: AC_MET_BUT_NOT_A_PLUS → break to PR; /loop is for AC_NOT_MET only.
Bug is locked by a test
src/lib/workflow/phase-executor.test.ts:1557 ("fails on AC_MET_BUT_NOT_A_PLUS verdict (existing behavior preserved)") asserts success === false. Any fix must update this. src/commands/run.test.ts:1282-1292 also asserts the buggy behavior.
Fix
- Add
AC_MET_BUT_NOT_A_PLUSto the success allowlist atphase-executor.ts:396(keepverdicton the result so the PR/log surfaces the "not A+" note). OnlyAC_NOT_METand null/unparseable (fix(orchestrator): treat null QA verdict and zero-diff exec as failure, not success #534) should remain hard failures. - Optionally gate on policy (
acvsa-plus) mirroringready-gateso an explicit "push to A+" mode can still loop; the documented default is break-to-PR. - Flip
phase-executor.test.ts:1557and add a positive assertion that the run path proceeds to PR onAC_MET_BUT_NOT_A_PLUS.
Acceptance criteria
-
sequant runwith QA verdictAC_MET_BUT_NOT_A_PLUSbreaks out and proceeds to PR instead of entering the quality loop / failing. -
--qa-gate --chainis not broken by anAC_MET_BUT_NOT_A_PLUSpredecessor verdict. -
AC_NOT_METand null/unparseable verdicts still hard-fail. - Tests updated:
phase-executor.test.ts:1557flipped + positive break-to-PR assertion;run.test.ts:1282-1292reconciled.
Related
Refines #218 and #534 (the deliberate-failure decisions being revised) and mirrors #683 / ready-gate.ts (which already implements the correct "stop at AC-met" policy for sequant ready).
Activity
admarble commentedon Jun 28, 2026
→ PROCEED —
AC_MET_BUT_NOT_A_PLUSmisrouted into quality loop → no PR; single load-bearing line atphase-executor.ts:396, correct policy already inready-gate.ts.Workflow:
exec → qa(skip spec — bug label, root cause + fix pinpointed). Quality loop on.⚠ Must flip locking tests that assert the buggy behavior:
phase-executor.test.ts:1557,run.test.ts:1282-1292.⚠ Overlaps #748 on
batch-executor.ts+run-orchestrator.ts— run sequentially.admarble commentedon Jun 29, 2026
Complexity: Standard (4 ACs, 2 directories)
AC Quality Check
All four ACs are measurable and reference concrete code/tests. One correction to the issue body itself:
run.test.ts:1282-1292as asserting the buggy behavior — it does not. Those lines (and 1192-1193) areparseQaVerdictparser tests; they assert the verdict string parses correctly, not that the run path breaks to the loop. There is no routing-behavior assertion to reconcile inrun.test.ts. AC-4'srun.test.tsclause is effectively a no-op — verify, don't edit.Scope Assessment
Non-Goals: Not stated explicitly. Inferred boundary: this fix does not introduce an explicit
a-plus"keep looping" policy into the run path (that would require plumbingReadyPolicyfromrun.ts→batch-executor→phase-executor, which does not exist today). The issue lists that as "optional" — recommend deferring to a follow-up.src/lib/workflow,src/commands)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1:
sequant runwith QA verdictAC_MET_BUT_NOT_A_PLUSbreaks to PR instead of entering the quality loop / failingVerification: Unit Test
Scenario: Given a qa
AgentPhaseResultwhose output parses toAC_MET_BUT_NOT_A_PLUS→ WhenmapAgentSuccessToPhaseResult("qa", …)runs → Then it returnssuccess: truewithverdict: "AC_MET_BUT_NOT_A_PLUS"retained on the result.Assumptions: Every downstream router (batch-executor loop trigger, chain-break,
shouldCreatePR) keys offresult.successonly — verified: flipping the mapping is sufficient to reach PR creation; no router changes needed.AC-2:
--qa-gate --chainis not broken by anAC_MET_BUT_NOT_A_PLUSpredecessor verdictVerification: Integration Test
Scenario: Given a chain where the predecessor's qa returns
AC_MET_BUT_NOT_A_PLUS→ When--qa-gate --chainevaluates whether to continue → Then the chain proceeds (predecessor counts as a successful gate).Assumptions: Satisfied as a consequence of AC-1 —
run-orchestratorbreaks the chain on qa non-success; once the qa PhaseResult issuccess: true, the gate passes. Confirm with a focused test rather than relying on transitivity alone.AC-3:
AC_NOT_METand null/unparseable verdicts still hard-failVerification: Unit Test
Scenario: Given qa output parsing to
AC_NOT_MET, OR empty/unparseable output (null verdict, #534) → When mapped → Thensuccess: falsewith the existing error strings preserved.Assumptions: The fix narrows the failing branch from "anything not in
{READY_FOR_MERGE, NEEDS_VERIFICATION}" to "AC_NOT_MET(+ null branch unchanged)". Existing #534 null-verdict tests must stay green untouched.AC-4: Tests updated
Verification: Unit Test
Scenario:
phase-executor.test.ts:1557("fails on AC_MET_BUT_NOT_A_PLUS … existing behavior preserved") is flipped to assertsuccess === true+verdict === "AC_MET_BUT_NOT_A_PLUS", renamed to reflect new behavior; add a positive assertion that the run path proceeds to PR (success drivesshouldCreatePR).run.test.ts— verify the AC_MET parser tests still pass; no routing assertion exists there to change (see AC Quality Check).Assumptions: Renaming the test string keeps the locking test honest rather than leaving a now-misleading name.
Implementation Plan
Phase 1: Flip the allowlist (single load-bearing line)
src/lib/workflow/phase-executor.ts:396-412— narrow the failing condition so onlyAC_NOT_MET(verdict-present) hard-fails. Replace theverdict !== "READY_FOR_MERGE" && verdict !== "NEEDS_VERIFICATION"guard with an explicitverdict === "AC_NOT_MET"check. Keep the separate null-verdict branch (413-425, fix(orchestrator): treat null QA verdict and zero-diff exec as failure, not success #534) exactly as-is.verdict(andsummary) on thesuccess: trueresult so the PR body / run log can surface the "not A+" note. Confirm the success branch (426+) already carriesverdict.Phase 2: Reconcile tests
src/lib/workflow/phase-executor.test.ts:1557— flip the assertion tosuccess === true, assertverdict === "AC_MET_BUT_NOT_A_PLUS", rename theit(...)title (e.g. "treats AC_MET_BUT_NOT_A_PLUS as success → break to PR").success: trueqa result is whatshouldCreatePRconsumes to ship a PR — or a focused batch/orchestrator-level test that anAC_MET_BUT_NOT_A_PLUSpredecessor does not break a--qa-gate --chain(covers AC-2).src/commands/run.test.ts— run the suite; confirm the parser tests (1192-1193, 1282-1292) stay green. No edit expected.Phase 3: Verify
npm test -- phase-executorand the chain/qa-gate tests; confirmAC_NOT_MET+ null-verdict (fix(orchestrator): treat null QA verdict and zero-diff exec as failure, not success #534) tests remain red-on-failure / green-on-pass unchanged.Design Review
mapAgentSuccessToPhaseResult(phase-executor) — it is the single translation point. Correct location; the fix stays there.AC_NOT_METfailure check. Rejected: plumbingReadyPolicyinto phase-executor to mirrorready-gate— more correct long-term but adds a parameter throughrun.ts → batch-executor → phase-executor; not needed for the documented default (break-to-PR). Defer.ready-gate.ts:155-162isAtThreshold—AC_MET_BUT_NOT_A_PLUSis a stopping state under theacpolicy. This change makes the run path agree with the already-correctsequant readypath.AC_NOT_METcheck instead of a new allowlist member?" — because the set of stopping verdicts is open-ended and the set of hard-failures is closed (AC_NOT_MET+ null); an explicit fail-list is more robust to future verdict additions. Also: "ShouldNEEDS_VERIFICATIONreally still be success here whileready-gatesays it never stops?" — out of scope; flag as Open Question, don't change.Feature Quality Planning
All standard checks pass. Notable items:
phase-executortreatsNEEDS_VERIFICATIONas success;ready-gate.isAtThresholdsaysNEEDS_VERIFICATIONnever stops. This asymmetry predates fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 and is why feat(#116): add sequant dashboard CLI command #125 shipped. Not in scope — surface as Open Question, do not "fix" silently.Open Questions
a-pluspolicy gate be implemented now? — Recommendation: No, follow-up issue. NoReadyPolicyplumbing exists in the run path; the documented default is break-to-PR. Impact if wrong: users wanting "push to A+" looping have no opt-in until the follow-up lands.NEEDS_VERIFICATIONdivergence betweenphase-executor(success) andready-gate(never-stop) — Recommendation: leave as-is for fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749; file a follow-up to reconcile the two engines' verdict semantics. Impact: cosmetic until someone relies on one engine's behavior in the other's context.Recommended Workflow
Phases: exec → qa
Quality Loop: enabled
Reasoning: Bug label, root cause + fix pinpointed — skip spec/testgen (test changes are edits to existing tests, not new stubs). The fix is exactly the kind of qa-verdict routing this issue corrects; quality loop is safe here because the ACs are crisp and test-locked.
Label Review
Current: bug, qa, multi-agent
Recommended: bug, qa, multi-agent, planned
Reason: Labels accurately reflect a qa-path bug fix. No
complex/refactorwarranted (single line + test reconcile). Quality loop won't auto-enable from scope (SCOPE_OK) — enable it explicitly via-qas the assess comment recommends.Quality Loop: Won't auto-enable (scope is green); pass
-qexplicitly.→
gh issue edit 749 --add-label planned--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
Plan — exec → qa (Standard, SCOPE_OK)
The fix is the single load-bearing line at
phase-executor.ts:396-412. Downstream routers (batch loop trigger, chain-break,shouldCreatePR) all key offresult.success, so flipping the mapping fixes AC-1 and AC-2 together; AC-3 stays a hard fail by narrowing the guard to an explicitAC_NOT_METcheck (null/#534 branch untouched).ACs
mapAgentSuccessToPhaseResultreturnssuccess: true(verdict retained) forAC_MET_BUT_NOT_A_PLUS; run path reaches PR. (Unit)--qa-gate --chainproceeds past anAC_MET_BUT_NOT_A_PLUSpredecessor. (Integration; follows from AC-1, confirm with focused test)AC_NOT_METand null/unparseable verdicts still hard-fail (existing error strings + fix(orchestrator): treat null QA verdict and zero-diff exec as failure, not success #534 tests preserved). (Unit)phase-executor.test.ts:1557flipped + renamed, positive break-to-PR assertion added. (Unit)Correction:
run.test.ts:1282-1292areparseQaVerdictparser tests, not routing assertions — they need no change, only re-verification. AC-4's run.test.ts clause is a no-op.Deferred (follow-ups, not this issue):
a-pluspolicy gate (requiresReadyPolicyplumbing through the run path; not present today).NEEDS_VERIFICATIONsemantics diverge betweenphase-executor(success) andready-gate(never-stop) — pre-existing, file separately.Note: #748 already merged (
fd9b67e); the assess "run sequentially / overlap on batch-executor + run-orchestrator" warning is moot — the fix touches onlyphase-executor.ts+ its test.Run:
npx sequant run 749 -q --phases exec,qaadmarble commentedon Jun 29, 2026
Exec Complete — PR #753
The single load-bearing line at
phase-executor.ts:396is fixed: the qa failing branch is narrowed from "any verdict outside{READY_FOR_MERGE, NEEDS_VERIFICATION}" to an explicitverdict === "AC_NOT_MET"check.AC_MET_BUT_NOT_A_PLUSnow returnssuccess: true(verdict retained), so the run breaks to PR instead of feeding the quality loop. The #534 null/unparseable branch is untouched.AC Coverage
runbreaks to PR onAC_MET_BUT_NOT_A_PLUS--qa-gate --chainnot broken by such a predecessorresult.success); focused test applies therun-orchestrator.ts:1077predicateAC_NOT_MET+ null/unparseable still hard-failAC_NOT_METbranch + #534 null branch preservedphase-executor.test.tslocking test flipped + renamed + positive assertions;run.test.ts1192-1193/1282-1292 confirmed parser-only (no edit — matches /spec correction)Files changed
src/lib/workflow/phase-executor.ts— narrow qa fail branch toAC_NOT_METsrc/lib/workflow/phase-executor.test.ts— flip locking test, add AC-2 chain-gate assertionCHANGELOG.md—[Unreleased] → FixedentryGates
npm run build✅ ·npm run lint✅ ·phase-executor.test.ts127 ✅ ·run.test.ts143 ✅Deferred (out of scope)
a-plus"keep looping" policy gate (needsReadyPolicyplumbing through the run path; absent today).NEEDS_VERIFICATIONsemantic divergence betweenphase-executor(success) andready-gate(never-stop) — pre-existing.admarble commentedon Jun 29, 2026
QA Review for Issue #749 (Simple Fix)
Size Gate
AC Coverage
runwithAC_MET_BUT_NOT_A_PLUSbreaks to PR instead of looping/failingphase-executor.ts:396now returnssuccess: truewith verdict retained; test "treats AC_MET_BUT_NOT_A_PLUS as success → break to PR (#749)" asserts it.--qa-gate --chainnot broken by anAC_MET_BUT_NOT_A_PLUSpredecessorrun-orchestrator.ts:1076-1080) keys offresult.success; qa is now success. Focused test applies the exactp.phase === "qa" && !p.successpredicate →false.AC_NOT_METand null/unparseable verdicts still hard-failverdict === "AC_NOT_MET"; #534 null branch untouched. Adversarially confirmedparseQaVerdictcan return only the 4 enum literals ornull(regex capture group is constrained), so no unknown string can silently become success.run.test.tsreconciledrun.test.ts1192-1193/1282-1292 are parser-only (no routing assertion) — verified unchanged, 143 pass.Coverage: 4/4 AC items fully met
Quality Metrics
any)Tests: net +1 (
AC_MET_BUT_NOT_A_PLUStest renamed in place; one new AC-2 chain-gate test added).CI Status
build (22.x)typechecknode-floor-guardvalidate-pluginvalidate-skillsCI Summary: 5 passed, 0 pending, 0 failed (waited for build matrix to finish before verdict).
Code Review
Strengths:
AC_NOT_MET+ null), which is the more robust shape: new stopping-state verdicts fail open (break to PR) rather than being silently misrouted into the loop.success: trueresult, so the PR/run-log surfaces the "not A+" note as the issue required.ready-gate.tsso the asymmetry rationale survives in-tree.Issues: None.
Suggestions:
QaVerdictSchemawould default to success unless explicitly added to the fail branch. Acceptable given a verdict addition is a schema change that forces review; worth a one-line comment if the enum grows.Test Coverage Analysis
src/lib/workflow/phase-executor.tsphase-executor.test.ts(127 pass)src/lib/workflow/phase-executor.test.tsCHANGELOG.mdCoverage: 1/1 changed source file has corresponding tests.
Anti-Pattern Detection
No anti-patterns in the diff (no
any, no empty catch, no secrets, no loop-await, no uncleared timers).CHANGELOG Verification
fix(#749)commit)[Unreleased] → FixedentryResult: CHANGELOG requirements met.
Risk Assessment
AC_NOT_METbranch. Deliberate, documented tradeoff — fails open toward shipping rather than toward the loop trap this issue fixes.shouldCreatePR, orchestrator chain loop) is not exercised end-to-end; AC-1/AC-2 are verified at the mapping-function + predicate level. Spec explicitly deferred a full orchestrator harness as disproportionate to a one-line routing fix.mapAgentSuccessToPhaseResult.ready-gate.ts's parallelacpolicy is the correct reference, not a co-bugged sibling.Adversarial Re-Read
Findings: No gaps. Walked the core logic adversarially: (1) traced
parseQaVerdict— its regex capture group is constrained to the 4QaVerdictSchemaliterals, so theas QaVerdictcast is sound and no unknown-but-truthy string can reach the success branch (the one real risk of inverting an allowlist into a fail-list); (2) confirmed the #534 null branch is byte-for-byte unchanged, preserving AC-3's "unparseable hard-fails"; (3) confirmed the success branch already carriedverdict/summaryso the "not A+" note survives; (4) re-ran the AC_MET parser tests inrun.test.ts(143 pass) to confirm AC-4's no-edit claim; (5) no Non-Goal scope creep — only the qa branch changed.Status: Clean
Verdict: READY_FOR_MERGE
All 4 ACs MET, all CI green, build/lint/tests pass locally, no type/security/anti-pattern issues, test coverage increased, CHANGELOG entry present. The fix matches the spec's pinpointed root cause exactly and the guard inversion is provably exhaustive against the verdict enum.
Documentation: Before merging, optionally run
/docs 749— though this is an internal routing fix with a CHANGELOG entry already in place, so dedicated docs are not required.Next Steps
./scripts/cleanup-worktree.shafter merge to free the worktree/branch.fix(#749): surface non-A+ QA verdict in PR body + cover run-path brea…
fix(#749): AC_MET_BUT_NOT_A_PLUS QA verdict breaks to PR instead of l…
chore(assess): drop dead --qa-gate from chain suggestions; date the 1…
chore(#795): deprecate --qa-gate, an inert no-op flag (#807)
feat(#817): --ready-gate — run the post-QA ready gate inside `sequant…
268 remaining items
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
admarble commentedon Sep 20, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS