Skip to content

feat(loop): evidence-based effort escalation on quality-loop retries #915

Closed

Description

@admarble

Depends on #914 (per-phase model/effort configuration).

Motivation

The quality risk in effort tuning lives entirely in speculative downgrades — guessing "this task looks easy" from weak proxies and lowering effort before any evidence. The inverse move carries essentially zero quality risk: escalate effort when the workflow observes failure. Sequant already detects exactly those moments:

  • quality-loop iteration ≥ 2 (/loop re-entry after unmet QA findings)
  • QA stagnation (qa-stagnation.ts — repeated iterations without finding-count progress)
  • spec retry (spec-retry.ts)

Escalation adapts to observed difficulty rather than predicted difficulty — it can only trade cost for quality, never the reverse. This is the honest version of "adaptive effort." Predictive adaptation (deriving exec effort from /spec's scope-analyzer verdict) is deliberately out of scope until dogfood metrics from #914 justify it.

Design

  • Opt-in: run.effortEscalation: boolean (default false — escalation raises token cost, which is the user's call on subscription plans) plus a --escalate-effort CLI flag.
  • Trigger: when a phase execution is a retry of a failed/looped attempt (loop iteration ≥ 2, spec retry, or stagnation-driven re-run), resolve the phase's effort one tier above its configured/inherited value on the ladder low → medium → high → xhigh → max.
  • Base tier when no per-phase effort is configured: treat the base as high (the SDK default) so the first escalation lands on xhigh.
  • Cap: never exceed max; never escalate more than one tier per retry; the escalated tier applies only to the retried phase execution, not subsequent phases.
  • Observability: the escalated effort is recorded in run metrics (same fields as feat(run): per-phase model and effort configuration for the claude-code driver #914) and surfaced in verbose output (effort: high → xhigh (loop retry)), so the cost/quality tradeoff is auditable per run.
  • Both ExecutionConfig producers (buildExecutionConfig, ready-gate.ts:buildPhaseConfig) apply the same escalation logic (fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833 drift guard).

Acceptance Criteria

  • run.effortEscalation (default false) and --escalate-effort are parsed, with CLI taking precedence over settings
  • With escalation disabled, retried phases run at their configured/inherited effort (test: loop iteration 2, options object carries the unescalated value)
  • With escalation enabled, a loop iteration ≥ 2 runs the retried phase one effort tier above its resolved base, verified by a driver-options unit test
  • Escalation applies on spec retry and QA-stagnation re-runs via the same code path (one resolver function, not per-call-site copies)
  • Escalation from an unconfigured phase treats the base as high and lands on xhigh
  • Effort never exceeds max and never jumps more than one tier per retry (test: base max stays max; base high on 3rd loop iteration is xhigh, not max)
  • The escalated tier applies only to the retried phase execution; the next phase in the chain resolves from its own configuration
  • Run metrics and verbose output record both the base and escalated effort for escalated executions
  • README + docs/ document the flag, the escalation ladder, the cost implication, and why speculative downgrades are intentionally not offered

Activity

  1. added
    enhancement
    on Aug 8, 2026
  2. admarble commented on Aug 8, 2026

    @admarble
    ContributorAuthor

    Complexity: Complex (9 ACs, 3 directories)

    ⚠️ Dependency (blocking)

    Depends on #914 — currently OPEN, no PR. #914 introduces the entire effort concept this issue builds on: the EffortTier type, per-phase effort resolution, the effort field on ExecutionConfig, the wire that carries effort to the claude-code driver, and the run-metrics effort fields. None of that exists on main today (grep -rn "EffortTier\|reasoningEffort\|run.effort" src/ → 0 hits). This issue has nothing to escalate until #914 lands. Recommend --base off #914's branch (or wait for merge) so the escalation resolver plugs into #914's EffortTier ladder and driver-options surface rather than inventing a parallel one.


    AC Quality Check

    All 9 ACs pass the linter (no vague/unmeasurable/open-ended patterns). They are unusually well-specified — each names its own test oracle (e.g. AC-6 "base high on 3rd loop iteration is xhigh, not max"). No refinements needed.


    Scope Assessment

    Non-Goals: ✅ Present and explicit — predictive adaptation (deriving exec effort from /spec's scope verdict, or speculative downgrades) is deliberately out of scope until #914 dogfood metrics justify it. This is the load-bearing scope boundary; keep it.

    Metric Value Status
    Feature count 1 (effort escalation) ✅
    AC items 9 ⚠️
    Directory spread ~3 (src/lib/workflow, bin, docs+README) ✅

    Verdict: ✅ SCOPE_OK — 9 ACs is high, but they decompose one cohesive resolver + its wiring + tests + docs. No split warranted. Enable the quality loop anyway (see Recommended Workflow) since the correctness surface is a boundary-condition table (the ladder caps).


    Acceptance Criteria

    AC-1: run.effortEscalation (default false) + --escalate-effort parsed, CLI > settings

    Verification: Unit Test — resolveRunOptions/buildExecutionConfig in config-resolver.ts.
    Scenario: Given setting false + --escalate-effort → When options resolved → Then effortEscalation === true (CLI wins); Given neither → Then false.
    Assumptions: --escalate-effort added via .option() in bin/cli.ts (flag silently absent otherwise) and to RunOptions in types.ts; setting added to RunSettingsSchema in settings.ts.

    AC-2: Disabled → retried phase runs at configured/inherited effort

    Verification: Unit Test (driver-options).
    Scenario: Given escalation disabled + loop iteration 2 → When phase dispatched → Then the options object carries the unescalated base tier.

    AC-3: Enabled → loop iteration ≥ 2 runs one tier above resolved base

    Verification: Unit Test (driver-options).
    Scenario: Given enabled + base high + iteration 2 → When phase dispatched → Then effort is xhigh.

    AC-4: Spec retry + QA-stagnation re-runs use the SAME resolver (one function, no per-call-site copies)

    Verification: Unit Test + code review.
    Scenario: Given a single exported resolveEscalatedEffort(base, isRetry, enabled) → When called from the loop-retry path (batch-executor.ts), the spec-retry path (run-orchestrator.ts:~1050), and the stagnation-re-run path (qa-stagnation.ts) → Then all three produce identical output for identical inputs. Test asserts one import site per caller, no inline ladder math.
    Assumptions: All three signals converge on a boolean "this execution is a retry" fed to the shared resolver.

    AC-5: Unconfigured phase → base treated as high → lands on xhigh

    Verification: Unit Test.
    Scenario: Given no per-phase effort configured + escalation on a retry → When resolved → Then base defaults to high (SDK default) and escalates to xhigh.

    AC-6: Cap at max; ≤ one tier per retry

    Verification: Unit Test (table).
    Scenario: base max + retry → max; base high + 3rd loop iteration → xhigh (NOT max — escalation is per-retry-of-one-tier, not cumulative-by-iteration-count). Ladder: low → medium → high → xhigh → max.

    AC-7: Escalated tier applies only to the retried execution; next phase resolves from its own config

    Verification: Unit + Integration Test.
    Scenario: Given phase A retried at xhigh → When the chain advances to phase B → Then B resolves from its own configured/inherited base, unaffected by A's escalation. (This is why escalation must be applied at dispatch time per execution, not baked statically into a single ExecutionConfig — see Design Review Q2.)

    AC-8: Metrics + verbose record base AND escalated effort for escalated executions

    Verification: Unit Test + Integration.
    Scenario: Given an escalated execution → Then run metrics carry both base and escalated tiers (same fields as #914) and verbose output prints effort: high → xhigh (loop retry).
    Assumptions: #914's metric fields are extended, not duplicated.

    AC-9: README + docs/ document flag, ladder, cost implication, and why speculative downgrades are omitted

    Verification: Manual (docs content check — verify coverage, not file existence; check README and docs/reference/run-command.md, matching the --ready-gate precedent at README:23).


    Implementation Plan

    Phase 1: Wire the flag/setting (AC-1)

    1. Add --escalate-effort boolean via .option() in bin/cli.ts; add effortEscalation to RunOptions (types.ts).
    2. Add effortEscalation (default false) to RunSettingsSchema in settings.ts.
    3. In buildExecutionConfig (config-resolver.ts:243) resolve effortEscalation = mergedOptions.escalateEffort ?? settings.run.effortEscalation ?? false (CLI-precedence pattern, mirroring readyGate at :309). Mirror into ready-gate.ts:buildPhaseConfig (fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833 drift — both producers).

    Phase 2: The shared resolver (AC-4, AC-5, AC-6)

    1. Add an ordered ladder const ["low","medium","high","xhigh","max"] and a pure resolveEscalatedEffort(base: EffortTier | undefined, isRetry: boolean, enabled: boolean): EffortTier beside feat(run): per-phase model and effort configuration for the claude-code driver #914's effort resolution. Rules: !enabled || !isRetry → base (or high default per AC-5); else min(indexOf(base ?? "high") + 1, lastIndex) → cap at max, one tier only.

    Phase 3: Feed the retry signal at dispatch (AC-2, AC-3, AC-7)

    1. At the per-phase dispatch point in batch-executor.ts (iteration > 1, line ~1295/1314), compute the execution's effort via the resolver and pass it into the driver options for that execution only.
    2. Route the spec-retry path (run-orchestrator.ts:~1050) and the stagnation re-run (qa-stagnation.ts) through the same resolver with isRetry = true.

    Phase 4: Observability + docs (AC-8, AC-9)

    1. Record base+escalated effort in run metrics (extend feat(run): per-phase model and effort configuration for the claude-code driver #914 fields) and emit the verbose base → escalated (reason) line.
    2. Document flag, ladder, cost, and the no-speculative-downgrade rationale in README + docs/reference/run-command.md.

    Rule Touchpoints

    AC-6's cap rule ("never exceed max, never jump > one tier") is exactly the kind of behavior rule that gets copy-pasted into each call site and drifts. The real touchpoints for this feature are the two ExecutionConfig producers (the behavior-rule detector's auto-found touchpoints were all false positives — its own source + unrelated skill docs). AC-4 pre-empts the drift by mandating one resolver; enforce it here.

    AC Touchpoint Snippet
    AC-4/AC-6 src/lib/workflow/config-resolver.ts:243 buildExecutionConfig(...) — producer #1, must delegate to resolver
    AC-4/AC-6 src/lib/workflow/ready-gate.ts:287 buildPhaseConfig(...) — producer #2 (#833 drift guard)
    AC-3/AC-7 src/lib/workflow/batch-executor.ts:~1295 if (useQualityLoop && iteration > 1) — the retry-dispatch site

    Design Review

    1. Where does this logic belong? A pure resolver + ladder const co-located with feat(run): per-phase model and effort configuration for the claude-code driver #914's effort resolution in config-resolver.ts — the layer that already owns config→ExecutionConfig, and the module fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833 designated as the single guard point.
    2. What's the simplest correct approach? One pure resolveEscalatedEffort function; call it at each of the three retry-dispatch sites. Reject baking a static escalated value into ExecutionConfig at build time — that violates AC-7 (escalation is per-execution, and buildExecutionConfig runs once per run, not per phase-execution). The config carries the base + enabled flag; escalation is computed at dispatch.
    3. What existing pattern does this follow? The readyGate opt-in flag (CLI→settings→default, config-resolver.ts:309) for wiring; the positiveOr two-producer guard pattern (fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833) for keeping both producers in sync.
    4. What would a senior reviewer challenge? "Why not escalate cumulatively by iteration count?" — AC-6 explicitly forbids it (base high on 3rd iteration is xhigh, not max): each retry is one tier above the configured base, not the previous escalated value. Document that intent at the resolver.

    Feature Quality Planning

    All standard checks pass. Notable items:

    Derived ACs

    Source Derived AC Priority
    Cross-producer consistency Mutation test: escalation logic present in buildExecutionConfig path AND buildPhaseConfig path (delete one → a test fails) Medium

    Open Questions

    1. Static vs dispatch-time escalation — The issue's Design bullet says "both ExecutionConfig producers apply the same escalation logic," readable as static. But AC-7 requires per-execution scoping, which a once-per-run ExecutionConfig can't express. Recommendation: producers carry base effort + effortEscalation flag; the shared resolver runs at dispatch. Impact if wrong: escalating one phase leaks into the next (AC-7 fails).
    2. Base for a phase with effort configured but no feat(run): per-phase model and effort configuration for the claude-code driver #914 inheritance — AC-5 covers unconfigured → high. Confirm a configured phase escalates from its configured value, not from high. Recommendation: resolver takes the resolved base verbatim; only the undefined case defaults to high.

    Recommended Workflow

    Phases: spec → testgen → exec → qa
    Quality Loop: enabled
    Reasoning: 6 of 9 ACs are Unit-Test-verifiable with explicit boundary oracles (ladder caps) — testgen should stub them before exec so the cap table is codified first. enhancement label + >2 ACs and Unit/Integration verification methods both trigger testgen. Quality loop on: the correctness surface is a boundary table where an off-by-one in the ladder is the likely defect. No UI → no test phase. Not security-sensitive → no security-review. Do not schedule exec until #914 has merged (or exec on --base off #914's branch).


    Label Review

    Current: enhancement
    Recommended: enhancement + consider blocked (until #914 merges) and cli
    Reason: blocked reflects the hard #914 dependency; cli matches #914's own labeling (new flag surface). No complex/refactor needed — cohesive single feature.
    Quality Loop: Won't auto-enable from labels; enable via --quality-loop per the workflow above.

    → gh issue edit 915 --add-label cli

  3. added
    planned
    on Aug 8, 2026
  4. admarble commented on Aug 8, 2026

    @admarble
    ContributorAuthor

    #915 — feat(loop): evidence-based effort escalation on quality-loop retries
    Open · enhancement
    ────────────────────────────────────────────────────────────────

    → PROCEED — Builds on #914's effort resolver — run after it

    Commands:
    sequant run 915 -Q --phases testgen,exec,qa # after #914 lands

    spec → testgen → exec → qa · 9 ACs

    Flags:
    -Q escalation resolver must be wired identically into both ExecutionConfig producers
    --phases testgen,exec,qa spec already running for this issue; testgen from unit-test ACs
    ────────────────────────────────────────────────────────────────
    ⚠ Locked by an in-flight spec-only run at assessment time — wait for it before exec
    ⚠ Depends on #914: consumes its per-phase effort resolver and both modify buildExecutionConfig + ready-gate.ts:buildPhaseConfig — exec after #914 lands, or use sequant run 914 915 --chain
    ────────────────────────────────────────────────────────────────

  5. admarble commented on Aug 9, 2026

    @admarble
    ContributorAuthor

    #915 — feat(loop): evidence-based effort escalation on quality-loop retries
    OPEN · enhancement, planned
    ────────────────────────────────────────────────────────────────

    Supersedes prior assess from 2026-08-08 (PROCEED)

    → PROCEED — Blocking dep #914 now merged; spec already complete

    Commands:
    sequant run 915 -Q --phases testgen,exec,qa # resume — #914 merged

    testgen → exec → qa · 9 ACs

    Flags:
    -Q escalation resolver touches both ExecutionConfig producers plus a boundary-condition ladder table
    --phases testgen,exec,qa prior spec marker already exists and blocking dep #914 is now merged
    ────────────────────────────────────────────────────────────────
    Cleanup:
    gh issue edit 915 --add-label cli # flag surface, per this issue's own prior spec label review — not yet applied
    ────────────────────────────────────────────────────────────────
    ⚠ #914 shipped effort as a plain string field, not an EffortTier ladder type — the resolver's ladder const must be authored fresh, not imported
    ⚠ Modifies batch-executor.ts (overlaps #920, #921); land sequentially
    ────────────────────────────────────────────────────────────────

  6. admarble commented on Aug 9, 2026

    @admarble
    ContributorAuthor

    Complexity: Complex (9 ACs, 4 directories)

    Re-spec. The prior plan (2026-08-08) was written against a hypothetical #914 — it was open with no PR, so every integration point was predicted. #914 merged as 76fc911. This replaces that plan with one grounded in the code that actually shipped. Three of the prior plan's integration points were wrong; they're corrected below.


    What #914 actually shipped (the surface this builds on)

    Concern Real location
    Effort ladder src/lib/settings.ts:75 — EFFORT_LEVELS = ["low","medium","high","xhigh","max"]
    Resolver (CLI > settings > absent) config-resolver.ts:319 resolvePhasePolicies
    Producer 1 config-resolver.ts:435 (buildExecutionConfig)
    Producer 2 ready-gate.ts:316 (buildPhaseConfig), fed from RunReadyGateOptions.phasePolicies
    The only channel to the driver phase-executor.ts:1262 — config.phasePolicies?.[phase] → AgentExecutionConfig.effort → claude-code.ts:139
    Metrics metrics-schema.ts:121 phasePolicies, recorded once per run at run-orchestrator.ts:1703

    The load-bearing consequence: effort reaches the driver only via config.phasePolicies[phase].effort, and every retry call site passes the same config object. Escalation is therefore expressed as a locally-cloned config at the retry call site — not as a field baked into ExecutionConfig at build time. This is what makes AC-7 (per-execution scoping) fall out for free.


    AC Quality Check

    8 of 9 ACs pass the linter cleanly and name their own test oracle. Two wording issues, both from the ACs being drafted before #914's implementation existed:

    • AC-2 says the disabled case "carries the unescalated value." For a phase with no configured effort, feat(run): per-phase model and effort configuration for the claude-code driver #914 deliberately omits the key from query() options entirely (its AC-3, mutation-verified). There is no "unescalated value" to carry. The test must assert key absence ("effort" in opts === false) in that case, and the unescalated value only for a phase that is configured. Building to the literal wording produces a test that can't be satisfied.
    • AC-4 names "QA-stagnation re-runs" as a trigger. See Open Question 1 — that code path does not exist.

    Scope Assessment

    Non-Goals: ✅ Explicit and load-bearing — predictive adaptation (deriving effort from /spec's scope verdict; speculative downgrades) is out of scope until #914 dogfood metrics justify it. Keep it.

    Metric Value Status
    Feature count 1 (escalation resolver + wiring) ✅
    AC items 9 ⚠️
    Directory spread 4 (src/lib, src/lib/workflow, bin, docs+README) ✅

    Verdict: ✅ SCOPE_OK — 9 ACs, but they decompose one resolver plus its wiring, tests, and docs. No split. Quality loop on regardless: the correctness surface is a boundary table (ladder caps) where an off-by-one is the likely defect.


    Acceptance Criteria

    AC-1: run.effortEscalation (default false) + --escalate-effort, CLI > settings

    Verification: Unit Test — buildExecutionConfig in config-resolver.ts.
    Scenario: Given settings.run.effortEscalation: false + --escalate-effort → Then effortEscalation === true. Given neither → false.
    Assumptions: .option() added in bin/cli.ts (the flag silently does not exist otherwise); escalateEffort added to RunOptions in types.ts — note run-options-dead-surface.test.ts guards that file for declared-but-unwired fields, so the flag and its consumer must land in the same change.

    AC-2: Disabled → retried phase runs at its configured/inherited effort

    Verification: Unit Test (driver options, via executePhaseWithRetry with a mocked driver — the entry point phase-executor.phase-policy.test.ts already uses).
    Scenario: Given escalation disabled + loop iteration 2 → Then the options object is byte-identical to iteration 1's: the configured tier for a configured phase, and no effort key at all for an unconfigured one.

    AC-3: Enabled → loop iteration ≥ 2 runs one tier above the resolved base

    Verification: Unit Test (driver options).
    Scenario: Given enabled + base high + iteration 2 → Then effort === "xhigh".

    AC-4: Spec retry and the ready-gate QA loop use the SAME resolver

    Verification: Unit Test + code review.
    Scenario: One exported function; three call sites import it; no inline ladder arithmetic anywhere. The three real retry sites are listed under Rule Touchpoints. (QA stagnation is not one of them — Open Question 1.)

    AC-5: Unconfigured phase → base treated as the SDK default → lands one tier above

    Verification: Unit Test.
    Scenario: Given no configured effort + a retry → base defaults to a named constant, escalation lands one tier up.
    ⚠️ The AC asserts that constant is high. Verify before building — see Open Question 2. If the Agent SDK's real default is xhigh (as it is in Claude Code), escalating from an assumed high produces xhigh, which is the default — a silent no-op that every test in this AC would still pass.

    AC-6: Cap at max; ≤ one tier per retry

    Verification: Unit Test (table).
    Scenario: base max + retry → max. base high + 3rd loop iteration → xhigh, not max — escalation is one tier above the configured base, never cumulative over the previous escalated value. Ladder is settings.ts:EFFORT_LEVELS; do not redeclare it.

    AC-7: Escalation is scoped to the retried execution

    Verification: Unit + Integration Test.
    Scenario: Given phase A retried at xhigh → When the chain advances to phase B → Then B resolves from its own config. Falls out of the design: the retry site passes a cloned config and never mutates issueConfig. The test should assert the shared config object is unchanged after an escalated call.

    AC-8: Metrics + verbose record base AND escalated effort

    Verification: Unit Test + Integration.
    Scenario: Verbose prints effort: high → xhigh (loop retry); metrics carry both tiers.
    ⚠️ "same fields as #914" is not achievable as written. phasePolicies is recorded once per run (run-orchestrator.ts:1703, from config.phasePolicies) and is a flat phase → {model, effort} map. Escalation is per-execution and can fire several times in one run, so it cannot be expressed in that shape. Design below adds a sibling optional array rather than overloading it. There is also no existing verbose effort output — that line is entirely new, not an extension.

    AC-9: README + docs/ document the flag, ladder, cost, and the no-downgrade rationale

    Verification: Manual (content coverage, not file existence). Both locations, following the #914 precedent: README.md:307 and docs/reference/run-command.md#per-phase-model--effort (:347–378). Check docs/reference/ready-command.md too if AC-1's flag lands on sequant ready (Open Question 3).


    Implementation Plan

    Phase 1 — Flag and setting (AC-1)

    1. bin/cli.ts: --escalate-effort via .option() on run (and ready, pending OQ3), beside the existing --models/--efforts at :395–400.
    2. types.ts: RunOptions.escalateEffort + ExecutionConfig.effortEscalation, each with a doc comment naming its consumer (dead-surface guard).
    3. settings.ts: effortEscalation: z.boolean().optional() on RunSettingsSchema, default false.
    4. Resolve in both producers: buildExecutionConfig (config-resolver.ts:435, next to phasePolicies) and ready-gate.ts:316 via a new RunReadyGateOptions.effortEscalation fed from commands/ready.ts:172. This is the fix(cli): bare parseInt on run --timeout lets a malformed value abort every phase instantly (sibling of #818) #833 drift point.

    Phase 2 — The shared resolver (AC-4, AC-5, AC-6)

    1. In config-resolver.ts, beside resolvePhasePolicies:
      • DEFAULT_EFFORT — one named constant, the base for an unconfigured phase (value pending OQ2), with a comment tying it to the SDK default.
      • escalateEffort(base: string | undefined, enabled: boolean): string | undefined — pure. !enabled → base unchanged. Else index into EFFORT_LEVELS from base ?? DEFAULT_EFFORT, +1, clamped to the last index. An unrecognized base returns base unchanged (never throw at dispatch time).
      • withEscalatedEffort(config: ExecutionConfig, phase: Phase): ExecutionConfig — returns a shallow clone with phasePolicies[phase].effort replaced; returns config by identity when escalation is off or produces no change. This is the single entry point all three call sites use, and the reason AC-7 holds.

    Phase 3 — Wire the three retry sites (AC-2, AC-3, AC-7)

    1. batch-executor.ts:1354 — wrap the withActivityHook(issueConfig, …) argument when iteration > 1. The iteration variable is already in scope at that line.
    2. phase-executor.ts:1676 — the SPEC_EXTRA_RETRIES loop passes an escalated config to executePhaseFn. Conditional on Open Question 1's answer — this loop exists to recover transient failures, which is not evidence of difficulty.
    3. ready-gate.ts:495 and :552 — pass iterations > 1 through buildPhaseConfig's result.

    Phase 4 — Observability + docs (AC-8, AC-9)

    1. Metrics: add an optional effortEscalations?: Array<{phase, base, escalated}> to MetricRunSchema (additive, optional, no version bump — same pattern as phasePolicies at metrics-schema.ts:113–126), threaded from the executor rather than from config. Omit the field entirely when empty.
    2. Verbose: emit effort: <base> → <escalated> (<reason>) from the single point where withEscalatedEffort actually changes something, so the message can't drift from the value.
    3. Docs in README + docs/reference/run-command.md (+ ready-command per OQ3): flag, ladder, cost implication, and why speculative downgrades are intentionally absent.

    Rule Touchpoints

    AC-6's cap rule is exactly the sort that gets copy-pasted per call site and drifts, which is why AC-4 mandates one resolver. (The automated detector was run on this issue during the prior spec pass and returned only false positives — its own source plus unrelated skill docs. The real touchpoints are enumerated from the merged #914 code.)

    AC Touchpoint Snippet
    AC-1 config-resolver.ts:435 phasePolicies: resolvePhasePolicies(...) — producer 1
    AC-1 ready-gate.ts:316 phasePolicies: opts.phasePolicies — producer 2 (#833)
    AC-3 batch-executor.ts:1354 executePhaseWithRetry(..., withActivityHook(issueConfig, ...)) under iteration > 1
    AC-4 phase-executor.ts:1676 for (let i = 0; i < SPEC_EXTRA_RETRIES; i++) — the real spec-retry loop
    AC-4 ready-gate.ts:486 while (iterations < maxIterations) — QA-pass loop, dispatches at :495 / :552
    AC-8 run-orchestrator.ts:1703 phasePolicies: config.phasePolicies — run-scoped, cannot carry per-execution data

    Design Review

    1. Where does this logic belong? A pure resolver next to resolvePhasePolicies in config-resolver.ts — the module feat(run): per-phase model and effort configuration for the claude-code driver #914 already designated as the single anti-drift point, and the one both producers import.
    2. What's the simplest correct approach? One pure ladder function plus one config-cloning helper, called at three dispatch sites. Explicitly reject baking an escalated value into ExecutionConfig at build time: buildExecutionConfig runs once per run, not once per phase execution, so a static value would leak across phases and fail AC-7. Also reject threading a new effort parameter down executePhaseWithRetry's signature — it is already 10 positional parameters deep with a comment (phase-executor.ts:1365–1372) pinning the last one's position for the feat: detect rate-limit failures mid-chain and halt cleanly instead of timeout-cascading #761/fix(run): -Q quality loop retries after an "Out of credits" exec instead of failing fast (billing cascades into "unparseable verdict") #799 regression tests. Cloning the config keeps that signature untouched.
    3. What existing pattern does this follow? readyGate (config-resolver.ts:431) for the opt-in flag wiring; resolvePhasePolicies for the shared-resolver-across-two-producers shape.
    4. What would a senior reviewer challenge? "Why not escalate cumulatively by iteration count?" — AC-6 forbids it: base high at iteration 3 is xhigh, not max. Each retry is one tier above the configured base. Document that at the resolver, because the alternative reading is the natural one.

    Feature Quality Planning

    Notable items:

    • "Retry" must be single-sourced. Three signals feed one boolean. If they diverge, AC-4 silently regresses with all tests green. Test that all three call sites produce identical output for identical inputs.
    • The cold-start / MCP-fallback / rate-limit retries in executePhaseWithRetry must NOT escalate. They are infrastructure recovery (phase-executor.ts:1456–1600), not evidence of task difficulty. Escalating there burns tokens on an npx cold cache. The plan touches only the SPEC_EXTRA_RETRIES loop, and a test should pin that a cold-start retry keeps the base tier.
    • Escalation introduces a key where feat(run): per-phase model and effort configuration for the claude-code driver #914 omits one. For an unconfigured phase, escalation flips it from "SDK default, no key sent" to an explicit tier. That is intended, but it means feat(run): per-phase model and effort configuration for the claude-code driver #914's "absent by default" contract now has an opt-in exception — say so in the docs.

    Derived ACs

    Source Derived AC Priority
    Cross-producer consistency Mutation test: delete the escalation wire from either producer → exactly one test fails, per the repo's gate-test rule Medium
    Retry-class separation Test: a cold-start retry at iteration 1 carries the unescalated tier even with escalation enabled Medium

    Open Questions

    1. AC-4 names "QA-stagnation re-runs" as a trigger, but no such code path exists. detectStagnation (qa-stagnation.ts:74) is a halt signal — its own doc comment says the orchestrator "should NOT re-invoke /qa." Its only consumers are ready-gate.ts:346 (which halts) and scripts/qa-stagnation.ts, a shim the fullsolve/loop SKILL.md files call. There is nothing to escalate. Recommendation: treat the ready-gate QA-pass loop (ready-gate.ts:486) as the intended third site — it is a genuine retry loop in the same subsystem — and drop the stagnation reference from the AC. Related, and sharper: the issue's own thesis is "escalate on observed difficulty," but the spec-retry loop's in-code rationale (phase-executor.ts:1673) is that spec has a transient failure rate (~8.6%). A transient failure is not evidence of difficulty; escalating there trades cost for nothing. Recommendation: wire the loop retry (site 1) and the ready-gate loop (site 3) as the shipped triggers, and either drop spec-retry or gate it behind a non-transient error classification. Impact if wrong: token spend on cold-start-class failures with no quality return — precisely the outcome the issue's motivation argues against.

    2. AC-5 asserts the SDK default effort is high; this needs verification before it becomes a constant. high is the Messages API default. Claude Code runs xhigh by default, and the Claude Agent SDK is the Claude Code harness packaged as a library — so the SDK-level default is plausibly xhigh. If it is, escalating an unconfigured phase from an assumed high yields xhigh — identical to what it was already running — and every AC-5/AC-3 unit test still passes while the feature does nothing. Note feat(run): per-phase model and effort configuration for the claude-code driver #914 deliberately never named a value: docs/reference/run-command.md:70 says only "(SDK default)". Recommendation: confirm the Agent SDK's default against code.claude.com/docs/en/agent-sdk during exec; put the answer in one exported DEFAULT_EFFORT constant with a comment citing the source, so it is a one-line fix if it changes. Impact if wrong: the headline unconfigured-phase case is a silent no-op.

    3. Does --escalate-effort also land on sequant ready? The issue says sequant run, but ready-gate.ts is one of the three retry sites and its own ExecutionConfig producer, and feat(run): per-phase model and effort configuration for the claude-code driver #914 shipped --models/--efforts on both commands (bin/cli.ts:395 and :611). Recommendation: add it to both, for parity with feat(run): per-phase model and effort configuration for the claude-code driver #914 and because escalation is inert on ready otherwise. Impact if wrong: the ready-gate wiring exists with no way to enable it — the chore(run): --qa-gate is an inert no-op flag — remove or make it actually gate #795 inert-flag class.

    4. AC-2's literal test is unsatisfiable for an unconfigured phase (see AC Quality Check). Recommendation: split it into two assertions — key-absent for unconfigured, unchanged-value for configured. Impact if wrong: a test written to the literal wording fails for the right reason and gets "fixed" by weakening it.


    Recommended Workflow

    Phases: testgen → exec → qa
    Quality Loop: enabled
    Reasoning: 6 of 9 ACs are unit-testable with explicit boundary oracles (the ladder cap table), so testgen should codify that table before exec. enhancement + >2 ACs + Unit/Integration verification methods all trigger testgen. Quality loop on: an off-by-one in the ladder is the likely defect and it is cheap to catch. No UI → no test phase. Not security-sensitive → no security-review. #914 is merged, so nothing blocks scheduling.


    Label Review

    Current: enhancement, planned
    Recommended: add cli (new flag surface, matching #914's labeling). The blocked label the prior spec suggested is moot — #914 merged.
    Quality Loop: Won't auto-enable from labels; pass -Q.

  7. added
    cli
    on Aug 9, 2026
  8. admarble commented on Aug 9, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #915

    AC Coverage

    AC Description Status Notes
    AC-1 run.effortEscalation (default false) + --escalate-effort parsed, CLI > settings MET Verified literally: .option("--escalate-effort", ...) on both run and ready; RunSettingsSchema.effortEscalation.default(false); mergedOptions.escalateEffort ?? settings.run.effortEscalation ?? false in config-resolver.ts:444 and the mirror in commands/ready.ts. Mutation-verified both producers (deleting either wire fails exactly its guarding test).
    AC-2 Disabled → retried phase runs at configured/inherited effort MET (with a literal-wording correction, disclosed) The AC's phrase "carries the unescalated value" is unsatisfiable for an unconfigured phase — #914 omits the effort key entirely rather than sending a value, and there is no "unescalated value" for a key that was never present. Implemented and tested as: unconfigured phase stays key-absent; configured phase carries its value unchanged. effort-escalation.test.ts + batch-executor.test.ts (live dispatch, disabled case).
    AC-3 Enabled → loop iteration ≥ 2 runs one tier above resolved base MET Tested at the resolver level (resolveEscalatedEffort), cross-producer level (ready-gate.phase-policy.test.ts), and live dispatch level (batch-executor.test.ts, real runIssueWithLogging call with a scripted qa-fail-then-recover).
    AC-4 Escalation applies on spec retry and QA-stagnation re-runs via the same code path Deviation — see below Neither literal trigger applies as written. Wired the ready-gate QA-pass loop instead as the third genuine retry site. One shared resolver (effort-escalation.ts) used at all three real dispatch sites — no per-call-site copies.
    AC-5 Unconfigured phase → base treated as high, lands on xhigh MET DEFAULT_ESCALATION_BASE = "high", escalates to "xhigh". Runtime-executed against the built dist/ output during this QA pass (not just unit-tested) — confirmed resolveEscalatedEffort(undefined, true, true) === "xhigh". Flagged in the module's doc comment as an explicit assumption about the Agent SDK's actual default, isolated to one named constant.
    AC-6 Cap at max; ≤ one tier per retry, from configured base MET Mutation-verified: removing Math.min(..., EFFORT_LEVELS.length - 1) fails exactly the 2 boundary tests (base max stays max, ladder table) for the right reason. "3rd loop iteration, base high → xhigh not max" explicitly tested (AC-6: base already at max test + the ladder table test).
    AC-7 Escalated tier applies only to the retried phase execution; next phase resolves from its own config MET (scope clarified, not narrowed) withEscalatedEffort clones ExecutionConfig per dispatch, never mutates the shared input — verified by identity checks in effort-escalation.test.ts and cross-phase non-leak assertions. One real-world nuance surfaced and documented in code + tests: because the outer quality loop re-runs its whole phase list per iteration (not just the failed phase), every phase dispatched during a retried iteration escalates together — this is the correct reading of "retried execution" given the loop's existing granularity, not a narrowing of AC-7.
    AC-8 Metrics + verbose record base and escalated effort MET effortEscalations metrics array (mutation-verified aggregation in run-orchestrator.ts, dedicated schema tests). Verbose print at both live sites (batch-executor.ts inline, run-orchestrator.ts for the ready-gate path, commands/ready.ts for standalone sequant ready). Note: standalone sequant ready has never written to .sequant/metrics.json (pre-existing, unrelated to this issue) — its escalations are only visible via --verbose, not metrics.
    AC-9 README + docs/ document flag, ladder, cost, no-downgrade rationale MET README.md, docs/reference/run-command.md (new "Effort Escalation on Retries" section + Options table row), docs/reference/ready-command.md (Options table row), CHANGELOG.md.

    Coverage: 9/9 met (1 with a disclosed literal-wording deviation on AC-4, both flagged loudly rather than silently reinterpreted).


    Deviation from AC-4's literal text (flagged during /spec, carried into /exec)

    AC-4 names "spec retry and QA-stagnation re-runs" as the third escalation trigger. Investigation found neither applies as written:

    • detectStagnation (qa-stagnation.ts) is a halt signal, not a retry. Its own doc comment: "the orchestrator should NOT re-invoke /qa" when stagnant. There is no re-run to escalate.
    • The spec-retry loop (phase-executor.ts's SPEC_EXTRA_RETRIES) recovers transient failures, not evidence of difficulty. Its own code comment cites an ~8.6% transient failure rate. Escalating there spends tokens with no quality signal — the opposite of the issue's own cost/quality thesis.

    In their place, ready-gate.ts's QA-pass loop (qa/loop dispatch, pass ≥ 2) was wired as the third genuine retry site in the same subsystem. One shared resolver (effort-escalation.ts) is used at all three real sites (batch-executor's outer loop, ready-gate's qa dispatch, ready-gate's loop dispatch) — satisfying AC-4's "same code path, not per-call-site copies" requirement even though the named trigger sites differ from the literal text.


    CI Status

    Check State Bucket Impact
    validate-skills SUCCESS pass ✅ MET
    build (22.x) IN_PROGRESS pending ⏳ PENDING
    node-floor-guard SUCCESS pass ✅ MET
    typecheck SUCCESS pass ✅ MET
    validate-plugin SUCCESS pass ✅ MET

    CI Summary: 4 passed, 1 pending, 0 failed. Diff includes .ts files (not markdown-only), so the markdown-only relaxation does not apply — build (22.x) is gating.
    CI-related AC items: none of the 9 ACs above name CI directly; this affects the overall verdict via the standard pending_count > 0 → NEEDS_VERIFICATION rule, not any individual AC's status.


    Quality Metrics

    Metric Value Status
    Type issues (: any / as any in added lines) 0 OK
    Deleted tests 0 OK
    Files changed 25 OK — proportional to one cohesive feature
    Lines added +962 -
    Lines deleted -13 -
    Security findings (critical/warning/info) 0/0/0 OK

    Full local suite: npm run build clean, npm run lint clean (0 warnings), full npx vitest run — 259 files, 5339 tests passed (1 pre-existing expected-fail, 2 pre-existing skipped), run twice across the session with no regressions.


    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    src/lib/workflow/effort-escalation.ts Standard ✅ Yes effort-escalation.test.ts (dedicated, 15 tests covering every AC boundary)
    src/lib/workflow/batch-executor.ts Standard ✅ Yes batch-executor.test.ts (+3 live-dispatch tests: AC-2/AC-3/AC-7/AC-6)
    src/lib/workflow/ready-gate.ts Standard ✅ Yes ready-gate.phase-policy.test.ts (+2 tests: producer-2 wiring, end-to-end 2-pass escalation)
    src/lib/workflow/config-resolver.ts Standard ✅ Yes config-resolver.phase-policy.test.ts (+3 tests: CLI/settings/default precedence)
    src/lib/workflow/metrics-schema.ts Standard ✅ Yes metrics-schema.effort-escalation.test.ts (dedicated, 5 tests)
    src/lib/workflow/metrics-writer.ts Standard ✅ Yes (indirect) Type-level pass-through; exercised via run-orchestrator.phase-policy.test.ts's recordRun assertions
    src/lib/workflow/run-orchestrator.ts Standard ✅ Yes run-orchestrator.phase-policy.test.ts (+3 tests: cross-issue aggregation, ready-gate path, empty case; mutation-verified)
    src/lib/settings.ts Standard ✅ Yes settings.phase-policy.test.ts (+3 tests: default, round-trip, invalid-type rejection)
    src/commands/ready.ts Standard ✅ Yes ready.test.ts (existing suite fixed for the new required field + verbose print exercised)
    bin/cli.ts Standard ✅ Yes (indirect + smoke-tested) No dedicated CLI-parse test exists for this flag — consistent with the existing --models/--efforts precedent (also untested at the parse layer, resolution tested downstream). Smoke-tested this QA pass: --help on both run and ready shows the flag.
    src/lib/workflow/types.ts Optional (types only) N/A Validated structurally by every test above + tsc

    Coverage: 10/10 non-type-only changed source files have direct or indirect test coverage. No critical-path files (no auth/payment/security/admin paths touched).


    Cache Status

    N/A — no --use-cache/--no-cache flag context; quality checks ran fresh via sub-agents (this repo's .sequant/.cache/qa/ was not consulted for this run).

    Build Verification

    N/A — build passed cleanly on the feature branch.


    Code Review

    Strengths:

    • The escalation resolver is a small, pure, well-isolated module (effort-escalation.ts) placed to avoid a real circular-import hazard (config-resolver.ts → batch-executor.ts → would-be config-resolver.ts) rather than following the spec plan's original file placement blindly — a correct judgment call under a discovered constraint, not a shortcut.
    • Escalation is computed at dispatch time and clones ExecutionConfig rather than being baked into a static build-time value — this is the right design given buildExecutionConfig/buildPhaseConfig run once per run/gate, not once per phase execution (correctly rejected in the design review during /spec).
    • Every literal AC boundary case (disabled+configured, disabled+unconfigured, first-attempt+enabled, cap-at-max, 3rd-iteration-not-cumulative) has a dedicated unit test, and the two riskiest lines (the ladder cap, the cross-producer wiring, the metrics aggregation) are mutation-verified in-session, not just asserted.
    • Deviations from the literal issue text (AC-2's phrasing, AC-4's named trigger sites, AC-7's per-failed-phase vs per-iteration scope) are all disclosed in code comments, test names, docs, and the PR description — not silently reinterpreted.

    Issues:

    • None blocking. The one open item is AC-4's literal-text deviation, already disclosed above and in the PR.

    Suggestions (non-blocking):

    • DEFAULT_ESCALATION_BASE = "high" is an explicit assumption about the Agent SDK's real default when effort is omitted (per the /spec plan's Open Question 2, the SDK's actual default was never conclusively determined — Claude Code's own product default is xhigh, but that's a different layer than what query() does when the option is omitted). This is a one-line constant with a doc comment flagging it, so it's cheap to correct if dogfood metrics show it's wrong — worth a follow-up note when feat(run): per-phase model and effort configuration for the claude-code driver #914's metrics mature enough to check.

    Test Quality Review

    Category Status Notes
    Behavior vs Implementation ✅ OK Tests assert on resolver outputs and dispatched ExecutionConfig shape, not internals.
    Coverage Depth ✅ OK Every AC boundary (cap, default, disabled, scoping) has its own case; the ready-gate end-to-end test drives a real 2-pass loop through runReadyGate rather than mocking the loop itself.
    Mock Hygiene ✅ OK batch-executor.test.ts mocks only executePhaseWithRetry (pre-existing pattern) — no new over-mocking introduced.
    Test Reliability ✅ OK No timing dependencies; snapshotFn/readTokensUsed are deterministic injected functions, not real git/filesystem calls.

    Issues Found: None.


    Anti-Pattern Detection

    Dependency audit: N/A — no package.json changes.

    Code patterns: None found by the security-scan sub-agent (0 critical/warning/info) or my own read of the diff. No N+1 patterns, no empty catch blocks, no uncleared timers.


    Call-Site Review

    New exported functions detected: resolveEscalatedEffort, withEscalatedEffort, DEFAULT_ESCALATION_BASE (from effort-escalation.ts).

    Function Call Sites Loop? Conditions AC Match
    withEscalatedEffort batch-executor.ts (1), ready-gate.ts (2: qa + loop) Yes (both — the outer quality loop and the QA-pass loop) iteration > 1 / iterations > 1 — the retry signal each loop already tracks ✅ Matches AC-3/AC-7; iteration > 1 is per-retried-ITERATION (documented deviation from a possible narrower per-failed-phase reading)
    resolveEscalatedEffort Internal to withEscalatedEffort only No N/A ✅ Not called directly elsewhere — single entry point, matches AC-4's "one resolver, no per-call-site copies"
    DEFAULT_ESCALATION_BASE effort-escalation.ts (resolver default), 2 test files (assertion) No N/A ✅ Matches AC-5

    Findings: No mismatches. All three real retry sites use the shared resolver; no inline ladder-arithmetic copies exist anywhere in the diff (verified by grep for EFFORT_LEVELS.indexOf — appears only inside effort-escalation.ts).


    Execution Evidence

    Ran the built dist/ output directly during this QA pass (not just unit tests against source):

    node dist/bin/cli.js run --help   → shows --escalate-effort with correct help text
    node dist/bin/cli.js ready --help → shows --escalate-effort with correct help text
    node -e "import resolveEscalatedEffort/withEscalatedEffort from dist; exercise the ladder"
      ladder high->xhigh, unconfigured->xhigh, capped max->max, disabled->high,
      dispatch clone identity confirmed (out.config !== cfg)
    

    Evidence status: Complete.


    CLI Registration Verification

    Option files modified: Yes (bin/cli.ts, src/lib/workflow/types.ts, src/commands/ready.ts).

    Interface Field Runtime Usage CLI Registered Status
    RunOptions.escalateEffort mergedOptions.escalateEffort (config-resolver.ts:444) --escalate-effort on run (bin/cli.ts) ✅ OK
    ReadyCommandOptions.escalateEffort options.escalateEffort (commands/ready.ts) --escalate-effort on ready (bin/cli.ts) ✅ OK
    ExecutionConfig.effortEscalation Read at 3 dispatch sites via withEscalatedEffort N/A (internal, not a CLI field) ⏭️ SKIP
    RunReadyGateOptions.effortEscalation opts.effortEscalation in buildPhaseConfig N/A (internal) ⏭️ SKIP

    Verification Status: Passed. Smoke-tested above — both flags actually appear in --help output on the built CLI, not just declared in TypeScript.


    Skill Command Verification / Skill Change Review / Detection Pattern Verification

    N/A — no .claude/skills/**/*.md files changed in this diff.


    Smoke Test

    Workflow-affecting changes: Yes (new CLI flag on bin/cli.ts).

    Test Command Result Notes
    Happy path node dist/bin/cli.js run --help ✅ --escalate-effort present with correct description
    Happy path node dist/bin/cli.js ready --help ✅ --escalate-effort present with correct description
    Functional Direct execution of resolveEscalatedEffort/withEscalatedEffort against the built output ✅ Ladder, default, cap, disabled, and clone-identity all confirmed at runtime, not just in the mocked test harness

    Smoke Test Status: Complete.


    Manual Test ACs

    N/A — no AC in the /spec plan used **Verification:** Manual Test; all 9 ACs were Unit Test / Integration Test, and all were exercised by real automated tests (not code-review-only reasoning).


    Risk Assessment

    • Likely failure mode: If the Agent SDK's actual default effort when effort is omitted turns out to be xhigh rather than the assumed high (see the Code Review suggestion above), an unconfigured phase escalating "from high to xhigh" would be a silent no-op in practice — the phase was already effectively running at xhigh. This doesn't break anything (no crash, no wrong value sent), it just means AC-5's headline case delivers no observable behavior change until the constant is corrected. Isolated to one named, documented constant.
    • Not tested: No live integration test drives a real sequant run -Q --escalate-effort against an actual Claude Code subprocess and inspects the query() options it receives — coverage stops at the ExecutionConfig/dispatch layer, consistent with how feat(run): per-phase model and effort configuration for the claude-code driver #914's own model/effort feature was tested (same boundary, not a new gap this PR introduces).
    • Sibling sites considered: none — no cross-file siblings. The three retry-dispatch sites are the complete set of places executePhaseWithRetry-equivalent phase dispatch happens outside phase-executor.ts's own internal cold-start/MCP-fallback loops, which were deliberately excluded (see AC-4 deviation) rather than missed.
    • Sibling-line audit: none — single-call-site-per-module fix; batch-executor.ts has exactly one outer-loop dispatch site, ready-gate.ts has exactly two (qa, loop), both wired.

    Trust-Boundary Check

    Finding: Clean — diff implements only the product requirements from the issue body and the /spec plan (posted to this issue, comment linked in the PR). The issue body contains no HTML comments, and no part of the diff runs a command, reaches the network, or reads/transmits a file in response to issue/comment text — every new capability (the CLI flag, the resolver, the metrics field) traces directly to a stated AC.

    Status: Clean


    Behavior-Rule Survival Check

    Ran the detector against AC-1, AC-2, and AC-6 (the ACs most likely to trigger on default/always/never keywords).

    AC Triggered? Survivors Status
    AC-1 No — N/A
    AC-2 No — N/A
    AC-6 No — N/A

    Status: N/A (no AC triggers the heuristic)


    CHANGELOG Verification

    Check Status
    CHANGELOG.md exists ✅ Found
    User-facing changes ✅ Yes (feat commit, new CLI flag + setting)
    [Unreleased] entry ✅ Present
    Entry format ✅ Valid — action verb, issue number (#915), under ### Added

    Result: CHANGELOG requirements met.


    Adversarial Re-Read

    Findings: Walked the diff a second time against 5 specific angles: (1) ran every literal AC boundary case against the built dist/ output, not just the vitest harness — confirmed the ladder, default, cap, and clone-identity behave identically at runtime (see Execution Evidence); (2) checked every "verified"/"tested" claim in the PR description against an actual mutation test in this session — the ladder cap, both cross-producer wiring lines, and the metrics aggregation were each mutated and confirmed to fail their guarding tests, not asserted from reading the code; (3) inspected process state — worktree is clean, HEAD matches the pushed branch, no stashed or uncommitted work, locks were acquired correctly in Phase 0; (4) sibling sites — see Risk Assessment above, explicitly none, with the reasoning for why (the three dispatch sites are the complete set); (5) checked the issue body's Non-Goals section for scope creep — the issue's stated Non-Goal ("predictive adaptation... deliberately out of scope") is respected; nothing in the diff derives effort from /spec's scope verdict or any other predictive signal. One additional angle beyond the required 5: re-verified that phase-executor.ts's cold-start/MCP-fallback retry loops — which do NOT escalate by design — actually don't, by reading executePhaseWithRetry's cold-start loop and confirming it never touches config.phasePolicies or calls withEscalatedEffort.

    Status: Clean


    Verdict: NEEDS_VERIFICATION

    All 9 ACs are MET (with the AC-4 deviation disclosed and judged a correct substitution, not a gap). Every other gate — type safety, security, scope/size, CLI registration, trust-boundary, behavior-rule survival, CHANGELOG, test coverage, adversarial re-read — is Clean/Passed. The sole blocker is CI: build (22.x) was still IN_PROGRESS at the time of this review (4/5 checks passed: validate-skills, node-floor-guard, typecheck, validate-plugin). Per the standard CI Status mapping, a gating pending check floors the verdict at NEEDS_VERIFICATION regardless of everything else — re-run /qa 915 (or just confirm the check) once CI reports.

    Documentation

    • README updated
    • docs/ updated (run-command.md, ready-command.md)
    • CHANGELOG entry added

    Next Steps

    1. Wait for build (22.x) to complete on PR feat(#915): evidence-based effort escalation on quality-loop retries #926, then re-check: gh pr checks 926.
    2. If it passes, this issue is ready for human merge — no further QA re-run needed unless the AC-4 deviation warrants discussion.
    3. If it fails, the failure needs triage before merge — check whether it's a genuine regression or an environment-specific flake, given the full local suite (259 files, 5339 tests) passed clean on this branch.
  9. admarble commented on Aug 9, 2026

    @admarble
    ContributorAuthor

    QA Follow-up: CI Complete

    build (22.x) has completed since the review above — all 5 CI checks now pass (validate-skills, build (22.x), node-floor-guard, typecheck, validate-plugin, 0 pending, 0 failed).

    The prior review's sole blocker (NEEDS_VERIFICATION — pending CI) is resolved. All 9 ACs were already MET (with the AC-4 deviation disclosed and judged correct), and every other gate was Clean/Passed.

    Verdict: READY_FOR_MERGE

    PR: #926

  10. added
    ready-for-review
    on Aug 9, 2026
  11. admarble commented on Aug 9, 2026

    @admarble
    ContributorAuthor

    /fullsolve Complete

    Issue: #915
    Status: READY_FOR_MERGE (awaiting human merge decision)

    Summary

    • AC: 9/9 met (AC-4's literal trigger sites — spec-retry, QA-stagnation — were investigated and found not to apply; the ready-gate QA-pass loop was wired as the correct third retry site instead, using the same shared resolver. Disclosed in the QA comment and PR description, not silently reinterpreted.)
    • Tests: full local suite green — 259 files, 5339 tests (1 pre-existing expected-fail, 2 pre-existing skipped)
    • Build/lint: clean
    • QA: READY_FOR_MERGE (CI was pending on first pass — NEEDS_VERIFICATION — then confirmed green on follow-up)

    Progress

    Phase Status
    Spec Re-run against #914's actual merged shape (prior plan was written while #914 was still open)
    Exec Complete — 25 files, +962/-13, 5 commits
    Test Skipped — no ui/frontend/admin labels
    QA Complete — 2 passes (CI-pending → CI-green)

    PR: #926

    This does not auto-merge — the PR is ready for human review and merge at your discretion.

  12. admarble commented on Aug 10, 2026

    @admarble
    ContributorAuthor

    Filed #929 for the third gap raised in review: standalone sequant ready has never written to .sequant/metrics.json (pre-existing, not specific to this issue — sequant run --ready-gate already records correctly via #915's IssueResult.readyGate.effortEscalations path). Scoped out of this PR since fixing it means adding a new capability to ready, not a scoped fix to escalation logic.

    The other two gaps raised in review are fixed in the latest commits:

    • DEFAULT_ESCALATION_BASE = "high" verified directly against the installed @anthropic-ai/claude-agent-sdk's own query() Options type (sdk.d.ts), not left as an unverified assumption.
    • Added phase-executor.effort-escalation.test.ts, an end-to-end test chaining the real resolver → real executePhaseWithRetry → real ClaudeCodeDriver (mocking only the SDK's query() call) — proves an escalated tier actually reaches the wire, not just each hop in isolation. Mutation-verified.
  13. added 2 commits that reference this issue on Aug 10, 2026
  14. added a commit that references this issue on Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clienhancementplannedready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions