Repository navigation
fix(#860): classify live five-hour windows as waitable, not terminal billing - #893
Merged
Merged
Conversation
…billing Narrow isBillingFailure: overageDisabledReason=out_of_credits alongside a recognized window type (five_hour / seven_day*) and a FUTURE resetsAt is a window that reopens, not a wallet failure — it now becomes a retryable RateLimitError so --auto-wait (#804) can act on it. errorCode=credits_required stays terminal even beside window evidence; missing/past resetsAt and unrecognized window types fail closed to the terminal path (AC-2/AC-3). Retention (isRateLimitFailureInfo) deliberately keeps the raw markers so no failure event is dropped. Driver: the billing_error assistant-enum downgrade no longer fires when the rate_limit_event carries waitable-window evidence — the bare enum has no metadata and would re-inert auto-wait. AC-6 observability for non-TTY waits: - LivenessHeartbeat (-q mode) emits an append-only line naming the wake time every 5 minutes (was TTY-gated; a background wait was silent for hours). - NonTTYRenderer (default mode) announces the wait once, names the wake time in its 60s heartbeat, and no longer prints a spurious ✘ failure line per 15s waiting tick; waiting ticks no longer reset the heartbeat idle clock. Evidence: all 26 captured payloads (22 ad-motion + 4 matcha-maps) committed with provenance as __tests__/fixtures/rate-limit-payloads-860.json (raw stdoutTail transcripts deliberately not committed — unrelated project content); fixture-driven tests assert waitable-while-live and terminal-once-aged, plus end-to-end replay through executePhaseWithRetry. AC-7 decision (keep in-process wait, file halt-and-resume follow-up) recorded in docs/investigations/auto-wait-vs-halt-resume-860.md. Gates: build ✓ lint ✓ full suite 4845 passed / 231 files ✓ Fixes #860
…window-classification # Conflicts: # CHANGELOG.md
7 tasks
…CP wait visibility, real-clock coverage Hardening pass over the classification fix, closing every gap named in review: - Informational statuses (allowed/allowed_warning) are never waitable: a stale near-limit warning misattributed to an unrelated failure costs an immediate halt, not a 5h sleep. Absent status stays waitable — the 26 captures carry no status field. - unrecognizedWindowHint: when a payload is terminal ONLY because its window type is unrecognized, the halt message names the rejected type, so Anthropic vocabulary drift is diagnosable from a run log instead of silently reading as a wallet failure. - Driver billing_error counter-exception narrowed to the full captured shape (waitable window + out_of_credits). A pure throttle beside a billing enum keeps the #732 billing-wins rule. - MCP/orchestrator wait visibility: withActivityHook emits throttled SEQUANT_PROGRESS waiting lines (once/min) naming the wake time — each line also resets the MCP inactivity timeout that would otherwise kill a legitimate pause as "no progress" (absolute 2h ceiling still applies); parseProgressLine/formatProgressMessage understand the new event; the wait is persisted to issue state (autoWait.wakeAt + phase, via StateManager.updateAutoWait) and surfaced by sequant status and the MCP status tool, refreshing lastActivity and the state.json mtime liveness proxy. - seven_day + out_of_credits semantics pinned by explicit tests and the captures README now records that combination as allowlisted-by-judgment, not evidence. - Real-clock smoke tests: waitForWindowReset and performAutoWait run against real setTimeout/Date.now (300ms scale) — tick chunking, prompt abort, and ledger accounting exercised with no injected timers. Gates: build + lint clean, full suite 4883 passed / 232 files. Refs #860 #892
Contributor
Author
Gap-hardening pass (
|
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
isBillingFailureinstead of inverting it:overageDisabledReason: "out_of_credits"alongside a recognized window type (five_hour/seven_day*prefix allowlist) and a futureresetsAtnow classifies as a retryableRateLimitError— a window that reopens, not a wallet failure — so--auto-wait(feat(run): --auto-wait — continue a rate-limited run when the window resets instead of halting #804) can finally fire on the only payload shape real subscription runs produce.errorCode: "credits_required", past/missing resets, and unrecognized shapes all remain terminal (fail closed).billing_errordowngrade:buildStructuredErrorno longer strips a waitable window's metadata when the assistant separately reports the barebilling_errorenum.-qheartbeat emits an append-only line naming the wake time every 5 minutes, and the default-mode NonTTY renderer announces the wait once and names the wake time in its 60s heartbeat — fixing two latent bugs (a spurious✘failure line per 15s waiting tick, and waiting ticks silencing the heartbeat by resetting its idle clock).__tests__/fixtures/rate-limit-payloads-860.json+docs/incidents/860/captures/README.md. RawstdoutTailtranscripts deliberately excluded (unrelated-project content).docs/investigations/auto-wait-vs-halt-resume-860.md).AC Verification
errors.tsnarrowing; 26/26 fixtures assertRateLimitErrorwhile liverateLimitType: "overage"executePhaseWithRetryreplays inauto-wait.test.tsheartbeat.ts+run-renderer.ts+ 9 new display testsMutation verification (gate-test rule)
five_hourremoved from allowlist → 10 tests fail across errors/auto-wait/driver suites ✅✘-suppression guard) ✅Test plan
npm run build,npm run lintcleanFixes #860
🤖 Generated with Claude Code