Repository navigation
Description
Problem
Empirical analysis of our own .entire conversation logs (2026-05-30) shows the QA pass that runs inside sequant run / /fullsolve systematically under-catches relative to the fresh standalone /qa the maintainer runs in a separate session afterward.
Across 27 captured fresh-session QA passes (24 of which ran after an in-orchestrator QA had already passed the same work):
- 12/27 (44%) caught a real shipping bug or unmet AC — something that would have merged broken
- 11/27 (41%) caught a substantive quality gap
- 2/27 (7%) were clean
Representative catches the in-run QA missed: #421 (feature non-functional for its primary multi-issue use case, after a READY_FOR_MERGE verdict), #529 / #570 (no implementation existed — empty branch, zero commits — but the orchestrator reported success; exposed null-verdict-as-success bug #534), #503 (the new programmatic API was broken at launch), #467 (an AC test passed vacuously with zero assertions firing), #318 (merge would have deleted the --reflect feature from main).
Root cause — two structural gaps (not "fresh session magic")
- Orchestrated QA trusts orchestrator git state and skips pre-flight checks.
skills/qa/SKILL.md:54-58("Trust git state — orchestrator verified branch status") and:254skip the branch-freshness / process-state checks. That is exactly the class — no-implementation / divergent branch / uncommitted work — that caught refactor(run): split 3,459-line monolith into focused modules #318 / feat(qa): enforce 'Manual Test' ACs are executed or marked PENDING, never MET from code review #529 / bug(hooks): pre-tool.sh regexes for destructive/deployment/reset/workflow commands also match inside quoted gh body content #570. - The fullsolve QA loop stops at "good enough."
skills/fullsolve/SKILL.md:572-574breaks the loop atAC_MET_BUT_NOT_A_PLUS("Good enough, proceed with notes"). It never drives toward A+; the maintainer's manualfix all gapsdoes.
(A third factor — context de-anchoring from a genuinely fresh session — is real but secondary, and is obtained for free by running QA in a clean subagent context. A literal new OS session is not required, which is what makes this automatable.)
§6d Adversarial Re-Read already runs in both modes (skills/qa/SKILL.md:2077), so it is not the gap. The existing --qa-gate flag is unrelated — it is a chain-mode sync ("wait for QA before next issue", bin/cli.ts:260), not a human-review-before-merge gate.
Today the maintainer reproduces the fresh pass by hand: open a new session → qa <N> → "any gaps? fix all gaps. use sequential thinking" → re-qa → merge. This issue collapses that ritual into one command while preserving the human merge decision.
Proposed solution
A new standalone command, sequant ready <issue>, run after a resolve finishes. It reproduces the fresh-session A+ pass deterministically:
$ sequant ready 712
→ standalone-weight /qa (full pre-flight: branch freshness, process-state, no git-trust skip)
→ §6d adversarial re-read (already mandatory in standalone /qa)
→ /loop (auto-fix gaps, scoped by gate policy)
→ re-/qa (policy `ac`: until ACs met · policy `a-plus`: until READY_FOR_MERGE
— both also bounded by maxIterations / budget / no-diff guard)
→ gap report + verdict (unfixed gaps documented, not hidden)
→ STOP at human merge gate (never auto-merges)
Design decisions (confirmed with maintainer):
- Delivery: dedicated
sequant ready <issue>command (not arunflag), matching the existing two-session habit and keeping it testable in isolation. A futuresequant run --ready-gatecan reuse the same engine (out of scope here). - Gap handling is a configurable gate policy (see below). The loop's exit threshold is set by policy, not hardcoded. Default is
ac(AC-bounded);a-plus(auto-loop everything) is opt-in. Regardless of policy, the signal-to-noise, budget, and stagnation guards below are mandatory acceptance criteria.
Gate policy (configurable rigor)
"A+" is the right bar for a solo maintainer dogfooding sequant, but the wrong default at scale. For a company engineer with a fixed agenda, auto-loop-everything risks: (a) scope creep — "fixing" things the issue's own Non-Goals deliberately excluded; (b) a subjective stop condition reviewers can't predict; (c) the noise/runaway the #608 study warned about. "ACs met" is, by contrast, an objective stop condition — the written acceptance-criteria checklist.
The boundary already exists as QA verdicts, so policy just selects the loop-exit threshold — minimal new logic:
| Policy | Loops until | Quality / polish gaps | Audience |
|---|---|---|---|
ac (default) |
no AC_NOT_MET remains (ACs objectively met) |
documented in the gap report, NOT auto-fixed | team engineer, fixed agenda, predictable diff |
a-plus (opt-in) |
READY_FOR_MERGE |
auto-fixed in the loop | solo maintainer / max-quality |
acmode still runs the full-weight QA + §6d adversarial re-read, so every gap is surfaced in the report (nothing hidden) — it just stops fixing at the AC boundary, turning remaining findings into a deliberate follow-up backlog instead of unrequested scope.- In
acmode, any finding that touches the issue's Non-Goals is explicitly report-only. - Config:
ready.policyin.sequant/settings.json(default"ac"), overridable per-invocation with--policy ac|a-plus. - Termination in either policy also bounded by
maxIterations, the token budget, and theLOOP_NO_DIFFstagnation guard. - Full-weight QA: the command must run
/qawithout theSEQUANT_ORCHESTRATORgit-trust skip path — i.e. it performs the pre-flight branch/process-state checks. (Mechanism: do not setSEQUANT_ORCHESTRATOR, or introduce an explicitSEQUANT_FULL_QA=1that forces the standalone checks even under an orchestrator.) - Human gate: terminates in a
waiting_for_human_mergestate with a written report; it never calls merge. - Issue-centric: operates on an issue number (reuses existing worktree/state infra).
--from-pr <N>(reverse PR→issue resolution) is a follow-up, not in scope.
Acceptance Criteria
- AC-1
sequant ready <issue>is registered inbin/cli.tsand dispatches a pipeline ofqa → loop → qa(repeating) against the issue's existing worktree. Verify: integration test asserts the phase sequence dispatched. - AC-2 The QA phases run in full standalone weight — the branch-freshness and process-state pre-flight checks execute (they are NOT skipped via the orchestrator git-trust path). Verify: unit test asserts
SEQUANT_ORCHESTRATORis unset (orSEQUANT_FULL_QAis set) in the env passed to the phase executor, and a fixture with a divergent/zero-commit branch is flagged rather than trusted. - AC-3 The loop's exit threshold is set by gate policy:
ac(default) stops once noAC_NOT_METremains and reports unfixed quality gaps;a-plusloops towardREADY_FOR_MERGE. Both also terminate onmaxIterations, token budget, or theLOOP_NO_DIFFstagnation guard. Verify: unit tests assertingacstops at AC-met (and does NOT auto-fix a quality-only gap),a-plusloops past it, and each guard-based exit. - AC-3a Policy is read from
ready.policyin.sequant/settings.json(default"ac") and overridable via--policy ac|a-plus. Inacmode, findings that touch the issue's Non-Goals are report-only. Verify: config-resolution unit test (flag overrides settings overrides default); test that a Non-Goal-touching gap is reported, not fixed, underac. - AC-4 The command never merges. It ends in
waiting_for_human_mergeand emits a structured gap report (auto-fixed items + remaining/accepted items + final verdict). Verify: integration test asserts no merge invocation and the terminal state + report shape. - AC-5 Regression guard for the fix(orchestrator): treat null QA verdict and zero-diff exec as failure, not success #534 class: a zero-diff exec and/or a null QA verdict must NOT be reported as ready. Verify: replay the feat(qa): enforce 'Manual Test' ACs are executed or marked PENDING, never MET from code review #529/bug(hooks): pre-tool.sh regexes for destructive/deployment/reset/workflow commands also match inside quoted gh body content #570 scenario (empty branch) → command reports "not ready / no implementation", not
READY_FOR_MERGE. - AC-6 Runaway protection: a configurable token/iteration budget caps the A+ loop; on exhaustion the command halts with a clear "needs human" message rather than looping. Verify: unit test with a forced non-converging fixture asserts a clean halt within budget.
- AC-7 Backtest recall (see Testing Strategy, Layer 2) is documented in
docs/investigations/ready-gate-backtest.mdwith measured recall against the 12 known would-ship defects and a measured false-positive/noise rate. Manual test — executed on the feature branch, results committed. - AC-8 Docs + CHANGELOG entry; command documented in README + marketplace README +
docs/. Verify: docs check across all locations.
Testing strategy
Because the feature's output is LLM-judgment (non-deterministic), testing is layered — deterministic plumbing in CI, empirical quality offline.
Layer 1 — Deterministic wiring (vitest, CI-gated).
Command parsing/registration (AC-1); env-weight assertion that the QA runs full-weight (AC-2); the three loop-exit conditions (AC-3); never-merges + terminal state + report shape (AC-4); the #534 zero-diff/null-verdict regression (AC-5); budget/stagnation halt (AC-6). Fast, deterministic, blocks merge.
Layer 2 — Backtest against the 27-transcript ground-truth corpus (the centerpiece, offline).
We already have 27 captured fresh-session QA passes with known caught defects (12 real-bug: #421, #503, #467, #529, #570, #318, #465, #484, #528, #554, #573, #625). For each, check out the pre-fix commit the fresh QA reviewed, run sequant ready against it, and measure:
- Recall (both policies) — did the chain independently flag the same defect class?
acmode should hit high recall on the AC-miss subset (objective);a-plusadds the quality-gap catches. Target ≥ 70% recall on the real-bug set before public release; reportac-vs-a-plusrecall separately so the policy boundary is measured, not assumed. - False-positive / noise rate (per policy) — on the clean cases (chore: raise Node engine floor to >=22.12 (drop EOL Node 20), unblock commander 15 #677) and a sample of cleanly-merged PRs that needed no fixes, the chain must NOT invent gaps or loop to budget. Measure separately for
acanda-plus: this is the investigate(metrics): gap-check signal-to-noise — does flagged → action rate justify cumulative QA prompt cost? #608 risk, whicha-plusamplifies and theacdefault is meant to contain. Ifa-plusnoise is high, that validates keepingacas default.
Reuse the existing.entireextraction harness (/tmp/qa_sessionscondenser). Captured as a committed report (AC-7), not in CI (too slow / non-deterministic) — mirrors the investigate(metrics): gap-check signal-to-noise — does flagged → action rate justify cumulative QA prompt cost? #608 / investigate(qa): extract deterministic gap-checks into pre-QA script gate #609 investigation format.
Layer 3 — Forward shadow dogfood (feature branch).
On the next ≥ 10 real issues, run BOTH the maintainer's normal manual fresh QA AND sequant ready in shadow (no auto-merge). Compare: agreement, automated-only catches, human-only catches the bot missed. Track via sequant stats --label --since cohort filters (#640). Promotion criteria for public release: automated chain catches ≥ 80% of what the manual fresh QA catches, with acceptable noise, across the cohort. If it underperforms, keep it as an opt-in experimental flag rather than a default.
Layer 4 — Safety/guardrails (vitest).
Never auto-merges; stagnation halts cleanly (LOOP_NO_DIFF); budget cap holds; #534-class inputs never report ready. (Overlaps AC-4/5/6 — called out separately because these are the "don't ship a footgun" tests.)
Rollout plan
- Feature branch
feature/<this-issue>-ready-gate. Implement Layer-1 wiring; ship behind an experimental marker. - Layer-2 backtest on the 27-corpus; tune loop-exit + verdict thresholds + noise; commit
docs/investigations/ready-gate-backtest.md(AC-7). - Layer-3 shadow dogfood on ≥ 10 live issues; record cohort metrics.
- Promotion gate: meet the Layer-3 criteria → graduate to a documented command. Otherwise refine, or keep experimental/opt-in.
- Release: docs + CHANGELOG; minor version bump (new feature, per versioning policy).
Risks / open questions
- Noise / over-fixing / scope creep (primary risk).
a-pluscan chase judgment-call quality gaps a team would accept-as-is or defer (Lighter workflow pipeline for documentation issues (42% success rate) #451, feat(cli): add --security-review additive flag for symmetry with --testgen #559 in the corpus), or expand past an issue's Non-Goals — unacceptable for a fixed-agenda engineer. Primary mitigation:acis the default, so the broad install base gets AC-bounded, scope-respecting, predictable behavior;a-plusis opt-in. Layer-2 per-policy noise measurement + the budget cap back this up. - Forcing full-weight QA under an orchestrator — need to decide between simply not setting
SEQUANT_ORCHESTRATORvs an explicitSEQUANT_FULL_QAoverride. The latter is cleaner ifreadyever runs inside a larger flow. - Non-determinism of the promotion gate — Layer-3 is a small-N human comparison; document it as directional evidence, not a hard statistic (same caveat as investigate(metrics): gap-check signal-to-noise — does flagged → action rate justify cumulative QA prompt cost? #608).
Non-goals
--from-pr <N>/ reverse PR→issue resolution (follow-up).sequant run --ready-gateflag integration (follow-up; reuse this engine).- Auto-merge of any kind — the human merge gate is intentional and permanent.
- Changing the in-orchestrator QA's lite-mode behavior (that path stays fast;
readyis the deliberate full-weight pass).
Motivation data and mechanism analysis: .entire log study, 2026-05-30. See also #448 (first-pass QA rate), #582 (adversarial re-read), #608/#609 (gap-check signal-to-noise), #534 (null-verdict-as-success).
Activity
admarble commentedon May 31, 2026
Complexity: Complex (9 ACs, ~6 directories)
AC Quality Check
ACs are well-formed, measurable, and each carries an explicit Verify: clause — strong. Two flags:
- [ ] **AC-1** ...(no colon). Sequant's ownAC_PATTERNS(src/lib/ac-parser.ts:45-53) all require a colon (**AC-1:**). Result:extractAcceptanceCriteriareturns 0 items, so/testgenstub generation and.sequant/state.jsonAC tracking will be empty for this issue. Fix: add a colon after each ID (**AC-1:**). Low effort, prevents downstream tooling from silently no-op'ing.Scope Assessment
Non-Goals: ✅ Present and specific (
--from-pr,run --ready-gate, auto-merge, in-orchestrator lite-QA behavior).bin/,src/commands/,src/lib/workflow/,src/lib/settings.ts,skills/qa×3,docs/×3)Verdict: ❌ SCOPE_SPLIT_RECOMMENDED (by metrics) — but the work is cohesive (one command + its config), and the issue's own rollout plan already stages it. Recommendation: land AC-1–6 + AC-8 as the implementation PR; AC-7 backtest is a committed doc produced on the branch (rollout step 2) but is fine to track as its own deliverable; Layer-3 shadow dogfood is explicitly a post-merge promotion gate, not part of this PR. This keeps the mergeable diff predictable and matches the phased rollout.
Acceptance Criteria
AC-1:
sequant ready <issue>registered + dispatchesqa → loop → qaVerification: Integration Test — assert the phase sequence dispatched against the issue's worktree.
Scenario: Given a resolved worktree for #N → When
sequant ready Nruns → Then phases dispatch in orderqa, loop, qa[, loop, qa…].Assumptions: Reuses
executePhaseWithRetry(phase-executor.ts:765) +phaseRegistryqa/loopdefs; worktree resolved viaworktree-discovery.ts.AC-2: QA runs full standalone weight (pre-flight checks NOT skipped)
Verification: Unit Test — assert env passed to phase executor sets⚠️
SEQUANT_FULL_QA(or omitsSEQUANT_ORCHESTRATOR); fixture with divergent/zero-commit branch is flagged, not trusted.Scenario: Given
readyinvokes QA → When env is built → Then standalone branch-freshness + process-state checks execute despite orchestration.Assumptions:
phase-executor.ts:595setsSEQUANT_ORCHESTRATORunconditionally. So "just don't set it" is not available when reusing the executor —SEQUANT_FULL_QA=1override is the correct mechanism (see Open Questions Q1).AC-3: Loop exit threshold set by gate policy
Verification: Unit Tests —
acstops at AC-met and does NOT auto-fix a quality-only gap;a-plusloops past it; each guard exit (maxIterations, budget,LOOP_NO_DIFF).Scenario: Given QA returns
AC_MET_BUT_NOT_A_PLUS→ When policy=ac→ Then loop stops (gap reported); When policy=a-plus→ Then loop continues untilREADY_FOR_MERGEor a guard fires.Assumptions: Verdicts already parsed in
phase-executor.ts:126-140;LOOP_NO_DIFFinfra exists (qa-stagnation.ts).ac-mode "don't fix quality gaps" enforced by scoping the loop to AC_NOT_MET findings via existingSEQUANT_FAILED_ACSenv (phase-executor.ts:607).AC-3a: Policy resolution + Non-Goal report-only
Verification: Unit Test — flag >
ready.policysetting > default"ac"; a Non-Goal-touching gap is reported, not fixed, underac.Scenario: Given
.sequant/settings.json ready.policy="a-plus"and--policy ac→ Thenacwins. Given anacrun with a finding touching a Non-Goals item → Then it is report-only.Assumptions: New
ReadySettings/SequantSettings.readyinsrc/lib/settings.ts(schema + defaults + key-section maps + docs table). Non-Goals parsed from issue body.AC-4: Never merges; ends
waiting_for_human_merge+ structured reportVerification: Integration Test — assert no merge invocation; assert terminal state + report shape (auto-fixed + remaining/accepted + verdict).⚠️
Scenario: Given any
readyrun → When it completes → Then it never calls merge and ends inwaiting_for_human_mergewith a structured gap report.Assumptions:
IssueStatusSchema(state-schema.ts:51-60) does not includewaiting_for_human_merge— requires adding the enum value (or documented reuse ofready_for_merge). See Open Questions Q3.AC-5: #534-class regression guard
Verification: Integration Test — replay #529/#570 (empty branch, zero commits) → command reports "not ready / no implementation", never
READY_FOR_MERGE.Scenario: Given a zero-diff exec or null/unparseable QA verdict → Then
readyreports not-ready, not success.Assumptions: Reuse existing null-verdict guard (
phase-executor.ts:406) + zero-diff guard (:431).readymust propagate these as terminal "not ready", not swallow them.AC-6: Runaway protection (budget/iteration cap → clean halt)
Verification: Unit Test — forced non-converging fixture asserts clean halt within budget with a "needs human" message.
Scenario: Given a fixture that never reaches the policy threshold → Then the loop halts at
maxIterations/budget with a clear message, not an infinite loop.Assumptions: Reuse
settings.run.maxIterations+ token budget; surface via the gap report.AC-7: Backtest doc with measured recall + noise rate
Verification: Manual Test —
docs/investigations/ready-gate-backtest.mdcommitted with per-policy recall vs the 12 known would-ship defects + measured FP/noise. Mirrors #608/#609 format.Assumptions: Reuses
.entireextraction harness (/tmp/qa_sessionscondenser). Not CI-gated.AC-8: Docs + CHANGELOG (all locations)
Verification: Docs check across main README, marketplace README,
docs/, andCHANGELOG. Verify content coverage (command name,--policy,ready.policy, human-gate behavior), not just file existence.Implementation Plan
Phase 1: Config + state plumbing
src/lib/settings.ts— addReadySettings { policy: "ac" | "a-plus" },SequantSettings.ready, Zod schema (default("ac")), defaults block, key→section maps (~:443/:465), and the settings-doc table (~:932). (AC-3a)src/lib/workflow/state-schema.ts— addwaiting_for_human_mergetoIssueStatusSchema(:51). (AC-4)Phase 2: Full-weight QA mechanism (multi-touchpoint — see note)
src/lib/workflow/phase-executor.ts— thread afullQaconfig flag →env.SEQUANT_FULL_QA = "1"near theSEQUANT_ORCHESTRATORblock (:595). (AC-2)skills/qa/SKILL.md(× 3 mirror dirs:.claude/skills/qa,templates/skills/qa,skills/qa) — re-enable standalone pre-flight whenSEQUANT_FULL_QAis set even under an orchestrator. Edit the behavior table (:52-62), Stale-Branch skip (:254), pre-flight skip (:233), and:2426. (AC-2)Phase 3: The
readycommandsrc/commands/ready.ts(new, mirrormerge.tsshape) — resolve worktree + policy (flag > setting >"ac"); drive theqa → loop → qaloop viaexecutePhaseWithRetrywithfullQa; inacmode pass only AC_NOT_MET findings to loop (viaSEQUANT_FAILED_ACS) and classify Non-Goal-touching findings report-only; enforcemaxIterations/budget/LOOP_NO_DIFF; treat null-verdict/zero-diff as not-ready (AC-5); never call merge; endwaiting_for_human_merge; emit structured gap report (auto-fixed + remaining/accepted + verdict). (AC-1,3,3a,4,5,6)bin/cli.ts— registerprogram.command("ready").argument("<issue>")with--policy <ac|a-plus>,--max-iterations <n>,--budget <tokens>,--json,-v; importreadyCommand. (AC-1) — CLI-wiring gap reminder: every option must be registered here, not just in the command's options interface.Phase 4: Verification artifacts + docs
ready, record per-policy recall + noise →docs/investigations/ready-gate-backtest.md. (AC-7)Note — multi-touchpoint rule (AC-2): the behavior-rule detector did not auto-trigger, but the "full-weight QA" rule is genuinely duplicated across the
skills/qa/SKILL.mdprompt (×3 dirs) and thephase-executor.tsenv builder. Edit both sides or one goes stale (cf. #533). Sync all 3 skill dirs (feedback_read_each_mirrored_file).Design Review
src/commands/ready.tsorchestrating existingexecutePhaseWithRetry+phaseRegistry— not a fork ofrun-orchestrator.ts. Policy/state types belong insettings.ts/state-schema.ts. The issue's "futurerun --ready-gatereuses this engine" implies the loop driver should be a small reusable function, not buried in the command action.executePhaseWithRetry), verdict parsing + fix(orchestrator): treat null QA verdict and zero-diff exec as failure, not success #534 guards (phase-executor.ts:126-140,406,431), stagnation (qa-stagnation.ts), loop scoping (SEQUANT_FAILED_ACS). Net new logic is small: the policy-driven exit predicate, theSEQUANT_FULL_QAflag, thewaiting_for_human_mergestatus, and the report formatter. Reject building a new loop engine.merge.ts(standalone post-run command with exit codes +--json) for shape;run-orchestratorfor the phase-loop idiom; QA verdict gating already centralized inphase-executor.SEQUANT_FULL_QAinstead of just not settingSEQUANT_ORCHESTRATOR?" → because the executor sets it unconditionally and other orchestrator behaviors (worktree reuse, state-hook) are still wanted; an explicit override is narrower and testable. (b) "Doesacmode actually refrain from fixing quality gaps, or just hope the loop does?" → must be enforced by feeding the loop only AC_NOT_MET findings, asserted by AC-3's negative test. (c) "Iswaiting_for_human_mergeobservable?" → must be a realIssueStatusSchemavalue, not just prose.Feature Quality Planning
All standard checks pass. Notable items:
.entirecorpus + pre-fix commit checkouts — document the exact harness invocation so the doc is reproducible, not a one-off.ac-mode negative assertion (does NOT fix a quality-only gap) is the highest-value test — it's the entire point of the default policy and the easiest thing to get subtly wrong.Derived ACs
waiting_for_human_mergeterminal state is persisted tostate.jsonand visible viasequant status**AC-N:**so/testgen+ state tracking parse themOpen Questions
SEQUANT_FULL_QA=1override (the issue's "cleaner ifreadyever runs inside a larger flow" rationale). Impact if wrong: choosing "unsetSEQUANT_ORCHESTRATOR" also disables wanted orchestrator behaviors (worktree reuse, state-hook suppression) and isn't even reachable without refactoringphase-executor.ts:595.ac-mode loop scoping. Recommendation: reuse the existingSEQUANT_FAILED_ACSenv to feed the loop only AC_NOT_MET findings, so quality gaps are surfaced-but-not-fixed. Impact if wrong:acmode silently behaves likea-plus, defeating the default's scope-creep protection.waiting_for_human_mergestatus. Recommendation: add it toIssueStatusSchema. Impact if wrong: AC-4's terminal-state assertion can't be satisfied against a real enum; reusingready_for_mergewould conflate it with the existing PR-ready meaning.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled
Reasoning: AC-1–6 are Unit/Integration verified (testgen stubs the deterministic Layer-1/Layer-4 wiring before implementation). No UI → no
testphase. Not auth/payments/file-ops → nosecurity-review. 9 ACs across orchestration internals → quality loop on. AC-7/Layer-3 are post-implementation manual gates, not phases.Label Review
Current: (none)
Recommended:
enhancement,cli,complexReason: New user-facing CLI command (
enhancement+cli); 9 ACs + cross-cutting orchestration touchpoints (complex).Quality Loop: Will auto-enable (
complexlabel + SCOPE red).→
gh issue edit 683 --add-label enhancement,cli,complex--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
📋 Plan —
sequant ready <issue>Complexity: Complex (9 ACs, ~6 directories) · Workflow: spec → testgen → exec → qa (quality loop on)
Acceptance Criteria + verification
sequant ready <issue>, dispatchqa → loop → qa— integration: phase sequenceSEQUANT_FULL_QAset / divergent branch flaggedacdefault /a-plus) + guards — unit:acstops & doesn't fix quality gap,a-plusloops, each guardready.policy+--policyresolution; Non-Goal findings report-only — unit: flag>setting>defaultwaiting_for_human_merge+ structured report — integration: no merge, terminal state + report shapeKey implementation notes
executePhaseWithRetry+phaseRegistryqa/loop; do not forkrun-orchestrator.phase-executor.ts:595setsSEQUANT_ORCHESTRATORunconditionally → use an explicitSEQUANT_FULL_QA=1override, threaded intoskills/qa/SKILL.mdacross all 3 skill dirs (behavior table + stale-branch/pre-flight skips).waiting_for_human_mergemust be added toIssueStatusSchema(state-schema.ts:51).ac-mode: enforce "report but don't fix quality gaps" by feeding the loop only AC_NOT_MET findings via existingSEQUANT_FAILED_ACS.:406) + zero-diff (:431) guards.Pre-exec ask
**AC-1:**(add colon) — current**AC-1**format isn't matched byAC_PATTERNS, so/testgen+ state tracking parse 0 ACs.Open questions (recommendations)
SEQUANT_FULL_QA=1(not unsettingSEQUANT_ORCHESTRATOR).ac-mode fixes viaSEQUANT_FAILED_ACS.waiting_for_human_mergeto the status enum.Scope
Land AC-1–6 + AC-8 as the implementation PR; AC-7 backtest is a committed deliverable (rollout step 2); Layer-3 shadow dogfood is a post-merge promotion gate.
admarble commentedon May 31, 2026
Plan Complete —
sequant ready <issue>(post-resolve A+ QA gate)Complexity: Complex (9 ACs, ~6 directories)
Architecture (grounded in code audit)
A new
readycommand drives an existing issue worktree through aqa → loop → qa …pipeline at full standalone weight, never merges, and ends inwaiting_for_human_mergewith a structured gap report.src/commands/ready.tssrc/lib/workflow/ready-orchestrator.tsrunReadyGate), DI-injectable phase runner for testssrc/lib/workflow/ready-report.tsbin/cli.tsready <issue>+--policy ac|a-plus,--max-iterations,--budget,--jsonsrc/lib/settings.tsready.policy(default"ac") +ready.maxTokensto interface/schema/KNOWN_KEYS/defaultssrc/lib/workflow/types.tsExecutionConfig.fullQa?: booleansrc/lib/workflow/phase-executor.tsconfig.fullQa, setenv.SEQUANT_FULL_QA="1"src/lib/workflow/state-schema.tswaiting_for_human_mergetoIssueStatusSchema(+ audit consumers)skills/qa/SKILL.md×3 (skills/,.claude/skills/,templates/skills/)SEQUANT_FULL_QA=1→ force standalone pre-flight even under orchestratorAC coverage map
qa→loop→qa. Test: integration asserts phase sequence.SEQUANT_FULL_QA=1(chosen over unsettingSEQUANT_ORCHESTRATOR— cleaner ifreadyever nests in a larger flow, per issue Risks). Test: env assertion + divergent/zero-commit branch flagged.acstops at "noAC_NOT_MET";a-plusloops toREADY_FOR_MERGE. Both bounded bymaxIterations/ token budget /LOOP_NO_DIFF(reusedetectStagnation/compareLoopProgress). Tests: each exit path.ready.policysettings > defaultac.acmode marks Non-Goal-touching findings report-only. Tests: config resolution + Non-Goal report-only.waiting_for_human_merge; structured report. Test: no merge invocation + terminal state + report shape.hasExecChanges; add zero-commit branch check). Test: replay feat(qa): enforce 'Manual Test' ACs are executed or marked PENDING, never MET from code review #529/bug(hooks): pre-tool.sh regexes for destructive/deployment/reset/workflow commands also match inside quoted gh body content #570 empty branch.docs/investigations/ready-gate-backtest.md.Design Review
src/commands/ready.tsover a reusableready-orchestrator.tsinsrc/lib/workflow/— mirrorsrun.ts→run-orchestrator.ts. Phase execution reusesexecutePhaseWithRetry(DI-injected for tests).["qa"], then["loop"], then["qa"]…) rather than forkRunOrchestrator; gate the loop on QA verdict + policy. ReuseparseQaVerdict,parseQaSummary,detectStagnation,hasExecChanges.executePhaseFnparam already exists), Zod settings schema.waiting_for_human_mergeand audit everyIssueStatusswitch/consumer (reconcile, state-cleanup, status) to keep exhaustiveness intact.Open Questions / Scope Notes
maxIterations), with an optionalready.maxTokens/--budgetknob that halts cleanly. AC-6's deterministic test uses the iteration cap with a non-converging fixture.Recommended Workflow
Phases: exec → qa · Quality Loop: enabled (Complex, new public API)
Reasoning: CLI/backend feature, no browser test. Deterministic vitest for AC-1–6; AC-7 manual doc.
admarble commentedon May 31, 2026
QA Review for Issue #683
Full-weight QA on
feature/683-…-ready-gate(HEAD86f4444f6). Implementation is complete and well-tested; one AC is a manual offline backtest pending execution.AC Coverage
ready+ dispatchqa→loop→qabin/cli.ts; engine test asserts dispatched sequence[qa, loop, qa]config.fullQa→SEQUANT_FULL_QA=1(phase-executor); qa/SKILL.md ×3 honor it; zero-commit branch →NO_IMPLEMENTATIONac/a-plus+ MAX_ITERATIONS/TOKEN_BUDGET/LOOP_NO_DIFF all unit-testedresolvePolicyprecedence (flag>settings>default); Non-Goal gap excluded from fix loop, tagged report-onlywaiting_for_human_merge; structured md/JSON reportNO_IMPLEMENTATION, exit 2docs/investigations/ready-gate-backtest.md); the measured numbers require an offline live-LLM run over 27 pre-fix commits — a Manual Test AC, deferred to rollout-plan step 2 (not executable in an autonomous session)docs/reference/ready-command.md, CHANGELOG[Unreleased]Coverage: 8/9 MET · AC-7 PENDING (offline manual backtest)
Quality Metrics
tsc)eslint --max-warnings 0)ready --help✓; no-worktree → exit 2 ✓Code Review
Strengths: Clean command→engine split (
ready.tsoverready-gate.ts); DI-injectable phase runner makes the loop fully deterministic to test; reuses existing infra (compareLoopProgress,hasExecChanges,token-utils,parseQaVerdict);SEQUANT_FULL_QAcleanly scoped to theqaphase only; newwaiting_for_human_mergestatus wired through every exhaustiveRecord<IssueStatus>consumer (dashboard, status, reconcile) —tscconfirms exhaustiveness.Issues: None blocking.
Minor / follow-up:
SEQUANT_FULL_QA), not an independent runtime unit test. The zero-commit half is unit-tested via theNO_IMPLEMENTATIONguard. By design — pre-flight is the skill's job — but worth noting.token-utilsper-phase files being populated during a real run; the cap logic is injection-tested, the real-path population is not exercised here.Risk Assessment
SEQUANT_FULL_QA=1— that's prose-driven (LLM), so a skill regression could silently skip it. The deterministic fix(orchestrator): treat null QA verdict and zero-diff exec as failure, not success #534 guard in the engine is the backstop for the worst case (empty branch).IssueStatusenum addition was swept across all threeRecord<IssueStatus>maps.Adversarial Re-Read
Findings: No blocking gaps. Traced: (1) no
merge/gh pr merge/--squashanywhere inready.ts/ready-gate.ts— the human gate is structural; (2) the #534 guard fires before any positive verdict can be reported on an empty branch; (3)remainingreflects the final QA's gaps — an unfixed Non-Goal gap correctly re-surfaces as report-only (test fixture corrected to match real re-QA behavior); (4) Non-Goals from the issue body parsed and honored inacmode; no scope creep. One honest gap surfaced and disclosed, not hidden: AC-7's measured numbers are not produced (offline live-LLM backtest).Status: Gaps Found (AC-7 pending — non-code, offline)
Verdict: NEEDS_VERIFICATION
All 8 code/doc ACs are MET with green build, lint, and 29 new deterministic tests. AC-7 is a manual offline backtest (live-LLM recall/noise over 27 pre-fix commits) — its scaffold (methodology, corpus, harness, scoring rubric) is committed, but the measured numbers must be produced on the feature branch per the issue's own rollout-plan step 2. This is external/manual verification, not a code gap, so the work is mergeable-pending-backtest rather than blocked. Recommend creating the PR and running the offline backtest before public promotion (the command can ship behind its experimental marker meanwhile).
Documentation
[Unreleased]entry addedNext Steps
docs/investigations/ready-gate-backtest.md) on the feature branch; commit measured recall/noise → flips AC-7 to MET.admarble commentedon May 31, 2026
/fullsolve Complete
Issue: #683 · PR: #686 · Status: NEEDS_VERIFICATION (mergeable; one offline backtest pending)
Summary
sequant ready <issue>implemented end-to-end: full-weightqa → loop → qagate, configurableac/a-pluspolicy, #534 zero-diff/null-verdict guard, iteration + token-budget +LOOP_NO_DIFFcaps, newwaiting_for_human_mergeterminal state, structured gap report — never merges.Quality
Iterations
Next step (human)
Review PR #686 and merge when satisfied (the human merge gate is intentional — fitting for this feature). Run the offline backtest (
docs/investigations/ready-gate-backtest.md) on the branch to flip AC-7 → MET before public promotion.fix(qa): tolerate emoji-prefixed verdicts in parseQaVerdict (#683)
feat(cli): `sequant ready <issue>` — post-resolve A+ QA gate (#683) (#…
chore(#689): ready-gate backtest driver script (#691)
docs(#689): backtest infeasible (both approaches fail) — recommend de…
docs: list `sequant ready` in cheat-sheet + link orphaned command-ref…
feat(cli): `sequant ready <issue>` — post-resolve A+ QA gate (#683)
fix(qa): tolerate emoji-prefixed verdicts in parseQaVerdict (#683)