Repository navigation
Conversation
Opt-in --ready-gate flag on `sequant run` invokes the existing `runReadyGate` engine after an issue's standard phases succeed, driving it to the configured ready.policy before the PR opens (so the gate's auto-fix commits land in the PR), then stops at the human merge gate — it never merges. - Wire the flag end-to-end: bin/cli.ts .option → RunOptions → ExecutionConfig → config-resolver → batch-executor → runReadyGate. - Invoke the gate at the post-success/pre-PR seam in runIssueWithLogging; persist the gate's terminal status (waiting_for_human_merge / blocked) instead of ready_for_merge. - Reuse ready's policy, iteration cap, stagnation guard, and Non-Goals handling — no new settings. Token budget stays disabled on the run path (the iteration cap bounds cost). - Surface the gate outcome in the PR body and end-of-run summary the same way sequant ready reports it. - Without the flag the run path is byte-identical (#749 break-to-PR unchanged); with it, AC_MET_BUT_NOT_A_PLUS escalates through the gate. - Guard the #795 inert-flag class with a source-level live-surface test and a behavioral wiring test that fails if the flag stops reaching the engine. - Docs: main README, marketplace README source, run-command reference, and a docs/features entry. Entire-Checkpoint: 3617e402a67b
7 tasks
…from passing silently QA second look mutation-tested AC-3's guard instead of reading it, and the guard did not hold. AC-3's contract is literal: "a test fails if the flag stops reaching the engine (the #795 inert-flag class)". It did not. Mutating the resolver mapping to `mergedOptions.readyGate && false` left `--ready-gate` permanently inert while 145 tests stayed green. The existing guard asserts only the substring `readyGate: mergedOptions.readyGate`, which that mutation preserves verbatim - the unscoped file-read class CLAUDE.md now calls out, landing on the one link whose own comment calls it "the load-bearing wire the #795 inert-flag class guards against". Closes all three links of AC-3's chain behaviorally, following the pattern --auto-wait (#804) already established in auto-wait.test.ts: - __tests__/config-resolver.test.ts: four binding assertions - the flag reaches ExecutionConfig, defaults to false without it (AC-5), survives the resolveRunOptions hop (Commander key -> config), and cannot be switched on by any settings key (AC-4 opt-in only). - run-options-dead-surface.test.ts: asserts `--ready-gate` is registered on the `run` command in bin/cli.ts, scoped to that command's own section so a comment or another command's help text cannot satisfy it. The pre-existing resolver source-grep is kept and documented as a shape-only tripwire that is explicitly not sufficient alone. Also fixes a gap the same pass surfaced: a gate that threw returned undefined, so the issue vanished from the summary's ready-gate section entirely. A run whose gate crashed was byte-identical to one that gated cleanly - the user opted into a second look and would believe it happened when it never did. The helper now returns { result?, error? }, IssueResult carries readyGateError, and the summary renders an explicit "gate did not run" line with the cause and the `sequant ready <n>` remediation. Status deliberately stays ready_for_merge: the run degraded to a standard run and nothing about the work is blocked; the fix is visibility, not a status flip. Mutation-verified (per CLAUDE.md gate-test rule), each against the four touched suites, restored and re-confirmed green between runs: baseline 0 failed / 63 passed M1 delete .option("--ready-gate") from bin/cli.ts 1 failed (new cli guard) M2 resolver mapping -> `&& false` (shape preserved) 4 failed (new bindings) M3 executor reads config.fullQa instead 6 failed (behavioral) M4 drop readyGateError from IssueResult 1 failed (new crash-path) M1 was previously undetected but is self-detecting at runtime (commander rejects the unknown option); M2 was the silent #795 class and is the defect this commit exists to close. Regression: 1607 tests across src/lib/workflow + src/commands pass, with batch-executor.test.ts untouched (AC-5 byte-identical-without-the-flag holds).
6 tasks
Resolves two additive conflicts, both "keep both" — main and this branch each appended a new section at the same insertion point: - CHANGELOG.md: #818 (merge --watch) and #817 (--ready-gate) both prepended an entry to [Unreleased] > Added. Kept both, #818 first. - scripts/prepare-marketplace.ts: both added a marketplace README section after the rate-limit-window one. Kept both, "Wait for CI, then verify" then "Running the ready gate inside run". No semantic overlap between the two changes. Post-merge: tsc clean, build clean, 1639 tests pass across src/lib/workflow + src/commands.
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--ready-gateflag tosequant runthat invokes the existingrunReadyGateengine (thesequant readyqa → loop → qagate) after an issue's standard phases succeed, before the PR is created — so the gate's auto-fix commits land in the PR.settings.ready.policythreshold, then stops at the human merge gate — it never merges. The run terminates with the issuewaiting_for_human_merge(threshold reached) orblocked(guard halt).ready's policy, iteration cap, stagnation guard, and Non-Goals handling — no new settings. Off by default; without the flag the run path is byte-identical (the fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR) #749 break-to-PR behavior is unchanged).Pre-PR AC Verification
ready-terminal status; never mergesbatch-executor.tsseam runsrunReadyGateForIssuebefore rebase/PR; persistsreadyGateResult.issueStatus, neverready_for_merge. Test:ready-gate-run.test.ts"AC-3/AC-1"AC_MET_BUT_NOT_A_PLUSescalates through the gate; without flag, #749 preservedconfig.readyGate; flag-off path untouched. Tests:ready-gate-run.test.ts(flag-on/off),worktree-manager.build-pr-body.test.ts(#749 note preserved when no gate)bin/cli.ts .option → RunOptions → ExecutionConfig → config-resolver → batch-executor → runReadyGate. Tests:run-options-dead-surface.test.tslive-surface guard +ready-gate-run.test.tsbehavioral wiringready; no new flags/settingsrunReadyGateForIssuesourcespolicy ← settings.ready.policy,maxIterations ← config,tokenBudget ← undefined, Non-Goals parsed from body. Test:ready-gate-run.test.ts"AC-4"config.readyGate; existingbatch-executor.test.tspasses unchanged. Test:ready-gate-run.test.ts"AC-5"readydoesbuildAutomatedPRBodyembeds the gate report;run-display.tsrenders the per-issue outcome. Tests:worktree-manager.build-pr-body.test.ts,run-display.test.ts(#817)docs/README.md,scripts/prepare-marketplace.ts(marketplace README source),docs/reference/run-command.md,docs/features/run-ready-gate.mdTest plan
npm run build— cleannpm run lint— cleannpx tsx bin/cli.ts run --helpshows--ready-gateready-gate-run.test.ts,run-options-dead-surface.test.ts,worktree-manager.build-pr-body.test.ts,batch-executor.test.ts(unmodified — AC-5),run-display.test.ts,config-resolver.test.tsNotes
-Qinteraction: the gate fires per-issue at therunIssueWithLoggingseam (naturally per-issue). Chain-level coordination is out of scope per the issue's Non-Goals. The concrete consequence —--chain --ready-gateresume re-executes already-gated links, becausechain-resume.ts'sCOMPLETED_STATUSESdoesn't include the gate's terminal statuses — is tracked in fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837.AC-3 mutation record (
6725cc8)QA's second look mutation-tested AC-3's guard rather than reading it, and the guard did not hold. AC-3's contract is literal — "a test fails if the flag stops reaching the engine (the #795 inert-flag class)" — and it didn't: mutating the resolver mapping to
mergedOptions.readyGate && falseleft--ready-gatepermanently inert with 145 tests green. The pre-existing guard asserted only the substringreadyGate: mergedOptions.readyGate, which that mutation preserves verbatim.6725cc8closes all three links behaviorally, following the pattern--auto-wait(#804) already established inauto-wait.test.ts. Mutation-verified per the repo's gate-test rule — each mutation applied to the four touched suites, then reverted and re-confirmed green:.option("--ready-gate")frombin/cli.ts&& false(source shape preserved)config.fullQainstead ofconfig.readyGatereadyGateErrorfromIssueResultBefore
6725cc8, M1 and M2 both left the entire suite green. M1 is self-detecting at runtime (Commander rejects the unknown option); M2 was the silent #795 class and is the defect this commit exists to close.Gate-failure visibility
The same pass surfaced a second gap: a gate that threw returned
undefined, so the issue disappeared from the summary's ready-gate section entirely. A run whose gate crashed was byte-identical in the summary to one that gated cleanly — the user opted into a second look and would believe it happened when it never did.The helper now returns
{ result?, error? },IssueResultcarriesreadyGateError, and the summary renders:Status deliberately stays
ready_for_mergeon that path: the run degraded to a standard run and nothing about the work is blocked. The fix is visibility, not a status flip.Closes #817