Repository navigation
test(#782): validate #761 AC-9 — real window rejections carry rateLimitType/resetsAt - #805
Merged
admarble merged 3 commits intoJul 25, 2026
Conversation
…itType/resetsAt Post-hoc validation #761 AC-9 asked for. Two real rate-limit rejections captured 2026-07-18 (startCommit b1bedbc — the PR #781 merge commit itself, so the structured errorContext persistence was live) settle the load-bearing assumption: window exhaustion DOES arrive on the structured rate_limit_event channel with rateLimitType and resetsAt populated. AC-1: channel = rate_limit_event, not bare assistant.error (errorMetadata .assistantError absent — structurally decisive per buildStructuredError). rateLimitType "five_hour", resetsAt 1784392200 -> 16:30Z, matching the CLI's own "resets 11:30am" line. AC-2: partial, and recorded as such. MCP fallback correctly skipped and the non-retryable classification held, but the "window exhausted" line did not print — credits were also exhausted, so isBillingFailure won and the error was a BillingError, which the predicate excludes by design. The counterfactual is decisive: the reset was 24.8 min out, well past the 5-min threshold, so the same payload without the credits flag would have taken the branch. Cold-start retries were NOT skipped (known, intended — see the comment above the capped early return). AC-3: not triggered. The AC is conditional on rejections arriving WITHOUT metadata; metadata was present, so no follow-up issue is filed. Adds a production-sample regression test that replays the committed captures through createRateLimitError and isWindowExhaustedRateLimit, including the counterfactual. Existing coverage is entirely synthetic; this pins the real field names and units so SDK drift breaks a test instead of silently disabling the #761 branch. Verified non-tautological by mutation. Docs + tests only — no behavior change, no threshold change (issue Non-Goals).
…vidence row Two QA findings on my own first commit. 1. Cross-file sibling site (QA §5). batch-executor's isBillingOrWindowHalt (#799) consumes the same classifier as the #761 window branch, and its coverage is also entirely synthetic. The captured payload is a valid input, so replay it there too: if SDK drift changed the shape, the predicate would silently stop halting the -Q loop and #799's "QA completed without a parseable verdict" mislabel would return. Also pins billingHaltReason. 2. Overclaim in validation.md. The "MCP fallback skipped" row cited "no retrying without MCP line" as if it were observed in the capture. It is not: stdoutTail/stderrTail carry the driver's stdoutBuffer (agent output), while that line comes from the executor's own bracketedConsoleLog — so it would not appear in these artifacts either way. The skip is a code-level guarantee via the failureIsBilling gate, not a log observation. The evidence table now carries a "kind of evidence" column separating observed from inferred from code-level across all four rows. Still docs + tests only.
3 tasks
…ignored and rotating Second-look findings on the validation record. 1. Perishable, unverifiable evidence. validation.md cited ".sequant/metrics.json" as independent corroboration for AC-1, but .sequant/ is gitignored (.gitignore:52) — so no reader could check that claim. Worse, run-log rotation is capped at maxFiles: 100 and is actively evicting: the directory was observed dropping 100 -> 99 while this was being written, so the cited originals are on their way out. The two matching metrics entries are now excerpted verbatim into the captures directory, and the doc explains why the artifacts are copied rather than referenced. This also retroactively justifies committing the run logs — that was load-bearing preservation, not tidiness. 2. Understated the cold-start finding. It was labelled "arithmetic inference, not measurement". The attempt COUNT is in fact provable: cumulative phase time is 17.47s, so every attempt ran under 60s, and at sub-60s a BillingError can take no early exit from the ladder (not capped; not a RateLimitError, so both the window and transient-backoff branches are skipped; duration < threshold) — leaving only the cold-start fall-through. The loop therefore runs attempts 0-2 and exhausts: exactly 3 agent spawns against an account with no credits. Only the per-attempt split (~5.8s each) is arithmetic; the doc now separates the two. No test or behavior change; 201 tests still pass.
admarble
deleted the
feature/782-validate-761-ac-9-confirm-real-window-exhausti
branch
July 25, 2026 17:09
Closed
10 tasks
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 post-hoc validation #761 AC-9 asked for. #782 was parked on 2026-07-18 for want of a real captured rejection; 30 minutes later, one arrived. Two run logs from that day record
startCommit: b1bedbc— the PR #781 merge commit itself — so the structurederrorContextpersistence #761 added was live when they were written.The load-bearing assumption is validated: real window exhaustion does arrive on the structured
rate_limit_eventchannel withrateLimitTypeandresetsAtpopulated.Docs + tests only. No behavior change, no threshold change (honors the issue's Non-Goals).
AC Verification
rateLimitType/resetsAtpopulateddocs/incidents/782/validation.md;errorMetadata.assistantErrorabsent ⇒ structuredrate_limit_event, not the bare fallback — structurally decisive perbuildStructuredError.rateLimitType: "five_hour",resetsAt: 1784392200→16:30Z, matching the CLI's ownresets 11:30amline.AC-2 in detail — what the artifacts actually show
failureIsBillinggate; no "retrying without MCP" noiseisRetryable: falsepersistedThe rejection also carried
overageDisabledReason: "out_of_credits", soisBillingFailure()won andcreateRateLimitError()returned aBillingError, not aRateLimitError.isWindowExhaustedRateLimit()opens withif (!(error instanceof RateLimitError)) return false, so the window path was unreachable.The counterfactual is decisive, though: at phase start the reset was 24.8 minutes out — well past the 5-minute threshold. Absent the credits flag, this exact payload takes the window branch. The metadata was sufficient to drive it; only the billing classifier took precedence. That counterfactual is now pinned by a test.
Cold-start retries running on the sub-60s billing path is known, intended behavior — the comment above the
cappedearly return says so explicitly. Recorded for completeness, not filed as a bug.Residual, stated plainly: a pure
RateLimitErrorwindow rejection — limit hit while credits remain — is still unwitnessed. The metadata channel is proven; the specific branch is proven only by counterfactual.Changes
docs/incidents/782/captures/2026-07-18/— both run logs, verbatim (verified byte-identical to.sequant/logs/). Follows the existingdocs/incidents/<N>/captures/<date>/convention from fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 / investigate(cli): #652 renderer corruption — column-mismatch hypothesis refuted, real cause unknown #655.docs/incidents/782/validation.md— the AC-1/AC-2/AC-3 record with code references, the residual, and the consequence for feat(run): --auto-wait — continue a rate-limited run when the window resets instead of halting #804.src/lib/workflow/phase-executor.test.ts— production-sample regression guard (6 tests: 2 captures × 3 blocks).Why the test, given "no design changes"
Existing coverage for
isWindowExhaustedRateLimitis entirely synthetic. This test reads the committed capture files and replays them throughcreateRateLimitError/isWindowExhaustedRateLimit, so the doc artifact and the test cannot drift apart. It pins the real field names and units — a renamedresetsAt, a changed unit, or a droppedrateLimitTypebreaks a test instead of silently disabling the #761 branch. It adds no behavior and changes no threshold.Test plan
npm run build— cleannpm run lint— clean (0 errors, 0 warnings,--max-warnings 0)phase-executor+batch-executorsuites — 200/200 passrateLimitTypeand shorteningresetsAtto 1 min out fails all 3 assertions, including the counterfactual failingexpected false to be true(provingisWindowExhaustedRateLimitis genuinely exercised). Capture restored byte-identical afterward.Note for #804 (
--auto-wait)#804 flags this validation as load-bearing. Answer:
resetsAtis present on the structured channel, so auto-wait can compute a real wait target on the real path. Caveat worth carrying into that design — the observed rejection was credits exhaustion, where waiting doesn't help. Auto-wait should gate onRateLimitError, not on the presence ofresetsAtalone, sinceBillingErrorcarries aresetsAttoo.Closes #782