Repository navigation
fix(cron): stop retrying permanent billing errors returned as HTTP 429 - #114113
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 1:50 PM ET / 17:50 UTC. ClawSweeper reviewWhat this changesThe PR prevents scheduled jobs from retrying a billing-classified provider failure merely because its error text contains HTTP 429. Merge readinessNo blocking correctness or security finding: the patch repairs the cron retry owner and should remain open for maintainer merge review and exact-head CI. Priority: P1 Review scores
Verification
How this fits togetherCron stores the provider-derived failure reason for a completed scheduled run, then decides whether to retry it with backoff or record a terminal outcome. This change makes that structured reason take precedence over raw error-text matching. flowchart LR
A[Provider error text] --> B[Failure classification]
B --> C[Cron job outcome]
C --> D[Retry decision]
D --> E{Allowed transient reason?}
E -->|Yes| F[Backoff and retry]
E -->|No| G[Terminal cron outcome]
Decision needed
Why: This is an intentional availability tradeoff: accepting a classified billing reason prevents wasteful retries, while a future classifier error could suppress recovery. Before merge
Agent review detailsSecurityNone. PR surfaceSource +5, Tests +43. Total +48 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt structured provider classification as cron’s canonical retry boundary, retaining raw-text matching only when no classification exists, after exact-head CI is green. Do we have a high-confidence way to reproduce the issue? Yes. The PR records a focused current-main fail-first run where billing text with HTTP 429 was retried, and the current retry-hint fallthrough directly explains that result. Is this the best way to solve the issue? Yes. The retry owner already receives the derived provider reason, so making that reason authoritative is narrower and safer than adding provider-specific message exceptions or changing the separate agent-attempt loop. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 72283e440e07. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
725b9a6 to
54794c8
Compare
54794c8 to
a3c4060
Compare
|
Land-ready verification on exact head
The canonical fix makes current typed provider classifications authoritative at cron's retry owner: billing is terminal, genuine rate limits retain backoff, and unclassified failures retain the existing text fallback. |
|
Merged via squash.
|
What Problem This Solves
Scheduled jobs treated an exhausted balance or spending limit as transient whenever the provider's permanent billing diagnostic also contained HTTP 429. That caused needless model attempts and kept unrecoverable cron work in the retry path.
Why This Change Was Made
The provider already classifies the response before cron receives it. Cron now treats every current structured classification as authoritative: allowed transient reasons retain backoff, while all other classified reasons terminate without falling through to message regexes. This fixes the complete invariant rather than special-casing xAI or one billing string, and leaves the existing raw-text fallback for unclassified failures.
The previous PR diff was discarded because it predated later rate-limit hardening and rewrote an unrelated 40-job admission test. The new boundary test targets the retry owner directly. The latest ClawSweeper review had no
Rank-up moves:section or patch finding; this maintainer repair accepts its stated availability boundary that provider-classified billing is terminal.One adjacent bounded behavior remains intentionally separate: the lower-level agent-session retry classifier can make up to three raw-message retries before provider classification reaches cron. It does not own cron rescheduling and cannot consume this structured result today; unifying that inner classifier is follow-up work rather than a second behavior change in this PR.
User Impact
Permanent provider billing failures stop after the failed scheduled run instead of being rescheduled as rate limits. Genuine provider-classified rate limits keep their existing backoff and retry behavior.
Evidence
src/cron/retry-hint.ts:63: a non-transient structured reason fell through toRATE_LIMIT_PATTERNand became retryable from incidental 429 text.node scripts/run-vitest.mjs src/cron/retry-hint.test.ts src/cron/service/timer-trigger.test.ts-> 2 failed, 11 passed. Both failures showed billing classified asrate_limitwith a 30-second retry.node scripts/run-vitest.mjs src/cron/retry-hint.test.ts src/cron/service/timer-trigger.test.ts-> 2 files passed, 13 tests passed.git diff --checkpassed.31328754637is green on attempt 2, includingcheck-dependencies, typechecks, lint, guards, build artifacts, SQLite boundaries, and the aggregateopenclaw/ci-gate. Attempt 1 had one unrelated ordering flake inworkspace-sync-tunnel.test.ts; the unchanged failed-job rerun passed.