Repository navigation
Description
⚠️ STATUS: ACs rewritten — read the clarification comment before implementingThe Acceptance Criteria below have been replaced (see § at the bottom). Corrections to the Context/Proposal sections, which are otherwise left as filed:
- The forensic logs are gone. No
f317530c/058048afrun log survives in.sequant/logs/. The original AC-1/AC-5 mandated validating signatures against them and were unsatisfiable. The log-scraping method is dropped entirely.- feat(driver): surface structured rate-limit/credits errors from SDK message stream (replaces #592 fallback noise) #732 superseded the method. Structured SDK rate-limit signals (
RateLimitError/RateLimitMetadata) already exist; regex-scraping logs would re-introduce what feat(driver): surface structured rate-limit/credits errors from SDK message stream (replaces #592 fallback noise) #732 removed.- "Nothing classifies rate-limit signatures in the chain loop" — half true. Classification exists in the phase executor; what's missing is that the abort path discards it (
drivers/claude-code.ts:287-294). That is the root cause.- The chain does NOT cascade across links — it already halts at the first failure (
run-orchestrator.ts:1337-1345). The ~30+ min burn is real but happens inside a single phase via a retry ladder of up to 4 × 1800s.- Retry-with-backoff does NOT already exist. The retryable branch is a bare
continuewith no delay. Bounded retry ≠ backoff.Retitle suggested: this is not "halt the chain" — the chain already halts. It is "stop burning ~2 hours of doomed retries inside one phase, and say why it stopped."
Context
2 of the 5 recorded chain failures in the #604 forensics were Claude Code 5-hour rate-limit hits mid-run (f317530c 2026-03-23, 058048af 2026-03-25). In both, the limit manifested as 1800s phase timeouts that cascaded — burning ~30+ minutes per timed-out phase before the chain died, with no indication that the root cause was a rate limit rather than a real failure. Chain mode is structurally the most exposed surface: wall clock scales with length (avg 78.9 min, observed up to 228 min), so a 4-issue chain has ~4× the rate-limit window of a single run. #452 (PR #455) added retry-with-backoff for transient spec-phase failures, but nothing classifies rate-limit signatures in the chain loop.
Proposal
Blocking for a 5-hour window is impractical, so the goal is fail fast and fail labeled, not wait-and-retry:
- Detect the rate-limit signature in phase output/exit (the specific patterns should be pulled from the two forensic run logs in
.sequant/logs/). - On detection mid-chain: skip the remaining 1800s timeout ladder, halt the chain immediately, and report "rate limited — chain halted after #N; resume when the window resets" with the exact resume command.
- Short exponential backoff (à la Improve multi-issue reliability: default to parallel worktrees and add spec retry logic #452) is appropriate only for transient blips, not window exhaustion — classify the two cases rather than retrying blindly.
Pairs with #760: a labeled rate-limit halt plus chain resume turns this failure class from fatal into a pause.
Acceptance Criteria
Rewritten. Rationale + evidence in the clarification comment. The original log-signature ACs are dropped (logs gone; #732 supersedes the method). Ordered by dependency — AC-1 is load-bearing.
- AC-1: The abort/timeout path at
drivers/claude-code.ts:287-294attachesstructuredErrorviabuildStructuredError(rateLimitInfo, assistantError, apiRetryError), matching the sibling catch path at:302. A rate limit that manifests as a hang must stay classifiable downstream. Without this, every AC below is unreachable. - AC-2: A rate limit whose
resetsAtis beyond a short threshold does not consume cold-start retries. Model on thecappedprecedent (phase-executor.ts:906-908): explicit early return skipping all retries. A window resetting in hours cannot be retried into success. - AC-3: The MCP fallback gate (
phase-executor.ts:972-978) additionally checks!failureIsRateLimited, alongside!failureIsBilling && !failureIsCapped. A throttle must not trigger "retrying without MCP". - AC-4: Transient rate-limit retries get real backoff — reuse the injected
delayFn(phase-executor.ts:825) rather than inventing a mechanism. This does not exist today; the current branch is a barecontinue. Bounded retry alone is not the AC. - AC-5: On chain halt, the run summary prints the resume affordance. Implement in
run-display.ts:119 displaySummary, not at the orchestrator break — that is where feat: resume a partially-completed chain from its last good link #760 already restates checkpoint failures for the same reason ("the per-issue warning has long scrolled past by now on a multi-hour chain",run-display.ts:149-151), andRunResultthere carriesmergedOptions. Note: feat: resume a partially-completed chain from its last good link #760 added no resume flag — resume is re-running the identical command. The output must say so explicitly, or it reads as a bug. UseformatRateLimitMessage(errors.ts:313); includeresetsAtwhen present. - AC-6:
structuredErroris threaded intobatch-executor.ts:942and:623in preference toclassifyError, andrate_limit/billingare added toERROR_CATEGORIES(error-classifier.ts:19-27) anderrorTypeToCategory(:34-49). Prerequisite for AC-7. - AC-7:
.sequant/metrics.jsonrecords a bounded-enumfailureCategoryonMetricRunSchema, threaded fromPhaseResult.structuredError→IssueResult→recordRun(run-orchestrator.ts:1545). Enum only — no message strings (privacy contract,metrics-schema.ts:69-77). - AC-8: Tests.
phase-executor.test.ts:722— "still retries a transient rate-limit failure (RateLimitError is retryable)" — pins the behavior AC-2 changes and must be inverted. Copy the shape of theBillingErrornon-retryable + MCP-skip tests at:651-692. Add an abort-path test asserting AC-1 (a hang carryingrateLimitInfoyields a classified failure, not a bare timeout). - AC-9: Before implementing AC-2's branch on
rateLimitType, validate against a real captured rejection that window exhaustion actually arrives withrateLimitTypepopulated. [UNRESOLVED] whether the SDK can emit a window rejection asassistant.error: "rate_limit"without a pairedrate_limit_event— if it can, window detection degrades to indistinguishable, AC-2 needs a fallback rule, and the metadata-dropping map atclaude-code.ts:363-376needs fixing too. Validate against a real capture, not a mocked event.
Notes for the implementer
- Testability wall: there are no orchestrator tests for
executeSequential's break path. The feat: resume a partially-completed chain from its last good link #760 commit called this out — "there were no orchestrator tests at all, which is why the seam the original fix(chain): --chain successors branch from main, not predecessor's committed work (up-front worktree provisioning) #748 bug lived in went untested" — and extractedplanChainResumeFromState(chain-resume.ts:231) to be testable standalone. AC-5 will hit the same wall and likely wants the same treatment.chain-resume.integration.test.tsis the natural home for an end-to-end halt-and-print test.
Out of scope
Scheduling runs around limit windows, token budgeting, resume itself (#760).
References
docs/reference/chain-mode-analysis-2026-05.md(investigate(metrics): chain mode 29% success rate vs 92% single-issue — failure forensics #604) — rate-limit exposure classified as structural- Improve multi-issue reliability: default to parallel worktrees and add spec retry logic #452 / PR feat(#452): spec phase retry with backoff and parallel vs chain docs #455 — existing transient-failure retry precedent
Activity
admarble commentedon Jul 15, 2026
Assessment
→ CLARIFY — Two independent problems: the mandated evidence is gone, and the proposed approach has been superseded.
1. The cited forensic logs no longer exist
AC-1 requires signatures "validated against the f317530c and 058048af run logs" and AC-5 requires unit tests using "verbatim log samples from the two forensic runs". Neither log is present:
.sequant/logs/; no filename contains either run id.docs/reference/chain-mode-analysis-2026-05.md:66-67— two rows of prose, no raw output.As written, both ACs are unsatisfiable. Per the motivating-example rule this issue itself invokes, synthetic fixtures are not an acceptable substitute here — so this needs a real decision: locate the logs, or re-base the ACs on a different real corpus.
2. The premise is stale — #732 shipped structured signals
The Context says "nothing classifies rate-limit signatures in the chain loop", and the Proposal says patterns "should be pulled from the two forensic run logs". Since filing, #732 (closed) landed exactly the better version of this:
src/lib/workflow/drivers/claude-code.ts—createRateLimitError/RateLimitErrorbuilt from the SDK's structuredrate_limit_eventandassistant.errorsignals.src/lib/workflow/phase-executor.ts:915— already prefers the driver'sstructuredErrorover stderr-regex classification, with the in-code comment that regex "only sees text and never the structured data."Log-scraped regex signatures would re-introduce precisely what #732 removed.
AC-3 also already exists — bounded retry-with-backoff for transient errors is implemented at
phase-executor.ts:912-925(isRetryable+COLD_START_MAX_RETRIES).What's genuinely still unbuilt
The chain-level behavior: halt the chain on a window-exhaustion classification without waiting out the 1800s timeout ladder, print the resume command (now that #760 has shipped resume), and record the failure category in
.sequant/metrics.json(nofailureCategoryfield exists today).Recommendation: rewrite the ACs around #732's structured
RateLimitError— distinguishing window-exhaustion from transient — and drop the log-signature framing entirely. The valuable core survives; its stated method doesn't.admarble commentedon Jul 15, 2026
Clarification: premise verified, root cause found, ACs rewritten
Fanned out two agents against the code and verified every load-bearing claim by hand. Result: the issue's core instinct is right, the assessment's correction to it was partly wrong, and the actual root cause is one line-range nobody had named.
Labelling as in the earlier research comment: [VERIFIED] = reproduced against this checkout. [UNRESOLVED] = flagged, not guessed.
1. The title premise holds — the cascade is real, but it's within one phase
I initially concluded the opposite and was wrong. Correcting it explicitly, because the correction is the finding.
The chain does already halt at the first failed link —
run-orchestrator.ts:1337-1345is an unconditionalbreak, and the phase loop breaks atbatch-executor.ts:1089-1090. So there is no march through remaining issues. That part of the Context is inaccurate.But "1800s phase timeouts that cascaded — burning ~30+ minutes per timed-out phase" is [VERIFIED] accurate — it just happens inside a single phase, via the retry ladder, before the break ever fires:
COLD_START_MAX_RETRIES = 2(phase-executor.ts:56) → up to 3 attempts, andRateLimitErroris explicitly allowed to consume them because it is constructedisRetryable: true(errors.ts:215).phase-executor.ts:972-978) adds a fourth. Its gate is!failureIsBilling && !failureIsCapped— rate-limiting is not on that skip list, so a throttle still triggers the "retrying without MCP" re-spawn.Each attempt can hang to the full
phaseTimeout(default 1800s,types.ts:188). Worst case ≈ 4 × 1800s ≈ 2 hours on one phase. (Reasoned from the ladder, not measured — flagging as such.)2. Root cause: the abort path drops the structured error
This is the bug, and it is one line-range —
drivers/claude-code.ts:287-294:No
structuredError. The sibling catch path at:302-318does callbuildStructuredError. The comment above it states the intent — "Abort/timeout is handled above first, so a genuine timeout is never masked by a stale rate-limit signal" — and that intent is sound, but the consequence runs the other way:Timeout after 1800s,rateLimitInfoalready captured at:152-157is discarded →phase-executor.ts:918falls back toclassifyError(stderrTail), which sees no rate-limit text →SubprocessError→ MCP fallback fires anyway.That second path is the forensic signature this issue was filed about. The missing logs would have shown exactly this.
3. Correction to the assessment: AC-3 does not already exist
The assessment states bounded retry-with-backoff is implemented at
phase-executor.ts:912-925. [VERIFIED] false. The retryable branch ends in a barecontinue— no delay:The only
delayFn(:825-826) is wired solely to the spec-extra retry at:1035(SPEC_RETRY_BACKOFF_MS, 5000ms,phase === "spec"only). Retry is bounded; backoff does not exist on this path. A rate-limited phase re-spawns immediately, twice, into the same closed window. This is the sharpest finding here and the one AC that should not have been dropped as redundant.4. What #732 actually gives us
Confirmed shipped (PR #735 /
27f8106, plus0af8872,1dc6e15; SDK 0.3.205 installed). Typed errors live insrc/lib/errors.ts, not the driver:RateLimitError:207(isRetryable: true),BillingError:227,RateLimitMetadata:186-200carryingresetsAt/rateLimitType/errorCode.Window-vs-transient is only partially distinguishable, and it depends on which signal arrives:
rate_limit_event: yes. SDK exposesrateLimitType: 'five_hour' | 'seven_day' | ... | 'overage'andresetsAt(sdk.d.ts:4089-4105), copied verbatim into metadata aterrors.ts:340. (There is noretryAfter;resetsAtis the only timing signal.)claude-code.ts:363-376maps tonew RateLimitError("Rate limited")with no metadata argument —rateLimitTypeandresetsAtare both undefined, andrate_limitvsoverloadedcollapse into the same shape.RateLimitErrorisisRetryable: true.[UNRESOLVED] Whether the SDK ever emits a genuine window rejection as
assistant.error: "rate_limit"without a pairedrate_limit_event. If it does, window detection silently degrades to indistinguishable. Not verified against a real capture, and the existing tests don't settle it. Any AC written aroundrateLimitTypemust be validated against a real capture, not a mockedrate_limit_event— which is the same evidence discipline the original ACs were reaching for.5. Two more gaps
structuredErrornever leaves phase-executor. Grep acrosssrc/hits onlyerrors.ts,types.ts:220,agent-driver.ts:87,claude-code.ts,phase-executor.ts. Zero references inbatch-executor.tsorrun-orchestrator.ts. So the run-logerrorContextis built atbatch-executor.ts:942fromclassifyError(result.stderrTail, result.exitCode)— the very stderr-regex path #732 was meant to supersede — while the structured error sits ignored on the same object. Same defect at:623. AnderrorTypeToCategory(error-classifier.ts:34-49) has no rate-limit/billing case →default: "unknown".No
failureCategoryin metrics.MetricRunSchema(metrics-schema.ts:78-97) hasoutcome: success | partial | failedand no classification. An optional field does not force theversion: z.literal(1)bump. Note the schema's stated privacy contract (:69-77) is "No error messages (could contain sensitive info)" — a bounded enum category is consistent with that; a message string is not.Rewritten Acceptance Criteria
drivers/claude-code.ts:287-294attachesstructuredErrorviabuildStructuredError(rateLimitInfo, assistantError, apiRetryError), matching the sibling catch path at:302. A rate limit that manifests as a hang must remain classifiable downstream. Without this, every AC below is unreachable.resetsAtis beyond a short threshold does not consume cold-start retries. Model it on thecappedprecedent (phase-executor.ts:906-908): an explicit early return skipping all retries. A window resetting in hours cannot be retried into success.phase-executor.ts:972-978) additionally checks!failureIsRateLimited, alongside the existing!failureIsBilling && !failureIsCapped. A throttle must not trigger "retrying without MCP".delayFn(phase-executor.ts:825) rather than inventing a mechanism. This does not exist today; the current branch is a barecontinue. Bounded retry alone is not the AC.run-display.ts:119 displaySummary, not at the orchestrator break — that is where feat: resume a partially-completed chain from its last good link #760 already restates checkpoint failures for the same reason ("the per-issue warning has long scrolled past by now on a multi-hour chain",run-display.ts:149-151), andRunResultthere carriesmergedOptions. Note: feat: resume a partially-completed chain from its last good link #760 added no resume flag — resume is re-running the identical command. The output must say so explicitly (e.g. "re-run the same command to resume from fix: /qa skill should handle 'no implementation' case gracefully #102"), or it reads as a bug. UseformatRateLimitMessage(errors.ts:313) for the label; includeresetsAtwhen present.structuredErroris threaded intobatch-executor.ts:942and:623in preference toclassifyError, andrate_limit/billingare added toERROR_CATEGORIES(error-classifier.ts:19-27) anderrorTypeToCategory(:34-49). Prerequisite for AC-7..sequant/metrics.jsonrecords a bounded-enumfailureCategoryonMetricRunSchema, threaded fromPhaseResult.structuredError→IssueResult→recordRun(run-orchestrator.ts:1545). Enum only — no message strings (privacy contract,metrics-schema.ts:69-77).phase-executor.test.ts:722— "still retries a transient rate-limit failure (RateLimitError is retryable)" — pins the behavior AC-2 changes and must be inverted. Copy the shape of theBillingErrornon-retryable + MCP-skip tests at:651-692. Add an abort-path test asserting AC-1 (a hang carryingrateLimitInfoyields a classified failure, not a bare timeout).rateLimitType, validate against a real captured rejection that window exhaustion actually arrives withrateLimitTypepopulated (see §4 [UNRESOLVED]). If it can arrive bare viaassistant.error, AC-2 needs a fallback rule and the metadata-dropping map atclaude-code.ts:363-376needs fixing too.Notes for the implementer
executeSequential's break path. The feat: resume a partially-completed chain from its last good link #760 commit called this out — "there were no orchestrator tests at all, which is why the seam the original fix(chain): --chain successors branch from main, not predecessor's committed work (up-front worktree provisioning) #748 bug lived in went untested" — and extractedplanChainResumeFromState(chain-resume.ts:231) to be testable standalone. AC-5 will hit the same wall and likely wants the same treatment.chain-resume.integration.test.tsis the natural home for an end-to-end halt-and-print test.Investigation: 2 agents + hand-verification of every quoted line. The assessment's "AC-3 already exists" and my own initial "the timeout isn't waited out" were both wrong — both came from trusting a code comment that described intent rather than effect.
admarble commentedon Jul 16, 2026
Re-assessment: CLARIFY → PROCEED
Supersedes my earlier CLARIFY. The rewritten ACs resolve both objections I raised — and correct a claim of mine that was simply wrong.
My "AC-3 already exists" was wrong — verified
I asserted bounded retry-with-backoff was implemented at
phase-executor.ts:912-925. Re-read the code rather than the comment above it:continue— no delay of any kind.delayFn(:825) is referenced exactly once, at:1035, for the spec-extra retry (SPEC_RETRY_BACKOFF_MS,phase === "spec"only).Retry is bounded; backoff does not exist on this path. The clarification's correction stands, and AC-4 is real work.
The tell is worth recording: I reasoned from the
#732comment at:915("Prefer the driver's structured cause… over stderr-regex classification") and inferred the structured path was wired through. It isn't.grep -rn structuredError src --include="*.ts"returns zero hits inbatch-executor.tsandrun-orchestrator.ts— the field stops at phase-executor.batch-executor.ts:942still buildserrorContextfromclassifyError(result.stderrTail, ...), the exact stderr-regex path #732 was meant to supersede, with the structured error sitting unused on the same object.So "#732 supersedes this issue" was wrong in the way that matters: #732 shipped the types, nothing branches on them. The premise held; I talked myself out of it from a comment. Also confirmed: the abort path at
drivers/claude-code.ts:287-294returns withoutstructuredErrorwhile its sibling at:302attaches it — AC-1's root cause, verified.Assessment
Workflow:
exec → qawith quality loopSpec is skipped deliberately — the rewritten ACs are already a spec, down to the test to invert (
phase-executor.test.ts:722).Order: after #766, before #767. Real file overlap, from ACs naming line ranges:
batch-executor.ts(this issue's AC-6 at:942/:623; #766 at:1055; #767 at:199) andrun-orchestrator.ts(AC-7 at:1545; #766 at:416).⚠ AC-9 gates AC-2 and is unresolved inside the issue — whether window exhaustion can arrive as a bare
assistant.errorwithout a pairedrate_limit_event. If it can, AC-2 needs a fallback rule and the metadata-dropping map atclaude-code.ts:363-376needs fixing too. Resolve it before building AC-2'srateLimitTypebranch, and validate against a real capture rather than a mockedrate_limit_event.⚠ Possible cross-link with #766, flagged as hypothesis not finding. #766's undiagnosed loose end — #762 displaying
Timeout after 1800swhen its last failure was an API drop — sits on the same abort path this issue's AC-1 rewrites, which returns exactly that bare string. I could not confirm they are the same bug:API Error: Connection closed mid-responseshould not match theabort/AbortErrorbranch, so it ought to have taken the catch path and surfaced the API error. Either way AC-1 changes that path'serrorfield, so whoever implements it should look at #766's loose end while in there.fix(#769): section-aware path extraction; drop background-only citati…
admarble commentedon Jul 16, 2026
Pre-run verification (2026-07-16, main @
dbfbfee)Re-verified every anchor in the rewritten ACs after the #766 (PR #772) and #767 (PR #774) merges. All substantive claims hold; the issue is runnable. Corrections and one resolved gate below.
AC-9 is no longer a hard gate on AC-2 — resolved by the SDK typings
The unresolved question was whether window exhaustion can arrive as a bare
assistant.error: "rate_limit"without a pairedrate_limit_event. Three findings settle the design consequence without a live capture:SDKRateLimitInfois documented subscription-only — the doc comment on the type (sdk.d.ts:4086-4088, SDK 0.3.205) reads "Rate limit information for claude.ai subscription users." API-key/console auth plausibly never receives the event at all; its rate limits would arrive only on the assistant-error channel (SDKAssistantMessageErroratsdk.d.ts:2822, which carries no metadata).resetsAtandrateLimitTypeare both optional (sdk.d.ts:4091-4092). Astatus: 'rejected'event with norateLimitTypeis legal per the contract.sdk.mjscontains zero references torate_limit_event; the event is produced inside the closed CLI binary and merely typed by the SDK.Consequence: AC-2's metadata-absent fallback rule is mandatory unconditionally, not contingent on AC-9's answer. Write AC-2 with the fallback from the start (e.g. metadata present +
resetsAtbeyond threshold → skip retries; metadata absent → treat as transient, AC-4's backoff path). Theclaude-code.ts:363-376metadata-dropping map fix is likewise unconditionally warranted. AC-9 downgrades to: capture a real rejection when one occurs and confirm the fallback fires as designed — validation, not a design gate.Also checked: no real captured rejection exists in
.sequant/logs/(97 files; the only "rate_limit" hit is #732's own implementation run log — mentions of the feature, not a limit event). AC-9 as originally written ("validate against a real capture" before implementing) is unsatisfiable from existing artifacts.#766's loose end is falsified as evidence for AC-1 — but AC-1 stands on its own
The assessment hypothesized #762's "Timeout after 1800s"-vs-API-drop discrepancy sat on the abort path AC-1 rewrites. It didn't — PR #772 diagnosed and fixed it as a display bug in
run-display.ts:toIssueSummary(first-failure-wins scan over accumulated quality-loop attempts; now reverse-scans for the last non-loop failure). Drop that cross-link from AC-1's rationale. AC-1's root cause is independently re-verified today: the abort early-return indrivers/claude-code.ts(~:287-294) still returns bareTimeout after ${config.phaseTimeout}swith nostructuredError, while the sibling catch path attaches it viabuildStructuredError(:340-344).Anchor corrections (post-#772/#774 drift)
metrics-schema.tsis atsrc/lib/workflow/metrics-schema.ts(ACs implysrc/lib/). Lines:69-77/:78-97are exact;failureCategoryconfirmed absent.run-display.tsis atsrc/commands/run-display.ts.displaySummaryis now:132(not:119— that's insidetoIssueSummarynow). The feat: resume a partially-completed chain from its last good link #760 checkpoint restatement is:161-180;mergedOptionsis destructured at:136.batch-executor.tssites are now:939and:620; AC-7'srecordRunisrun-orchestrator.ts:1553; the MCP fallback gate isphase-executor.ts:~958-968(failureIsBilling/failureIsCappedat:966-977).phase-executor.test.ts:722test to invert (verbatim name confirmed; the BillingError-shape tests to copy are:648-720); retryable branch:920still ends in a barecontinue(:933),COLD_START_MAX_RETRIES = 2(:56);errorFromAssistantErrormap:363-376still drops metadata;ERROR_CATEGORIES(error-classifier.ts:19-26) anderrorTypeToCategory(:34-49) still lack rate_limit/billing;RateLimitError:207/BillingError:227/RateLimitMetadata:186-200/formatRateLimitMessage:313all exact;planChainResumeFromStateatchain-resume.ts:231withchain-resume.integration.test.tspresent.Run command from the assessment stands:
sequant run 761 -Q --phases exec,qa(ACs are already spec-grade).fix(#761): don't mislabel a metadata-less billing halt as rate-limited
admarble commentedon Jul 16, 2026
QA Review for Issue #761
Full
/fullsolvepass (exec → qa) against the rewritten ACs (clarification comment) as amended by the pre-run verification (2026-07-16). PR: #781.AC Coverage
structuredErrorviabuildStructuredError, matching sibling catch pathdrivers/claude-code.tsabort branch now builds and attaches the structured error, preferring its message. Tests: rate-limited hang →RateLimitErrorwithresetsAtintact; billing hang →BillingError; regression guards: signal-less abort andallowed_warning-then-abort both stay a bareTimeout after Ns. The old#732pin ("does NOT mask a genuine timeout") was inverted as the ACs required.resetsAtbeyond threshold) does not consume cold-start retriesisWindowExhaustedRateLimit+ explicit early return modeled on thecappedprecedent, placed before the duration branch (rate-limit rejections fail fast and would otherwise be mistaken for cold-start failures). ThresholdRATE_LIMIT_WINDOW_SKIP_THRESHOLD_MS= 5 min. Metadata-absent fallback → transient (mandatory per pre-run verification). Tests: genuine-duration, cold-start-window, seconds-unitresetsAt, exact boundary.!failureIsRateLimited!failureIsBilling && !failureIsCapped && !failureIsRateLimited. Test: transient rate limit exhausts all attempts → nomcp: falsecall ever made.delayFncontinue:RATE_LIMIT_RETRY_BACKOFF_MS * 2 ** attempt(5s → 10s) awaited through the existingdelayFninjection point. Tests assert the exact delay sequence.displaySummarybuildRateLimitHaltNoticeextracted for standalone testability (the #760planChainResumeFromStatetreatment), consumed bydisplaySummaryafter the #760 checkpoint restatement. Label viaformatRateLimitMessagewithresetsAtwhen present; output says explicitly "Re-run the same command to resume from #N (no flag needed; completed links are skipped)" — phrasing verified againstcomputeChainResumePlansemantics. Uses the same #766 reverse non-loop scan astoIssueSummaryso the label describes the LAST attempt.structuredErrorthreaded into batch-executor errorContext;rate_limit/billingcategories addedresult.structuredError ?? classifyError(...).ERROR_CATEGORIES,errorTypeToCategory, and the duplicated inline enum inrun-log-schema.tsall extended (the schema enum would otherwise reject the new categories at validation).failureCategoryonMetricRunSchema, threadedPhaseResult→IssueResult→recordRunFailureCategorySchema = z.enum(ERROR_CATEGORIES);IssueResult.failureCategoryset at both failure returns viaderiveFailureCategory(reverse non-loop scan, structured-cause-first);recordRuntakes the first categorized failed issue. Additive/optional — noversionbump; pre-#761 records still parse (test-pinned). Privacy pinned by test: a free-textfailureCategoryfails schema validation. Security agent traced the full path — no message string can reachmetrics.json.:722pin, copy BillingError shapes, abort-path testphase-executor.test.ts:722and the driver abort-path pin the ACs didn't name but which guarded the same behavior). Added: window-exhaustion (both duration regimes), backoff sequence, MCP-skip, near-reset-still-transient, abort-path classification (transient + billing + two negative guards), halt-notice suite,deriveFailureCategoryunit tests, metrics schema/writer tests,errorTypeToCategorymappings. Full suite: 3999 passed. CI: 5/5 green.rateLimitTypepopulation against a real capture.sequant/logs/; emission is inside the closed CLI binary). The design consequence shipped unconditionally: metadata-absent fallback rule (AC-2) + theerrorFromAssistantErrormetadata-dropping map now records the originating variant sorate_limit/overloadedstay distinguishable. Follow-up: when a real window rejection occurs, confirm it arrives withrateLimitType/resetsAtpopulated and the exhaustion skip fires (noted in PR #781 test plan).Coverage: 9/9 ACs met (AC-9 per its amended definition).
Quality Checks
any/as anyin added linestscclean, eslint 0 warnings, full suite 3999 passed / 1 pre-existing expected-fail / 2 skippednpx tsx bin/cli.ts run --helpexits 0 with changed modules on the import pathcontinue, ungated MCP fallback, bare-timeout abort return) all replaced in-diff; detector "survivors" were historical CHANGELOG prose, not code[Unreleased]→ Fixed entry for #761Adversarial Re-Read
Findings: One genuine defect surfaced and fixed in-PR (
20c38cb): the AC-5 halt notice derived its label fromformatRateLimitMessage(err.metadata), which mislabels a metadata-lessBillingError(assistant-error channel) as "Rate limited" —isBillingFailure({})is false. Fixed to fall back to the typed error's own message when metadata carries no signal; regression test added. Also audited: data-flow ofstructuredErrorfrom driver →displaySummary(survives every hop,instanceofsafe — single module instance); phase-logstatusfor a classified rate-limited hang changes from"timeout"to"failure"withcategory: rate_limit(more truthful, intentional); theskipColdStartRetry(loop-phase) path needs no window check since it never retries, and the AC-3 gate covers its MCP exposure;batch-executor.test.ts's module mock was widened to passthrough realerrorTypeToCategory(the old mock omitted it, which would have broken every failure-path test oncederiveFailureCategoryran on failure returns).Status: Clean (after in-PR fix)
Risk Assessment
resetsAton a genuinely transient throttle would skip retries that might have succeeded; the failure is labeled and resumable either way.recordMetrics' 3-line failureCategory pick inrun-orchestrator.tshas no direct orchestrator test (the derivation itself is unit-tested inbatch-executor).AiderDriverhas no structured rate-limit signal channel (SDK-specific) — no cross-file sibling; therun.tssubprocess stderr-regex path is feat(driver): surface structured rate-limit/credits errors from SDK message stream (replaces #592 fallback noise) #732's documented fallback, unchanged by design.claude-code.tsalready attachedstructuredError(it was the model for AC-1); the twoclassifyErrorsites inbatch-executorwere both converted (AC-6 named both).Verdict: READY_FOR_MERGE
All 9 ACs met (AC-9 as amended by the pre-run verification), CI 5/5 green, the one adversarial-re-read finding fixed and regression-tested in-PR, and quality checks clean across the board.
/fullsolve Complete
Issue: #761 · PR: #781 · Status: READY_FOR_MERGE
clilabel, no UI)Ready for human review and merge. Post-merge follow-up: when a real window rejection is captured in the wild, validate the AC-9 emission-shape assumption (see PR test plan).
docs(#761): document failureCategory in analytics.md and the rate-lim…
fix(#761): classify rate limits mid-phase — skip doomed retries, labe…
feat(#783): surface failureCategory breakdown from metrics.json in se…
fix(#799): close remaining gaps — spec-phase billing symmetry + doc a…
fix(#799): fail-fast the -Q quality loop on billing / rate-limit-wind…
test(#782): guard the #799 sibling site; correct an overclaimed MCP e…
test(#782): validate #761 AC-9 — real window rejections carry rateLim…
feat(#804): --auto-wait — continue a rate-limited run when the window…
fix(#769): section-aware path extraction; drop background-only citations
feat(#783): surface failureCategory breakdown in sequant stats