Repository navigation
Description
Context
sequant ready (#683, promoted in #689) reproduces the maintainer's manual fresh-session A+ pass: a policy-bounded qa → loop → qa engine that stops at a human merge gate. Its header comment explicitly designs the next step: "This module is the reusable engine — a future sequant run --ready-gate (out of scope for #683) can reuse runReadyGate directly" (src/lib/workflow/ready-gate.ts:20-22).
Session-log analysis (2026-07-26, 43 driver sessions / 20 issues over Jun 20–Jul 26) quantifies the gap this closes: after essentially every /qa, the maintainer manually types the same triple — a gap probe ("any gaps?"), a fix command ("fix all gaps"), then "merge". 34 of 249 typed messages are literally these strings, and the probe reliably surfaces real defects the first /qa pass accepted (consistent with the recorded 44%-of-second-looks defect rate). The engine that automates exactly this loop already exists; it just isn't reachable from sequant run.
A second dead end this fixes: on the run path, an AC_MET_BUT_NOT_A_PLUS verdict breaks to PR (#749, correctly) and nothing re-drives it — ready --policy a-plus is the intended escalation, but invoking it is manual and requires knowing it exists.
Proposal
An opt-in --ready-gate flag on sequant run that invokes the existing runReadyGate engine after the standard phases succeed, driving the issue to the configured policy threshold (ac default / a-plus) before handing back to the human. Exact sequencing relative to PR creation/finalization is /spec's call; the requirement is only that the run terminates with the PR open, the gate's gap report produced, and the issue in waiting_for_merge-style state — never merged.
Design constraints (strategic, from past failures):
- No inert flag.
--qa-gateshipped unwired and had to be deprecated (chore(run): --qa-gate is an inert no-op flag — remove or make it actually gate #795). The flag must be traced end-to-end (bin/cli.ts.option()→RunOptions→ExecutionConfig→ batch-executor) with a test that fails if any link is dropped. - No new policy surface. Reuse
ready's existing policy setting and bounds (maxIterations, token budget,LOOP_NO_DIFFstagnation guard, Non-Goals exclusion). Zero new configuration concepts for end users. - Default off, byte-identical behavior without the flag. Existing users' runs must not get longer or more expensive without opting in.
Acceptance Criteria
-
sequant run -Q <issue> --ready-gateinvokes the existingrunReadyGateengine after the standard phases succeed, and the run terminates with the PR open, the gate report produced, and the persisted status matchingsequant ready's terminal semantics — it never merges. - With
--ready-gate, anAC_MET_BUT_NOT_A_PLUSoutcome is escalated through the gate per the configured policy instead of dead-ending at PR; without the flag, fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 behavior is unchanged. - The flag is wired end-to-end (bin/cli.ts option → RunOptions → ExecutionConfig → executor) and a test fails if the flag stops reaching the engine (the chore(run): --qa-gate is an inert no-op flag — remove or make it actually gate #795 inert-flag class).
- Gate policy, iteration cap, token budget, stagnation guard, and Non-Goals handling all come from the existing
readymachinery; no new flags or settings beyond--ready-gateitself. - Without the flag, run behavior is unchanged (existing run-path tests still pass unmodified).
- The run summary and PR body surface the gate outcome (threshold reached vs guard halt) the same way
sequant readyreports it. - Documentation covers the flag in the main README, marketplace README, and docs/.
Out of scope
Auto-merge or adding merger to default phases (human merge gate is deliberate policy); MCP exposure of the gate; changing -Q semantics; batch/chain interaction beyond "gate runs per-issue after that issue's phases" (if chain interaction is non-trivial, note it and defer).
References
src/lib/workflow/ready-gate.tsheader — the designed seam this builds- feat(cli):
sequant ready <issue>— post-resolve A+ QA gate that drives an issue to merge-readiness #683 / Promotesequant readyfrom experimental: Layer-2 backtest + Layer-3 shadow dogfood, meet promotion gate (#683 follow-up) #689 / feat(cli):sequant ready— wire live phase-matrix renderer (parity withsequant run) #697 — ready engine, promotion, TUI parity - fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 — AC_MET_BUT_NOT_A_PLUS breaks to PR (behavior preserved without flag)
- chore(run): --qa-gate is an inert no-op flag — remove or make it actually gate #795 — the inert-flag failure mode the wiring AC guards against
Activity
admarble commentedon Jul 27, 2026
#817 — feat(run): --ready-gate — run the post-QA ready gate inside
sequant run(automates the any-gaps/fix-gaps second look, stops at human merge)Open · enhancement, cli
────────────────────────────────────────────────────────────────
→ PROCEED — The designed seam exists (
src/lib/workflow/ready-gate.tsheader names this exact flag); nothing wired in bin/cli.ts yet, as expectedCommands:
sequant run 817 -Q
spec → exec → qa · 7 ACs
────────────────────────────────────────────────────────────────
⚠ Land after #820 — the ready-gate's fix loop would otherwise consume the infra-blocked-CI misclassification #820 prevents
────────────────────────────────────────────────────────────────
admarble commentedon Jul 27, 2026
📋 /spec — Plan Review (#817)
Complexity: Standard (7 ACs, ~4 directories:
bin/,src/commands/,src/lib/workflow/,docs/)AC Quality Check
No vague/unmeasurable ACs. All 7 have concrete, testable outcomes. AC-3 and AC-5 are themselves test-defined (they mandate a guarding test) — exactly the discipline the #795 inert-flag failure demands.
Scope Assessment
Non-Goals: ✅ Present ("Out of scope": auto-merge /
mergerin default phases, MCP exposure,-Qsemantics, non-trivial chain interaction).bin,commands,lib/workflow,docs)Verdict: ✅ SCOPE_OK — no new surface; the flag delegates entirely to
runReadyGate.Dependency:⚠️ assess flagged "land after #820" (infra-blocked-CI misclassification). #820 is CLOSED/merged (commit
4c258a6) — dependency satisfied, safe to proceed.Acceptance Criteria & Verification
AC-1 — Gate invoked post-phases; PR open; status = terminal; never merges.
Integration. Given phases succeed for a run with
--ready-gate→ When the executor reaches the PR seam → ThenrunReadyGateruns against the worktree, the PR is created, persisted status =waiting_for_human_merge(orblockedon guard halt), and no merge is performed.AC-2 —
AC_MET_BUT_NOT_A_PLUSescalated with flag; #749 preserved without it.Integration. With flag: a non-A+ verdict drives the gate per policy instead of dead-ending at PR. Without flag: verdict is surfaced in PR body only (#749), unchanged.
AC-3 — Flag wired end-to-end; test fails if it stops reaching the engine.
Unit + Integration. Trace
bin/cli.ts .option → RunOptions.readyGate → ExecutionConfig.readyGate → batch-executor → runReadyGate. A dead-surface/wiring test (mirrorrun-options-dead-surface.test.ts) fails if any link drops.AC-4 — Policy, iteration cap, token budget, stagnation guard, Non-Goals all from
readymachinery; no new flags/settings.Unit. Assert
runReadyGateis called withpolicy ← settings.ready.policy,maxIterations ← config.maxIterations,tokenBudget ← undefined(parity withreadysans--budget); stagnation + Non-Goals are internal torunReadyGate. Assert no CLI option added beyond--ready-gate.AC-5 — Without the flag, run behavior byte-identical; existing run-path tests pass unmodified.
Integration (regression). Existing
batch-executorsuite runs green with no edits; gate code is gated behindconfig.readyGate.AC-6 — Run summary + PR body surface the gate outcome as
readydoes (threshold reached vs guard halt).Integration. Reuse
formatReadyReportoutput; assert the PR body and end-of-run summary carry the stop-reason/headline.AC-7 — Docs in main README, marketplace README, and
docs/.Manual/Docs. Verify content coverage (flag purpose, opt-in, never-merges) in all three locations — not just file existence.
Implementation Plan
Phase 1 — Wire the flag (AC-3, AC-4)
bin/cli.ts: add.option("--ready-gate", "After phases succeed, run the post-QA ready gate — never merges")to theruncommand.src/lib/workflow/types.ts: addreadyGate?: booleantoRunOptionsandExecutionConfig(with behavior-promising doc comments so the dead-surface guard has a declaration to see).src/lib/workflow/config-resolver.ts: mapRunOptions.readyGate → ExecutionConfig.readyGatein the return object.Phase 2 — Invoke the engine at the PR seam (AC-1, AC-2, AC-6)
4.
src/lib/workflow/batch-executor.ts(executeIssue): whensuccess && config.readyGate, beforerebaseBeforePR/createPR, callrunReadyGate({ worktreePath, policy: settings.ready.policy, maxIterations: config.maxIterations, tokenBudget: undefined, nonGoals: parseNonGoals(body), phaseTimeout: config.phaseTimeout, mcp: config.mcp, verbose, runPhase, onProgress }). Placing it before rebase/PR ensures the gate's auto-fix commits land in the PR.5. Feed the gate outcome into
createPR(extend the existingqaVerdictargument path) and into the end-of-run summary viaformatReadyReport.6. Persist
result.issueStatusfrom the gate (waiting_for_human_merge/blocked) — never merge.Phase 3 — Tests & docs (AC-3, AC-5, AC-7)
7. Wiring test (dead-surface + call-args) and behavior tests for AC-1/AC-2/AC-6; confirm the existing suite passes unmodified (AC-5).
8. Docs: main README, marketplace README,
docs/.Rule Touchpoints
The behavior-rule heuristic triggered on AC-4 (
default,behavior) and AC-5 (default,never,behavior), but every reported touchpoint is the detector's own doc/skill text — false positives. Unlike #533 (a rule duplicated in a SKILL.md prompt),--ready-gateis pure runtime CLI behavior with no LLM-interpreted duplicate, so the sole genuine touchpoint is the runtime seam:src/lib/workflow/batch-executor.ts(PR seam)if (success && config.readyGate) { runReadyGate(...) }The real hazard here is the inverse of #533 — a dropped single wire (the #795 class), which AC-3's end-to-end test guards directly.
Design Review
batch-executor.executeIssueat the existing post-success / pre-PR seam; the engine (runReadyGate) already exists — the header atready-gate.ts:20-22designed this exact reuse. No engine changes.runReadyGatewith args sourced from existing settings/config. Rejected: a run-specific gate re-implementation (duplicates the engine, violates AC-4).src/commands/ready.ts'srunReadyGatecall site (worktree resolution, Non-Goals parse,runPhase=executePhaseWithRetrywrapper,onProgress). Flag-tracing mirrors--auto-wait/autoWaitMinutesthroughconfig-resolver.--budget/--policyon run?" → AC-4 forbids new surface; policy comes fromsettings.ready.policy, budget stays disabled asreadydoes without--budget.Open Questions
-Qinteraction — Recommendation: run the gate per-issue at theexecuteIssueseam (naturally per-issue, in scope). Chain-level coordination is explicitly out of scope; if non-trivial interaction surfaces during exec, note and defer. Impact if wrong: a chained run could gate mid-stack — but the seam is per-issue, so this is contained.tokenBudgetundefined on the run path (parity withreadysans--budget); themaxIterationscap already bounds cost. Impact: an unbounded-token gate is still iteration-capped, so acceptable.Recommended Workflow
Phases: spec → exec → qa · Quality Loop: enabled
Reasoning: Matches the prior
/assessrecommendation (spec,exec,qa, quality-loop=true). Considered adding testgen since AC-1/2/3/6 are Integration-verified and AC-3/AC-5 are test-defined — but the guarding tests here are tightly coupled to the wiring (dead-surface + call-args) and are best hand-authored alongside the seam rather than pre-stubbed. Recommend authoring them inline during exec. Notest/browser phase (CLI-only). Nosecurity-review(no auth/payments/file-ops surface).Label Review
Current:
enhancement,cliRecommended: add
planned. Keepenhancement,cli.Quality Loop: enabled — a test-heavy, wiring-critical AC set benefits from the loop catching regressions.
admarble commentedon Jul 28, 2026
Complexity: Standard (7 ACs, ~4 directories)
AC Quality Check
Programmatic lint N/A — the issue's ACs are unlabeled checkboxes (
- [ ] …), so theAC-N:-anchored parser returns 0. Numbered AC-1…AC-7 inline below. Text quality is strong (measurable, scoped, each ties to a named failure mode). One residual ambiguity flagged as an Open Question: AC-2's word "escalated" under the defaultacpolicy.Scope Assessment
Non-Goals: Present and specific — auto-merge /
mergerin default phases, MCP exposure,-Qsemantic changes, non-trivial batch/chain interaction (defer-and-note).Verdict: ✅ SCOPE_OK — pure wiring of an already-shipped engine (
runReadyGate); zero new engine/policy code.Acceptance Criteria
AC-1:
run --ready-gateinvokesrunReadyGateafter phases succeed; terminates PR-open, gap-report produced,ready-terminal status, never mergesVerification: Integration Test
Scenario: Given
sequant run <n> --ready-gateon an issue whose standard phases pass → When the run finishes → ThenrunReadyGateran, a PR is open, persisted status iswaiting_for_human_merge/blocked(notready_for_merge), and no merge occurred.AC-2: With flag,
AC_MET_BUT_NOT_A_PLUSis escalated through the gate per policy; without flag, #749 behavior unchangedVerification: Integration Test
⚠️ See Open Question 1 — under the default
Scenario: Given a QA verdict of
AC_MET_BUT_NOT_A_PLUS→ When run with--ready-gate→ Then the gate re-drives per policy; When run without → Then it breaks to PR with the verdict surfaced (#749), unchanged.acpolicy,isAtThreshold('ac', 'AC_MET_BUT_NOT_A_PLUS')is alreadytrue(ready-gate.ts:151), so "escalation" = a fresh full-weight QA second look (which can downgrade toAC_NOT_METand then loop-fix), not an auto-A+ push. Onlya-pluspolicy drives toREADY_FOR_MERGE.AC-3: Flag wired end-to-end (bin/cli.ts → RunOptions → ExecutionConfig → executor); a test fails if the flag stops reaching the engine
Verification: Unit + Integration Test
Scenario: Given the flag set → When resolved → Then it reaches the gate call site; a spy/injection test asserts the gate is invoked iff the flag is set, and the
run-options-dead-surfaceguard is extended soreadyGatecan't go inert like--qa-gate(#795).AC-4: Policy, iteration cap, token budget, stagnation guard, Non-Goals all come from existing
readymachinery; no new flags/settings beyond--ready-gateVerification: Integration Test
Scenario: Given
--ready-gatewith no other new options → When the gate runs → Then policy =settings.ready.policy,maxIterations/tokenBudget/phaseTimeout/mcpcome from the resolved run config, and Non-Goals are parsed from the issue body (mirror ready.ts:101-136). No new settings key, no new CLI option.AC-5: Without the flag, run behavior is byte-identical (existing run-path tests pass unmodified)
Verification: Integration Test (regression)
Scenario: Given no
--ready-gate→ When the run executes → Then the gate branch is never entered and every existing batch-executor/run-orchestrator test passes without edits.AC-6: Run summary and PR body surface the gate outcome the same way
sequant readyreports itVerification: Integration Test
Scenario: Given a completed gate → When the summary + PR body render → Then the terminal reason (threshold reached vs guard halt:
MAX_ITERATIONS/TOKEN_BUDGET/stagnation) is shown consistently withready's report headline.AC-7: Documentation in main README, marketplace README, and docs/
Verification: Manual Test (docs coverage — verify content, not file existence)
Scenario: Given the flag ships → When docs are checked → Then
README.md, the marketplace/plugin README (source ofdist/marketplace/external_plugins/sequant/README.md— locate the committed source during exec), and adocs/features/entry all document--ready-gate, its default-off semantics, and the never-merges guarantee.Implementation Plan
Phase 1: Wire the flag (the #795-guarded seam)
bin/cli.tsrun command: add.option("--ready-gate", "Run the post-QA ready gate before handing back to the human (never merges)").src/lib/workflow/types.ts: addreadyGate?: booleanto RunOptions and to ExecutionConfig (both, with intent-stating doc comments).RunOrchestrator.resolveConfig(run-orchestrator.ts): mapoptions.readyGate → config.readyGate; propagate into the run-log config schema next toqaGatefor observability.Phase 2: Invoke the gate at the per-issue seam
runIssueWithLogging(batch-executor.ts): afterconst success = completedSuccessfully(~L1317) and before PR creation (~L1382), add a guarded block:if (config.readyGate && success && worktreePath) { … }. Build arunPhasewrapper viaexecutePhaseWithRetry(mirror ready.ts:208-217), parse Non-Goals from the issue body, resolve policy/bounds from settings+config, callrunReadyGate, then set the persisted status to the gate's terminal status instead ofready_for_merge. PR creation then runs against the gate-improved worktree.IssueResultcarries the gate outcome so the summary/PR body (AC-6) can render it; reuseReadyResult.report/reason.Phase 3: Surface + document
displaySummary(run-display.ts) and the PR body (extend the fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749qaVerdictsurfacing increatePR).Key decision — where the gate fires: Before PR creation (recommended) so the PR reflects gate-improved state and opens once. Alternative (after PR creation, then update) means an extra PR-body edit and a transient
ready_for_mergestatus. Recommend before-PR.Rule Touchpoints
The "default off / never merges / unchanged without the flag" rule lands at multiple sites — enumerate so none goes stale (motivating miss: #533):
bin/cli.tsrun.option("--ready-gate")types.tsRunOptions + ExecutionConfigrun-orchestrator.ts resolveConfigbatch-executor.ts runIssueWithLogginggate blockconfig.readyGateready-gate.tsengineDesign Review
runReadyGate) already exists; the only new logic is a guarded call insiderunIssueWithLogging, plus the flag plumbing. No new module.runPhase/Non-Goals/policy resolution verbatim. Rejected: a new orchestrator phase (over-engineered; the gate owns its own qa→loop→qa loop).acpolicy actually escalateAC_MET_BUT_NOT_A_PLUS, or no-op?" → answer in Open Q1. (b) Chain/batch interaction — Non-Goals says gate runs per-issue after that issue's phases; confirm the seam is per-issue (it is — insiderunIssueWithLogging) and note if chain adds anything non-trivial.Feature Quality Planning
All standard checks pass. Notable items:
run-options-dead-surface.test.tsAND add a behavioral spy test; the source-text guard alone doesn't prove the flag reaches the engine.ready_for_mergewithwaiting_for_human_merge/blocked; verify write-ordering vs PR creation.Open Questions
acpolicy. Underac,AC_MET_BUT_NOT_A_PLUSis already at threshold, so the gate's value is a fresh full-weight QA second look (the 44%-defect-catch), not an auto-A+ push; onlya-plusdrives toREADY_FOR_MERGE. Recommendation: implement as-is (reuse policy semantics unchanged) and make the summary wording distinguish "gate re-verified, ACs hold" from "gate drove to A+". Impact if unaddressed: reviewers may expect--ready-gatealone to reach A+ and be surprised it stops at AC-met.dist/marketplace/external_plugins/sequant/README.mdduring exec (generated artifact — don't edit dist).Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled
Reasoning: Enhancement with 7 ACs dominated by Integration/Unit-Test verification (esp. the AC-3 wiring guard) → testgen stubs the wiring + regression tests before exec. Quality loop matches the prior
/assess(quality-loop=true). Blocker#820is now closed/merged (via #828), so the assess "land after #820" caveat is cleared. No UI surface → notestphase. Not security-sensitive → nosecurity-review.Label Review
Current: enhancement, planned, cli
Recommended: unchanged
Reason: labels already match — CLI enhancement, planning complete.
Quality Loop: will run (assess set quality-loop=true; wiring + regression benefit from the loop).
admarble commentedon Jul 28, 2026
✅ /exec — Implementation complete (#817)
PR: #832
Opt-in
--ready-gateonsequant runnow invokes the existingrunReadyGateengine after an issue's standard phases succeed, driving it tosettings.ready.policybefore the PR opens (so the gate's fixes land in it), then stops at the human merge gate — it never merges.AC coverage
ready-terminal status; never mergesAC_MET_BUT_NOT_A_PLUSescalates; without flag, #749 preservedready; no new settingsreadydoesKey files changed
bin/cli.ts—.option("--ready-gate", …)src/lib/workflow/types.ts—readyGateonRunOptions+ExecutionConfig;readyGate: ReadyResultonIssueResultsrc/lib/workflow/config-resolver.ts— mapsmergedOptions.readyGate → ExecutionConfig.readyGatesrc/lib/workflow/batch-executor.ts—runReadyGateForIssuehelper + gate invocation at the post-success/pre-PR seam; persists gate terminal statussrc/lib/workflow/worktree-manager.ts— gate report surfaced in the PR body (prefers it over the standalone fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 note)src/commands/run-display.ts— per-issue gate outcome in the run summaryREADME.md,scripts/prepare-marketplace.ts,docs/reference/run-command.md,docs/features/run-ready-gate.mdready-gate-run.test.ts(behavioral wiring),run-options-dead-surface.test.ts(live-surface guard),worktree-manager.build-pr-body.test.ts,run-display.test.tsChecks
npm run build✅ ·npm run lint✅ · touched suites green (existingbatch-executor.test.tsunmodified — AC-5 regression)Quality Plan Alignment
ready_for_mergebefore PR creation; verified by testNotes / deferred
acpolicy) is documented indocs/features/run-ready-gate.md: underac, the gate's value is a fresh second look, not an auto-A+ push (setready.policy: a-plusfor that).admarble commentedon Jul 28, 2026
QA Review for Issue #817
AC Coverage
ready-terminal status; never mergesbatch-executor.ts:1462runs the gate before checkpoint/rebase/PR; persistsreadyGateResult.issueStatus(waiting_for_human_merge/blocked), neverready_for_merge.updatePRInfodoesn't touch status, so the terminal status survives PR creation. No merge call exists.AC_MET_BUT_NOT_A_PLUSescalated; without flag #749 preservedphase-executor.ts:754: onlyAC_NOT_MET/null hard-fail, soAC_MET_BUT_NOT_A_PLUS→success:true→ reaches the gate. Without the flag the gate block is skipped and the #749 PR-body note is emitted.bin/cli.ts.option→RunOptions→ExecutionConfig→config-resolver→batch-executor→runReadyGate. Guarded by the live-surface source test + behavioralready-gate-run.test.ts. See coverage note below.ready; no new flags/settingsrunReadyGateForIssuesourcespolicy ← settings.ready.policy,maxIterations ← config,tokenBudget: undefined, Non-Goals parsed from the body. Only--ready-gateadded; no new settings key. Asserted inready-gate-run.test.ts"AC-4".config.readyGate; existingbatch-executor.test.tspasses unmodified. Flag-off assertion in the wiring test.readydoesbuildAutomatedPRBodyembedsreadyGateResult.report(and suppresses the standalone #749 note to avoid a double headline);run-display.tsrenders the per-issue outcome. Tests inworktree-manager.build-pr-body.test.ts+run-display.test.ts.README.md,scripts/prepare-marketplace.ts(marketplace README source),docs/reference/run-command.md, anddocs/features/run-ready-gate.md.Coverage: 7/7 AC items fully met.
CI Status
CI Summary: 5 passed, 0 pending, 0 failed (PR #832).
Quality Metrics
any/as anyin src)npm run build/npm run lintTest Coverage Analysis
batch-executor.tsready-gate-run.test.ts(behavioral) + unmodifiedbatch-executor.test.tsworktree-manager.tsworktree-manager.build-pr-body.test.tsrun-display.tsrun-display.test.tstypes.tsrun-options-dead-surface.test.tsconfig-resolver.tsrun-options-dead-surface.test.tsasserts the mapping string; no behavioral resolver testbin/cli.tsrun --helpTouched suites: 118 tests, all green.
CLI Registration Verification
readyGate(RunOptions + ExecutionConfig)mergedOptions.readyGate(config-resolver) →config.readyGate(batch-executor)--ready-gatein bin/cli.ts (confirmed viarun --help)Verification Status: Passed.
Code Review
Strengths:
runReadyGate) is reused wholesale, no engine changes.updatePRInfonever overwrites it, so the never-merge contract holds.buildAutomatedPRBodycorrectly prefers the gate report over the standalone fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 note, avoiding a contradictory double headline.Issues: None blocking.
Suggestions (non-blocking):
config-resolvertest assertingbuildExecutionConfig({readyGate:true}, …).readyGate === true. The resolver→config link is currently guarded only by a source-grep in the dead-surface test — a stronger end-to-end guard than a string match.Risk Assessment
sequant run --chain --ready-gateresume re-executes already-gated links. A gated chain link terminates aswaiting_for_human_merge/blocked, butchain-resume.tsCOMPLETED_STATUSES = {ready_for_merge, merged}— so on resume the link is treated as incomplete and re-run from scratch (wasteful, not incorrect). Relatedly, the chain checkpoint-failure warning message still says "stays ready_for_merge", which is inaccurate for a gated link.runIssueWithLoggingis the sole per-issue run-path PR seam;sequant ready(the otherrunReadyGatecaller) already owns the gate. No cross-file sibling requiring the same change.config.readyGate && success && worktreePath.Adversarial Re-Read
Findings: Non-Goals are respected (no auto-merge, no
mergerin default phases, no MCP surface,-Qunchanged). No motivating-example fixtures in the issue body to run (feature spec, not a bug repro). No evidence-claim-as-bug-repro. Process state clean (HEAD pushed, no uncommitted work, 0 behind main). One real gap surfaced: the chain + ready-gate resume interaction above — a gated chain link isn't inCOMPLETED_STATUSES, so resume re-runs it and the checkpoint-failure message is inaccurate for gated runs. This falls inside the explicitly-deferred chain Non-Goal and the docs note that chain coordination is out of scope, but the specific resume-redo consequence is worth a tracked follow-up.Status: Gaps Found
CHANGELOG Verification
Result: CHANGELOG requirements met.
Verdict: AC_MET_BUT_NOT_A_PLUS
All 7 ACs are objectively MET, CI is green, and the single-issue
run --ready-gatefeature is well-tested and mergeable. Two meaningful, non-blocking improvements keep it from A+: (1) the--chain --ready-gateresume-redo interaction (deferred Non-Goal, but worth a follow-up issue so the surprise is tracked), and (2) a behavioral config-resolver test to harden the AC-3 wire beyond a source grep. This is a break-to-PR verdict — do not run/loop(the ACs hold; these are follow-ups, not gaps in the AC contract).Documentation
/docs 817.Next Steps
sequant run#832 when ready (human merge gate — the feature's whole point).--ready-gateresume treats gated links (waiting_for_human_merge/blocked) as incomplete → re-executes on resume; also correct the checkpoint-failure warning text for gated runs.config-resolvertest for thereadyGatemapping.admarble commentedon Jul 28, 2026
QA Review for Issue #817 (fresh second look @
56bc3c2)Re-run at the same SHA as the prior QA (which short-circuits by default). Done deliberately as a fresh-session adversarial pass on an
AC_MET_BUT_NOT_A_PLUSverdict — and this time AC-3's guard was mutation-tested rather than read. It does not hold.AC Coverage
ready-terminal status; never mergesbatch-executor.ts:1464→ checkpoint:1502→ rebase:1532→ PR:1558. Terminal status comes fromreadyGateResult.issueStatus, whichready-gate.tsfinish()constrains towaiting_for_human_merge|blocked—ready_for_mergeis unreachable on the gated path. No merge call exists anywhere in the seam.AC_MET_BUT_NOT_A_PLUSescalated per policy; without flag #749 unchangedphase-executor.ts:754hard-fails only onAC_NOT_MET, so anAC_MET_BUT_NOT_A_PLUSqa returnssuccess: true→phasesFailedfalse →completedSuccessfullytrue → the gate'ssuccessguard passes and the gate runs. Theac-policy caveat (at threshold already, so the value is the fresh second look, not an auto-push to A+) is explicitly documented indocs/features/run-ready-gate.md.readymachinery; no new flags/settingsrunReadyGateForIssuetakes policy fromsettings.ready.policy(same source asready.ts:103), cap fromconfig.maxIterations,tokenBudget: undefined(parity withreadysans--budget), Non-Goals viaparseNonGoals, stagnation guard internal to the engine.fullQa: trueis set insidebuildPhaseConfig, so the run path inherits full-weight QA without re-plumbing it. Only--ready-gatewas added.config.readyGate; resolver defaults it tofalse. Verified behaviorally:buildExecutionConfig({}, settings, 1).readyGate === false.batch-executor.test.tsuntouched in the diff.readydoesrun-display.ts:212-229renders reason/policy/iterations/status per gated issue;buildAutomatedPRBodyprefersreadyGateReportover the #749 note (avoiding a contradictory double headline). Both covered by tests.scripts/prepare-marketplace.ts:389-401;docs/reference/run-command.md:68,252;docs/features/run-ready-gate.md(new). All three locations present, with real content — not just a flag-table row.Coverage: 6/7 fully met · Original ACs: 6/7 · Derived ACs: none in the spec comment.
Mutation Testing (AC-3) — the finding
CLAUDE.mdnow requires gate tests to ship mutation-verified ("a test whose job is to gate a claim — a flag is wired — must be mutation-verified… delete the thing it asserts, confirm exactly that test fails"). AC-3 is that kind of AC, so I ran the mutations instead of reading the tests. Baseline: 35 tests green across the four #817 suites..option("--ready-gate", …)frombin/cli.tstscclean)run 999 --ready-gatethen errorsunknown option '--ready-gate'readyGate: mergedOptions.readyGate→mergedOptions.readyGate && falseinconfig-resolver.ts__tests__/config-resolver.test.ts)config.readyGate→config.fullQaat the executor call siteMutation 2 is the defect. The flag parses,
RunOptions.readyGateis set, and--ready-gatesilently does nothing — the entire test suite stays green. The source-level guard inrun-options-dead-surface.test.ts:194asserts only the substring/readyGate:\s*mergedOptions\.readyGate/, which the mutation preserves verbatim. That is the unscoped-file-read failure classCLAUDE.mdcalls out, applied to the one linkconfig-resolver.ts:259's own comment calls "the load-bearing wire the #795 inert-flag class guards against."AC-3's text is literal: "a test fails if the flag stops reaching the engine." Under mutation 2 the flag stops reaching the engine and no test fails. → PARTIALLY_MET.
The repo already has the pattern, from three PRs ago.
--auto-wait(#804) ships insrc/lib/workflow/auto-wait.test.ts:658a test literally named "the CLI flag reaches ExecutionConfig", plus:665"Commander'sautoWaitkey maps ontoautoWaitMinutesend-to-end" drivingresolveRunOptions→buildExecutionConfig. Those two tests close mutations 2 and 1 respectively. #817 — whose AC mandates the guard — ships a substring grep instead.Fix (small, ~12 lines, in
__tests__/config-resolver.test.ts):Then re-run mutation 2 and record the result in the PR body per the new
CLAUDE.mdrule.Fairness note: the
CLAUDE.mdmutation-record rule postdates this branch, so the missing record is a new-standard artifact, not a regression by this PR. The missing test is not — AC-3 demanded it independently, before the rule existed.Execution Evidence
The wire itself works today; only its guard is missing. Verified directly, not inferred:
npx tsx bin/cli.ts run --help--ready-gate After phases succeed, run the post-QA ready gate…buildExecutionConfig({readyGate:true}, settings, 1).readyGatetruebuildExecutionConfig({}, settings, 1).readyGatefalsesettings.ready.policy/settings.run.maxIterationsac/3npx tsc --noEmitEvidence status: Complete. Worktree restored to clean
56bc3c2after all mutations (git status --porcelainempty, baseline re-verified green).CI Status
typecheckbuild (22.x)validate-skillsvalidate-pluginnode-floor-guardCI Summary: 5 passed, 0 pending, 0 failed. Not infra-blocked. No CI-dependent AC is gated.
Stale Branch Check
origin/mainQuality Metrics
any)Test Coverage Analysis
src/lib/workflow/batch-executor.tsready-gate-run.test.ts(behavioral, mutation-confirmed)src/lib/workflow/worktree-manager.tsworktree-manager.build-pr-body.test.tssrc/commands/run-display.tsrun-display.test.tssrc/lib/workflow/types.tsrun-options-dead-surface.test.ts(declaration guard)src/lib/workflow/config-resolver.tsbin/cli.tsunknown option)scripts/prepare-marketplace.tsCoverage: 4/7 changed source files have behavioral tests. Critical paths without tests: none security-sensitive; the one that matters is
config-resolver.ts.Code Review
Strengths:
runReadyGateForIssuetakes a flat primitive arg bag with injectablerunGate/getSettingsFn/fetchBody, which is why the behavioral test can driverunIssueWithLoggingend-to-end without shelling out togh.updatePRInfodoesn't overwrite it, so the never-merge contract survives the PR step.fullQais set inside the engine'sbuildPhaseConfig, not at the call site — the run path inherits full-weight QA for free and can't drift fromsequant ready.ac-policy caveat ("the gate's value there is the fresh second look… rather than an automatic push to A+") pre-empts the obvious user surprise.Issues:
config-resolverlink is guarded by a substring match that a behavior-preserving mutation defeats. Detailed above.Suggestions (non-blocking):
finalStatusfalls back toready_for_merge— the pre-feat(run): --ready-gate — run the post-QA ready gate insidesequant run(automates the any-gaps/fix-gaps second look, stops at human merge) #817 value — after a warning log. That is the documented intent, but it means a gate crash leaves the issue looking gate-approved. Considerblockedinstead, so a crashed gate can't read as a passed one.--ready-gateresume: a gated link terminateswaiting_for_human_merge/blocked, neither of which is inchain-resume.ts'sCOMPLETED_STATUSES— resume re-runs it from scratch. Wasteful, not incorrect, and inside the explicit chain Non-Goal. Worth a tracked follow-up.Test Quality Review
ready-gate-run.test.tsis genuinely behavioral (mutation 3 kills it). Therun-options-dead-surface.test.tsadditions are source-string assertions — mutation 2 walks past them.runReadyGateargs asserted (AC-4); PR body and summary both covered.ready-gate-run.test.ts. Justified for a wiring test throughrunIssueWithLogging, but it is at the edge of over-mocking.Anti-Pattern Detection
Dependency Audit
N/A —
package.jsonnot modified.Code Patterns
No hardcoded secrets, no SQL concatenation, no
0.0.0.0bind, no empty catch (the one catch logs a warning and returnsundefineddeliberately), no uncleared timers, noawait-in-loop introduced by this diff.Critical Issues: 0 · Warnings: 0
Call-Site Review
New exported functions detected: 0 —
runReadyGateForIssueis module-private (single call site atbatch-executor.ts:1464, correctly guarded byconfig.readyGate && success && worktreePath).buildAutomatedPRBody/createPRgained optional params; both call sites updated and covered.CLI Registration Verification
readyGate(RunOptions → ExecutionConfig)mergedOptions.readyGate→config.readyGate--ready-gateinbin/cli.ts(confirmed viarun --help)Verification Status: Passed — the registration exists. The gap is the missing test for the link below it, scored under AC-3.
Skill Command Verification
N/A — no
.claude/skills/**/*.mdfiles changed.Detection Pattern Verification
N/A — no skill-markdown regex/grep/awk/jq/sed changes in the diff.
Smoke Test
npx tsx bin/cli.ts run --helpbuildExecutionConfig({readyGate:true}, …)truebuildExecutionConfig({}, …)false— AC-5 default-off holdsunknown option, not a silent no-opSmoke Test Status: Complete.
Behavior-Rule Survival Check
finish()inready-gate.tsmakesready_for_mergeunreachable on the gated pathfalse;batch-executor.test.tsuntouchedStatus: Clean
CHANGELOG Verification
feat:)[Unreleased]entry with issue numberResult: CHANGELOG requirements met.
Risk Assessment
buildExecutionConfig(spread reordering, a rename, a stray??change) can silently re-inert--ready-gatewith the full suite green. That is chore(run): --qa-gate is an inert no-op flag — remove or make it actually gate #795 verbatim, and chore(run): --qa-gate is an inert no-op flag — remove or make it actually gate #795 is the failure this PR was written to prevent. Because the gate's absence is silent — the run just… doesn't gate — nobody would notice until a second-look defect ships.RunOptions → ExecutionConfigmapping behaviorally; the Commander-key →RunOptionshop; chain +--ready-gateinteraction (explicit Non-Goal); the gate-failure fallback status.__tests__/config-resolver.test.tsbehaviorally guards--no-mcp/--no-retry;auto-wait.test.ts:658,665behaviorally guards--auto-waitthrough both hops.readyGateis the outlier among recently-added resolver fields — the sibling pattern exists and was not followed.src/commands/ready.ts(the otherrunReadyGatecaller) needs no change; its own driver is unaffected.autoWaitMinutes,relayEnabled,isolateParallel) share the "flag → config" shape;autoWaitMinutesis tested,isolateParallelis not — but perreference_worktree_reuse_semantics,isolateParallel/worktreeIsolationis a known programmatic-only surface, so its absence is not the same defect.Trust-Boundary Check
Finding: Clean — the diff implements only product requirements from #817's ACs. The issue body contains no HTML comments, no fenced blocks issuing agent-directed commands, and no external URLs to fetch or post to. The one imperative in the issue's comment thread — "⚠ Land after #820" — is benign maintainer process guidance (and #820 has since merged as
4c258a6), not an execute/fetch/exfiltrate payload. No new network calls, file reads, or shell-outs appear in the diff beyond the existingGitHubProvider.fetchIssueBodySyncused for Non-Goals parsing, which is the same callsequant readyalready makes.Status: Clean
Adversarial Re-Read
Findings: Rather than re-reading the tests, I mutated them — which is what surfaced the AC-3 gap the previous pass accepted (three mutations, results tabulated above; worktree restored clean and re-verified green). Beyond that: no verbatim motivating-example fixtures exist in the issue body to run (this is a feature spec, not a bug repro), so nothing was skipped there. The evidence claims in the exec comment were audited — they describe post-change state, not pre-fix repros. Process state inspected: HEAD
56bc3c2pushed and clean, 2 commits behind main (under threshold), no stashes, no divergence. Sibling sites cited concretely in Risk Assessment (auto-wait.test.ts:658/665as the established pattern this PR diverges from). Non-Goals checked against the diff: no auto-merge path, nomergerin default phases, no MCP surface,-Qsemantics untouched, and chain interaction deliberately left alone with the resume consequence recorded as a follow-up. One additional gap surfaced beyond AC-3: the gate-failure fallback writesready_for_merge, so a crashed gate is indistinguishable from a passed one in state.Status: Severe Gap — an AC (AC-3) was marked MET on code review alone in the prior pass, when the runtime check its own text required (a mutation that breaks the wire) shows the test does not fail.
Verdict: AC_NOT_MET
Six of seven ACs are solidly met, and the feature itself works — I confirmed the flag reaches
ExecutionConfigby execution, CI is green, and the design is clean. This is not a broken feature.AC-3 is the exception, and it is the AC that exists specifically to prevent #795 from recurring. Its text is a testable contract — "a test fails if the flag stops reaching the engine" — and a one-token mutation to
config-resolver.ts:259makes--ready-gatepermanently inert while 145 tests stay green. The line's own comment calls that link "the load-bearing wire the #795 inert-flag class guards against"; it is the one link with no behavioral guard. The prior QA pass marked AC-3 MET by reading the guard rather than mutating it, and flagged the behavioral resolver test as an optional suggestion — it is not optional, it is the AC.The fix is roughly twelve lines, copied from the pattern
--auto-wait(#804) already established in this repo. This is a genuine AC gap, not a prose recommendation — it is loopable.Documentation
scripts/prepare-marketplace.ts)reference/run-command.md+ newfeatures/run-ready-gate.md)Next Steps
__tests__/config-resolver.test.ts(snippet above), mirroringauto-wait.test.ts:658/665.readyGate: mergedOptions.readyGate && false), confirm exactly those tests fail, restore, and record the result in the PR body per the newCLAUDE.mdgate-test rule.blockedrather thanready_for_mergeon the gate-failure fallback path, so a crashed gate can't read as a passed one.--ready-gateresume treats gated links (waiting_for_human_merge/blocked) as incomplete and re-executes them; the checkpoint-failure warning text is also inaccurate for gated runs.sequant run#832 after (1)–(2). The human merge gate stays human — that is the feature's whole point.fix(#817): close the AC-3 wiring guard and stop a crashed ready gate …
chore: merge origin/main into feature/817
admarble commentedon Jul 28, 2026
Gap fixes applied (#817) — re-QA of
ebaeb07All gaps from the previous review are closed. Commit
6725cc8, plusebaeb07mergingorigin/main.AC-3 — the blocking gap
Before: mutating
config-resolver.ts:259tomergedOptions.readyGate && falseleft--ready-gatepermanently inert with 145 tests green. The guard asserted only the substringreadyGate: mergedOptions.readyGate, which that mutation preserves verbatim.Now: all three links of AC-3's chain are guarded behaviorally, following the pattern
--auto-wait(#804) already established inauto-wait.test.ts.Added to
__tests__/config-resolver.test.ts:ExecutionConfigfalsewhen the flag is absent (AC-5 default-off — catchesundefinedtoo)resolveRunOptionshop end-to-end (Commander key → config)Added to
run-options-dead-surface.test.ts:--ready-gateis registered on theruncommand inbin/cli.ts, scoped to that command's own section (same extraction asassess-skill.test.ts) so a comment or another command's help text can't satisfy it. The pre-existing resolver source-grep is kept and now documents itself as a shape-only tripwire that is explicitly not sufficient alone.Mutation record (per the
CLAUDE.mdgate-test rule)Each mutation applied against the four touched suites, then reverted and re-confirmed green:
.option("--ready-gate")frombin/cli.ts&& false(source shape preserved)config.fullQainsteadreadyGateErrorfromIssueResultBefore
6725cc8, M1 and M2 both left the whole suite green. M1 is self-detecting at runtime (Commander rejects the unknown option); M2 was the silent #795 class — the one that mattered.(Two figures in my earlier commit message were wrong — M3 is 6, not 4; M4 is 1, not 2. Corrected before push; the table above is the measured result.)
Gate-failure visibility (the second gap)
A gate that threw returned
undefined, so the issue vanished from the summary's ready-gate section — a run whose gate crashed looked identical to one that gated cleanly.The helper now returns
{ result?, error? },IssueResultcarriesreadyGateError, and the summary renders:Status deliberately stays
ready_for_mergeon that path rather than flipping toblocked, as I'd floated in the review. On reflectionblockedis wrong: the run degraded to an ordinary run and nothing about the work is actually blocked. The real defect was invisibility, so the fix is visibility. Documented indocs/features/run-ready-gate.md.Chain resume — filed, not fixed
#837. Verified in source:
chain-resume.ts:86hasCOMPLETED_STATUSES = {ready_for_merge, merged}, which excludes both gated terminal statuses, so--chain --ready-gateresume re-executes already-gated links from phase 0. Left to a follow-up because chain coordination is an explicit Non-Goal here — widening scope mid-PR is how Non-Goals rot.One correction to my earlier write-up: the stale "stays
ready_for_merge" text is a code comment atchain-resume.ts:175-181, not a user-facing warning. Captured accurately in #837.Verification
npx tsc --noEmitnpm run buildsrc/lib/workflow+src/commands+config-resolverbatch-executor.test.tsorigin/mainmergedebaeb07— two additive conflicts (CHANGELOG, marketplace README), both resolved keep-bothRevised AC Coverage
ready-terminal status; never mergesAC_MET_BUT_NOT_A_PLUSescalated per policy; #749 preserved without the flagreadymachineryCoverage: 7/7.
Verdict: READY_FOR_MERGE
The blocking AC-3 gap is closed and mutation-verified rather than asserted. The one remaining known interaction (#837) is an explicit Non-Goal of this issue, tracked separately, and cannot affect a non-
--chainrun.Merge is yours — the human merge gate is the feature's whole point.
feat(#817): --ready-gate — run the post-QA ready gate inside `sequant…
fix(#837): --ready-gate resume no longer re-executes already-gated is…
fix(cleanup-worktree): resolve the branch ref once — documented glob …
docs: 2.10 release-notes section + coverage gaps found by release audit
feat(#817): --ready-gate — run the post-QA ready gate inside sequant run
fix(#817): close the AC-3 wiring guard and stop a crashed ready gate …
chore: merge origin/main into feature/817
fix(cleanup-worktree): resolve the branch ref once, and let the docum…
feat(run): fresh-session QA — never resume the exec session into qa; …
test(#1233): #817 ready-gate standard-status tests run a qa phase