Repository navigation
fix(ready-gate): collapse the second ExecutionConfig producer so driver settings reach the gate (#863) - #1004
Merged
admarble merged 9 commits intoSep 8, 2026
Conversation
The ready gate never received the run's driver settings. `RunReadyGateOptions` had no `agent`/`aiderSettings` field at all, so neither caller could pass one, and `buildPhaseConfig` built each gate phase's `ExecutionConfig` from its own literal. With `run.agent: "aider"` configured, a project ran its main phases on aider and its ready-gate QA pass silently on claude-code — a mid-run backend switch with different cost, auth and behaviour that the user never asked for. Rather than add `agent`/`aiderSettings` as two more one-off primitives (today's instance of #833's drift class, already patched per-field at #914/#915/#936), collapse the second producer: `RunReadyGateOptions` now carries the caller's fully-resolved `ExecutionConfig` as one required `config` field, and `buildPhaseConfig` spreads it, overriding only the six gate-semantic keys in `GATE_CONFIG_OVERRIDES` (phases, qualityLoop, sequential, concurrency, parallel, dryRun). `commands/ready.ts` now resolves once via `buildExecutionConfig` instead of keeping inline `resolvePhasePolicies` / `effortEscalation` blocks in lockstep by hand; `batch-executor.ts` passes the parent run's config straight through. Inherited behaviour changes (the point of the fix, named so they are declared rather than discovered): - `retry` now honours `--no-retry` instead of being hardcoded true. - `autoWaitMinutes` now lets a rate-limited gate phase wait out the window (#804) instead of failing. - `relayEnabled` now reaches gate phases. - `skipVerification`, `noSmartTests`, `isolateParallel`, `issueType` inherit. - `readyGate: true` is inherited but inert — only `batch-executor` reads it, so there is no recursion; `phase-executor` never consults it. - Under `sequant run --ready-gate` the call site now passes `issueConfig`, so a docs-labelled issue's gate phases carry the same `issueType` its earlier phases had. `src/commands/ready.phase-policy.test.ts` is re-anchored from `opts.phasePolicies` onto `opts.config.phasePolicies` (spec Open Question 1 — keeping the top-level field would leave the duplicate channel this change exists to remove). New `execution-config-parity.test.ts` diffs both producers over the union of their keys and fails on any unallowlisted drift. Closes #863 Entire-Checkpoint: bfbeff23de75
`config-resolver.model-roles.test.ts` asserted that `commands/ready.ts` calls `resolvePhasePolicies` itself with `modelRoles` + `activeDriver` — written when ready.ts was the second ExecutionConfig producer. #863 deletes that producer, so both assertions failed against the new code. Re-anchored onto the invariant that replaced them: ready delegates to `buildExecutionConfig` and does not re-implement phase-policy resolution. The drift #975 detected is now structurally impossible rather than merely caught, and the behaviour it cared about (role: resolves, unknown role throws) is covered against the single producer by the AC-1/AC-2 cases in the same file. Assertions now match comment-stripped source. The old `/resolvePhasePolicies/` check passed against the new ready.ts only because a comment explaining the removal named the symbol — the whole-file-match trap CLAUDE.md warns about. Entire-Checkpoint: ea98aea86810
5 tasks
admarble
deleted the
feature/863-fix-ready-gate-driver-settings-never-reach-the-gat
branch
September 8, 2026 01:34
This was referenced Sep 8, 2026
Closed
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
The ready gate never received the run's driver settings.
RunReadyGateOptionshad noagent/aiderSettingsfield at all, so neither caller could pass one, andbuildPhaseConfigbuilt each gate phase'sExecutionConfigfrom its own literal. Withrun.agent: "aider"configured, a project ran its main phases on aider and its ready-gate QA pass silently on claude-code.Rather than add
agent/aiderSettingsas two more one-off primitives (today's instance of #833's drift class, already patched per-field at #914/#915/#936), this collapses the second producer:RunReadyGateOptionscarries the caller's fully-resolvedExecutionConfigas one requiredconfigfield.buildPhaseConfigspreads it and overrides only the six gate-semantic keys inGATE_CONFIG_OVERRIDES(phases,qualityLoop,sequential,concurrency,parallel,dryRun).commands/ready.tsresolves once viabuildExecutionConfiginstead of keeping inlineresolvePhasePolicies/effortEscalationblocks in lockstep by hand.batch-executor.tspasses the parent run's config straight through —issueConfig, notconfig, so a docs-labelled issue's gate phases carry the sameissueTypeits earlier phases had.Inherited behaviour changes (declared, not discovered)
retrynow honours--no-retryinstead of being hardcodedtrue.settings.run.mcpis now honoured bysequant ready(A+ pass: the command routes throughresolveRunOptions→buildExecutionConfig, which readsrun.mcp; previously MCP was on unless--no-mcpwas passed).autoWaitMinutesnow lets a rate-limited gate phase wait out the window (feat(run): --auto-wait — continue a rate-limited run when the window resets instead of halting #804) instead of failing.relayEnablednow reaches gate phases.skipVerification,noSmartTests,isolateParallel,issueTypenow inherit.readyGate: trueis inherited but inert — onlybatch-executorreads it, so there is no recursion;phase-executornever consults it.AC Verification
grep -nE 'agent\?*:|aiderSettings\?*:' src/lib/workflow/ready-gate.tsconfignpx vitest run src/commands/ready.test.ts src/lib/workflow/ready-gate.test.ts -t "863"-t "863"run — spiesgetDriver, asserts"aider"npx vitest run src/lib/workflow/execution-config-parity.test.tsnpx vitest run src/lib/workflow/ready-gate-run.test.ts src/lib/workflow/ready-gate.phase-policy.test.ts src/commands/ready.phase-policy.test.tsMutation records
Mutation-verified: AC-4 — re-hardcoded retry: true in buildPhaseConfig; execution-config-parity.test.ts failed; restored.
Mutation-verified: AC-1 — re-added a compiling resolvePhasePolicies call to commands/ready.ts (the second producer); config-resolver.model-roles.test.ts failed; restored.
Both mutations were applied against a committed tree and verified to fail exactly the named test while the sibling ready/gate/parity suites stayed green.
Test plan
npm run build✅npm run lint✅ (0 warnings,--max-warnings 0)npx vitest run(full suite) — 285/288 files pass; 5799 passed. Three failures (prompt-wait.test.ts,batch-executor.test.ts > withActivityHook,relay-hook.integration.test.ts) are pre-existing: settled by checking outorigin/mainin this same worktree and reproducing all three identically. None touch this change's surface.Known gaps
runReadyGateForIssueis module-private and untested; theconfig: issueConfigcall-site change is a one-line pass-through documented in-code rather than gated by a test. Exporting it purely to assert one argument was judged out of proportion to the risk.src/commands/ready.phase-policy.test.ts(one file off the "may touch" list) is re-anchored fromopts.phasePoliciestoopts.config.phasePolicies. Keeping the top-level field would leave the duplicate channel this change exists to remove.dryRun: false, allowlisted in the parity test as permitted to differ. Pre-existing behaviour, not a regression here.Closes #863
A+ pass (runner, 2026-09-07, commit b7b13ff)
Addresses the QA round-1 notes so this PR can reach READY_FOR_MERGE:
ready.tsno longer bypassesresolveRunOptions— its CLI subset goes through the same CLI > env > settings merge asrun, sorun.smartTests/SEQUANT_SMART_TESTS,run.autoWaitMinutes/SEQUANT_AUTO_WAIT_MINUTESandagents.isolateParallelresolve identically on both entry points (the QA's measured divergence). New test inready.test.tsassertsnoSmartTests/autoWaitMinutesreach the gate config from settings; the existing fix(ready-gate): driver settings never reach the gate (RunReadyGateOptions lacks the fields) — silently runs claude-code for aider/opencode configs #863 deep-equal test now computes its expected value throughresolveRunOptionsexactly as the command does. CHANGELOG entry added.config-resolver.ts×2 incl. thepositiveOrexport rationale,types.ts×2,ready-gate.phase-policy.test.ts,ready-limits.test.ts,phase-executor.ts) plus four more found by grep (ready.tsresolveReadyLimitsrationale,config-resolver.tseffortEscalation,config-resolver.model-roles.test.tsheader,phase-executor.phase-policy.test.tsheader).src/lib/workflow/config-resolver.model-roles.test.tswas edited in2079fc1e(its feat(config): model roles — semantic indirection between phase policy/ladders and concrete model strings #975 AC-5 drift guard asserted the producer this PR deletes; re-anchored onto the collapse) — disclosed here per the QA's note.A+ rounds 2–4 (commits ebe5898, ca517a0, a916aa5)
ready-gate.phase-policy.test.tsandconfig-resolver.phase-policy.test.tsheaders anddescribetitles retitled off the producer-1/producer-2 framing;config-resolver.tsphasePoliciescomment,config-resolver.model-roles.test.tstitle, andrun-orchestrator.model-roles.test.tscomment likewise. Completeness claim, this time by grep:grep -rni producer srcleaves only historical wording ("before the producer collapse", "was a second producer") and unrelated producers (prompt-context builders, log writers, the package-manager drift class instacks.ts).settings.run.mcpon thereadypath: CHANGELOG + inherited-changes list updated; direct test added (opts.config.mcp === falsefrom settings) and a separate--no-mcpCLI-flag test, so removing theresolveRunOptionshop would fail a test rather than silently no-op the flag.config: issueConfigcall site inbatch-executor.ts(runReadyGateForIssueis module-private); the existing call-site comment states the intent.A+ round 5 (commit 0f07de6)
--max-iterations/--timeoutnow go intoresolveRunOptionsraw, soSEQUANT_MAX_ITERATIONSapplies between CLI and settings (there is no timeout env var — an earlier draft of this bullet named one) exactly as onrun(QA measured 9 vs 3 before);buildExecutionConfig'spositiveOrchain guards the result, and the gate's loop limit / per-phase timeout are read back from the resolved config.resolveReadyLimitsis consumed only fortokenBudgetnow (kept exported and tested). New test assertsSEQUANT_MAX_ITERATIONS=9reachesopts.config.maxIterations.skipVerification: the parity test's OQ-12 case no longer asserts it (no producer sets it, nothing reads it — the assertion could not fail) and the CHANGELOG's inherited-fields list drops it. The field itself is pre-existing dead surface onExecutionConfig(types.ts:105, defaulted inDEFAULT_CONFIG, no CLI flag); not removed here — that is a separate cleanup, recorded in this PR rather than filed (PLAN §5 I-7).A+ round 6 (commit 6a7f81c)
SEQUANT_TIMEOUTenv var that does not exist; removed (onlySEQUANT_MAX_ITERATIONSis in the env layer).resolveReadyLimitsnow returns onlytokenBudget— the one value that never enters anExecutionConfig;maxIterations/phaseTimeoutare read back from the resolved config, so the function no longer carries an unreachable guard.ready-limits.test.tskeeps the budget cases and points at the newready.test.tscase that asserts the fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833 property on the ready path (settings.run.timeout: 0/maxIterations: 0→ defaults reach the gate, and the gate's own loop bound follows the resolved config). Unused imports inready.tspruned;positiveOr's export rationale corrected (no module calls it since this change).A+ round 7 (commit 80a1f6d)
sequant run --ready-gatecaller is now gated too:ready-gate-run.test.tsasserts the gate receives the resolved config itself (agent: "aider",aiderSettings,maxIterations,readyGate) and that a docs-labelled issue's gate phases carryissueType: "docs"— theconfig: issueConfigcall-site choice that earlier rounds left ungated. No export was needed (runReadyGateis already mocked there).ready.test.tsnotes the hand-copied CLI-subset mirror as a known constraint and points at the per-flag cases that gate what the deep-equal cannot.