Repository navigation
Description
Epic: graph-2026-11-simplify Tier: judgment Execution: split Blocked by: #1645
Problem
D-2: keep maxIterations 3 and halt when AC_NOT_MET repeats (the #1162 rule). On matcha-maps #1162 the loop ran four exec passes into four AC_NOT_MET verdicts and fixed nothing; on fixture #34 (E7) one fix pass turned the verdict's named catch into a commit in 8 of 8 pairs. One pass on a refusal is supported; a second pass after a second refusal is not.
Today the only stop on that pattern is the divergence-suspect halt in batch-executor.ts (two consecutive divergence-suspect iterations), and its own comment says it is "reachable only with a ladder configured". D-1 removes the ladder in #1647, which deletes the halt's feed. qa-stagnation.ts stops a re-run at the same SHA with no diff, which is not #1162's pattern (each pass made a diff). Founding doc §4, P-1, P-2, P-3.
Decisions
| ID | Decision | Rejected |
|---|---|---|
| H-1 | A counter on the QA verdict in the quality loop: two consecutive AC_NOT_MET verdicts stop the loop before the next /loop spawn. Any other verdict, or no parsed verdict, resets it |
reusing consecutiveDivergenceSuspect (fed only with a ladder; #1647 deletes the feed) |
| H-2 | The run log records the stop the way #1254 records a ladder halt: the issue's abortReason begins ac_not_met_repeated, its evidenceBundle carries both verdicts' SHAs and failed AC ids, and the error category enum gains ac_not_met_repeated beside ladder_halt (additive, version: 1) |
a new bundle format or top-level field |
| H-3 | sequant run and MCP sequant_run (same executor) only; the ready gate's loop is unchanged (D-2) |
applying it to the ready gate |
Prior fixes / producers
- Prior halts on the same loop: bug(fullsolve): QA loop re-runs /qa with no state change instead of escalating same-SHA same-verdict cycles #581 (
qa-stagnation.ts, same SHA / no diff), feat(run): SPEC_DIVERGENCE escape hatch, ladder halts with evidence bundles, docs, rigged real run (#971 part B) #995 and feat(run): model escalation ladder on capability-bound non-convergence #971 (divergence-suspect andSPEC_DIVERGENCE,divergence-halt.ts), fix(run): a ladder halt is recorded nowhere: the halting phase reads success, failureCategory is empty, and the bundle exists only on stdout #1254 (ladder_haltpersisted in the run log), the turn cap and the billing window (haltedByBilling).git log --format='%h %ad %s' -S 'consecutiveDivergenceSuspect' -- src/lib/workflow/batch-executor.tslists the feat(run): SPEC_DIVERGENCE escape hatch, ladder halts with evidence bundles, docs, rigged real run (#971 part B) #995 commit. - Producers of the loop's stop decision:
batch-executor.ts(the outerwhile (iteration < maxIterations)at :2120 and the halt flags on the iteration state),ready-gate.ts(its own loop, out of scope). Class: the ACs state the outcome for every path throughsequant run's quality loop.
Acceptance Criteria
- AC-1: Two consecutive
AC_NOT_METverdicts stop the loop with halt reasonac_not_met_repeated, with no ladder configured, and a singleAC_NOT_METfollowed by a passing verdict does not; a null verdict between two refusals resets the count. Evidence:npx vitest run src/lib/workflow/batch-executor.repeat-halt.test.ts→≥ 4 passed, 0 failed - AC-2: The run log schema accepts the
ac_not_met_repeatedcategory with itsabortReasonandevidenceBundle, and every existing run log fixture still validates. Evidence:npx vitest run src/lib/workflow/run-log-schema.test.ts -t "ac_not_met_repeated"→≥ 1 passed, 0 failed - AC-3: The default stays 3. Evidence:
grep -c 'maxIterations: z.number().positive().default(3)' src/lib/settings.ts→1(constraint) - AC-4: The run command reference documents the halt. Evidence:
grep -c 'ac_not_met_repeated' docs/reference/run-command.md→≥ 1 - AC-5: The changelog records the change. Evidence:
awk '/^## \[Unreleased\]/,/^## \[[0-9]/' CHANGELOG.md | grep -c 'ac_not_met_repeated'→≥ 1 - AC-6: No skill-directory edits. Evidence:
git diff --name-only $(git merge-base origin/main HEAD)..HEAD | grep -cE '^(plugin/|\.claude/skills/|templates/skills/)'→0(constraint)
isGateTestEvidence classifies none of these ACs as a gate (parse-check, 2026-11-04). AC-1 is behaviour; its real-run half is #1655 (Execution: split).
May touch
src/lib/workflow/batch-executor.ts (the quality loop and its iteration state only), src/lib/workflow/batch-executor.repeat-halt.test.ts (new), src/lib/workflow/run-log-schema.ts and test, src/lib/workflow/log-writer.ts, src/lib/workflow/types.ts, docs/reference/run-command.md (the quality-loop section only), CHANGELOG.
Non-Goals
- Changing
maxIterations' default, the ready gate's loop, orqa-stagnation.ts. - Removing the ladder (chore(cli)!: remove the model ladder and effort escalation — modules,
--model-ladderand--escalate-efforton run and ready, their settings and docs; old logs and settings still load #1647, which this blocks). - Any skill edit (I-1).
Done when
A sequant run -Q whose QA refuses twice in a row stops after the second refusal and says why in the run log, with no ladder configured.
Activity
admarble commentedon Nov 8, 2026
Runner context (graph-2026-11-simplify W1, 2026-11-07). Read this before planning.
docs/internal/graph-2026-11-simplify/PROJECT-DISCUSSION.mdonmain(7337cdd39). Invariants I-1 to I-7 bind this issue. I-1: no edits underplugin/,.claude/skills/ortemplates/skills/. The freeze lifted on 2026-11-06, but I-1 stays this graph's scope.timeout, after a WIP commit. Run targetednpx vitest run <file>for everything else. Every MCP or CLI phase has a 30-minute wall.Evidence:command is run verbatim by QA and by the runner. Run them yourself before reporting done; don't reason them done.Mutation-verified:record in the PR body (CLAUDE.md). Usesequant mutation begin | check | renderwhere it fits.changelog.d/) is open and active. If it has merged onmainwhen you start, followchangelog.d/README.mdinstead of editingCHANGELOG.md, and say in the PR body that the changelog AC needs rewording. The runner rewords it on the issue; don't skip the entry.ladderStateanditerationStartSnapshot(founding doc P-1, P-2). chore(cli)!: remove the model ladder and effort escalation — modules,--model-ladderand--escalate-efforton run and ready, their settings and docs; old logs and settings still load #1647 deletes the ladder next and needs this halt to stand on its own. The ready gate's loop is out of scope (H-3). If the cleanest owner of "stop the loop" turns out to be somewhere other than the quality loop inbatch-executor.ts, stop and surface it in the spec comment; don't patch locally..sequant/logs/that hold two consecutiveAC_NOT_METqa verdicts in one issue's loop, and put the count and the command in the PR body. No AC depends on it.admarble commentedon Nov 8, 2026
Complexity: Standard (6 ACs, 3 directories)
AC Quality Check
lintAcceptanceCriteria: 6/6 pass. All six declareEvidence:. Baseline onmain7337cdd39: AC-1 fails today (the test file does not exist). AC-2 fails today (-t "ac_not_met_repeated"matches 0 tests, so 83 are skipped). AC-4 and AC-5 return0. AC-3 and AC-6 are constraints that pass today, as the issue says. None of the Evidence commands is vacuous.Scope Assessment
Non-Goals: present (no change to the
maxIterationsdefault, the ready gate orqa-stagnation.ts; no ladder removal; no skill edits).src/lib/workflow,docs/reference, root)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: two consecutive
AC_NOT_METverdicts halt the loop; a recovery or a null verdict resets the countVerification: Unit Test (
batch-executor.repeat-halt.test.ts, new, usingrunIssueWithLoggingwith a mocked phase executor and nomodelLadder)Scenarios (≥ 4 cases):
AC_NOT_MET,AC_NOT_MET→ the run stops after the 2nd verdict./loopis dispatched once, not twice.failureCategory === "ac_not_met_repeated",abortReasonstarts withac_not_met_repeated, and the bundle has 2 iterations with SHAs and failed AC ids.AC_NOT_METand thenREADY_FOR_MERGE→ success, with no halt fields.AC_NOT_MET, then a qa result with no parsed verdict, thenAC_NOT_MET(withmaxIterations: 4) → no halt. The count was reset.Assumptions:
/loopdispatch can be counted through the injected executor, asbatch-executor.model-ladder.test.tsdoes.AC-2: the run-log schema accepts
ac_not_met_repeatedVerification: Unit Test in
run-log-schema.test.ts, with a describe/it title that containsac_not_met_repeated. It parses anIssueLogwith thatabortReasonand the new bundle, and anerrorContext.categoryofac_not_met_repeated. The existing fixtures and theERROR_CATEGORIESparity test (:479) stay green.AC-3: the default stays 3
Verification: constraint grep. Do not touch
src/lib/settings.ts:598.AC-4 / AC-5: docs and changelog
Verification: grep. Add one paragraph under
### Quality Loop Modeindocs/reference/run-command.md, and one### Changedentry inCHANGELOG.md[Unreleased](#1370 is still open).AC-6: no skill-directory edits
Verification: constraint grep (I-1).
Implementation Plan
Phase 1: types and schema (additive,
version: 1)error-classifier.ts: add"ac_not_met_repeated"toERROR_CATEGORIES, and update its doc comment.run-log-schema.ts: add the same value to the inlinecategoryenum (:144).metrics-schema.tsderives fromERROR_CATEGORIES, so it needs no edit.divergence-halt.ts: add"AC_NOT_MET_REPEATED"to the halt-reason union, and add itsREASON_HEADLINEandREASON_NEXT_STEPstrings. Add an optionalfailedAcs?: string[]toDivergenceIterationRecord.run-log-schema.tsEvidenceBundleSchema: add the reason to the enum and addfailedAcsas optional oniterations[]. The bundle format does not change, and no top-level field is added (H-2).Phase 2: the counter (
batch-executor.ts, quality loop only)IssueRunState: addconsecutiveAcNotMet: number, plusrepeatHaltBundle: EvidenceBundle | null(set means halted). Neither depends onladderState,iterationStartSnapshotoriterationRecords.recordLoopPhaseOutcome, forphase === "qa":verdictCommitHashthat is already computed for the verdict comment (:2522), so no git call is added.acsthatrecordAcStatusesreturns. The failed ACs are the ones withstatus === "not_met".AC_NOT_MET: push{iteration, sha, verdict, failedAcs}to a dedicated list and increment the counter. At 2, build the bundle (reason: "AC_NOT_MET_REPEATED",phase: "qa", the last two records,escalationHistory: []) andwarn(formatEvidenceBundle(...)).outputstill resets the counter.loopHalted(state), replaces the duplicated OR lists in the outer-loopbreak(:2170) and in the/loopspawn guard inhandlePhaseFailure(:2727). Add the new flag there only. The 2nd refusal then stops before the 2nd/loopspawn (P-1).repeatHaltOutcome(bundle), a sibling ofladderHaltOutcome. It returnsfailureCategory: "ac_not_met_repeated",abortReason: "ac_not_met_repeated: AC_NOT_MET twice in qa at <sha1>, <sha2> (failed: AC-1, AC-3)"andevidenceBundle.recordIssueCompletionalready forcesfailureand persists both fields wheneverevidenceBundleis set, solog-writer.tsneeds no change. Also update the doc comments onIssueResult.abortReason/evidenceBundleintypes.ts.Phase 3: tests and docs
batch-executor.model-ladder.test.tsandbatch-executor.test.tswith targeted vitest. Neither should change.Design Review
batch-executor.ts, because it alone owns the decision to stop. The ready gate has its own loop and is out of scope (H-3). The runner's question "is the owner somewhere else?" gets the answer no.qa-stagnation.tsis a classifier for the same SHA with no diff, anddivergence-halt.tsonly formats. Neither one decides to stop.consecutiveDivergenceSuspect(P-2: it counts diff-producing iterations and chore(cli)!: remove the model ladder and effort escalation — modules,--model-ladderand--escalate-efforton run and ready, their settings and docs; old logs and settings still load #1647 deletes its feed); (b) settinghaltedByDivergence = "AC_NOT_MET_REPEATED"(it would tie the halt to the ladder family that chore(cli)!: remove the model ladder and effort escalation — modules,--model-ladderand--escalate-efforton run and ready, their settings and docs; old logs and settings still load #1647 removes); (c) a counter at iteration level inrunQualityLoop(it runs afterhandlePhaseFailurehas already spawned/loop, which is too late for P-1).IssueRunState, ORed at the break and at the spawn guard". It has been re-patched 4 times: feat(orchestrator): preserve partial output for turn-capped phases in phase-executor #739 (turn cap), fix(run): -Q quality loop retries after an "Out of credits" exec instead of failing fast (billing cascades into "unparseable verdict") #799 (billing), feat(run): SPEC_DIVERGENCE escape hatch, ladder halts with evidence bundles, docs, rigged real run (#971 part B) #995/feat(run): model escalation ladder on capability-bound non-convergence #971 (divergence), fix(run): a ladder halt is recorded nowhere: the halting phase reads success, failureCategory is empty, and the bundle exists only on stdout #1254 (recording). That is ≥ 2, so the class gets fixed: step 5 collapses the two duplicated OR lists into oneloopHalted(state)predicate. The lists already disagree today: the guard checksresult.cappedand the break checksstate.haltedByCap. A full single-halt-record rework is deliberately local, reason: chore(cli)!: remove the model ladder and effort escalation — modules,--model-ladderand--escalate-efforton run and ready, their settings and docs; old logs and settings still load #1647 deleteshaltedByDivergencenext, class tracked in chore(cli)!: remove the model ladder and effort escalation — modules,--model-ladderand--escalate-efforton run and ready, their settings and docs; old logs and settings still load #1647.EvidenceBundleinstead of a new type?" H-2 says so, andIssueResult,markIssueFailedand MCPabortReasonalready carry it. chore(cli)!: remove the model ladder and effort escalation — modules,--model-ladderand--escalate-efforton run and ready, their settings and docs; old logs and settings still load #1647 must keepEvidenceBundle, the formatter and the new reason when it deletes the ladder.ERROR_CATEGORIESand the inline enum inrun-log-schema.ts. These are 2 producers with a parity test that already exists (run-log-schema.test.ts:479).FailureCategorySchemais derived.failureCategoryproducers:deriveFailureCategory, thepr_creationfallback,ladderHaltOutcome, the newrepeatHaltOutcome, and the abort path at :1950.run-orchestrator.ts:2457(metrics),stats.ts:423,run-display.ts:124(abortReason),mcp/tools/run.ts:298,log-writer.markIssueFailed,ci/outputs.ts,shutdown.ts. All of them pass strings through, so none needs a branch.Feature Quality Planning
All standard checks pass. Notable items:
recordAcStatusesreturns[]when there is nostateManageror no stored AC record. In that case the halt must still fire, withfailedAcs: []. Add that as test case 5.warn, notlog, becauselogis a no-op in parallel mode (fix(run): parallel mode drops per-issue warnings, not just progress — spec-parse failure, PR-after-exec failure and checkpoint-commit failure are silent on every MCP run #1342).testphase to a phase list the user or detection chose — remove the UI-label insertion indeterminePhasesForIssue(closes #1631) #1649's worktree also editsCHANGELOG.mdanddocs/reference/run-command.md, in different sections. Expect a trivial merge.Open Questions
divergence-halt.tsis not on the "May touch" list. It ownsEvidenceBundleand the reason union. Recommendation: the additive edit in step 2. Impact if that is wrong: a parallel bundle type, which H-2 rejects.failedAcs(an optional array oniterations[]), so each of the two verdicts keeps its own list. The alternative is to overloaddeclaredAcs, which means "the agent named these impossible". Impact: what readers of the bundle see.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: AC-1/AC-2 declare unit-test evidence, but the issue names the exact test file and cases. Testgen would only produce a stub of a file exec has to write anyway, so this overrides the testgen default. There is no UI and the change is not security-sensitive.
Label Review
Current: graph-2026-11-simplify. Recommended: add
enhancementandplanned. Quality Loop: it will not auto-enable (SCOPE_OK).admarble commentedon Nov 8, 2026
QA Verdict: NEEDS_VERIFICATION
AC coverage: 6/6 met
Gaps:
Suggestions:
repeatHaltOutcomeandAC_NOT_MET_REPEAT_HALT_THRESHOLDare exported, one marked "exported for testing", but nothing outsidebatch-executor.tsimports either. Import them in a test or drop the export.Needs human review:
Reviewed in a separate session by claude-code (claude-opus-5-5); the change was written by claude-code (claude-opus-5-5).
refactor(#1646): repeatHaltOutcome and AC_NOT_MET_REPEAT_HALT_THRESHO…
admarble commentedon Nov 8, 2026
Runner, W1: QA
NEEDS_VERIFICATION(CI pending only). All six ACs re-run by the runner pass. Runner fix997ae80damakes the two unused exports file-local. Dropped on purpose: a streak reset by an iteration that never reaches qa (QA test_gap). H-1 counts consecutive QA verdicts only. OQ-2: one historical run held two consecutiveAC_NOT_METverdicts (#1297, 2026-10-04; command in PR #1660). PR #1660 is waiting for CI and the owner's merge.docs(#1645): OQ-7 status corrected (answered 2026-11-06), #1662 post-…