Repository navigation
fix: classify HTTP 429 'temporarily overloaded' as overloaded, not rate_limit - #97009
ChunkyPanda29 wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 10:50 AM ET / 14:50 UTC. Summary PR surface: Source +13, Tests +44. Total +57 across 2 files. Reproducibility: yes. source-level: current main checks the broad 429 rate-limit matcher before overload matching and the explicit HTTP 429 branch returns Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow shared classifier fix once maintainers accept the overload retry/fallback semantics; a committed status-path regression would further pin the changed 429 branch. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main checks the broad 429 rate-limit matcher before overload matching and the explicit HTTP 429 branch returns Is this the best way to solve the issue? Yes, the shared classifier is the right fix boundary because a provider-specific one-off would leave the same 429 overload precedence bug for other providers. The main remaining improvement is committed coverage for the explicit status branch, not a different implementation layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9241b9701d9c. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +13, Tests +44. Total +57 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Updated: removed the unrelated #15297 reference from source/test comments and added runtime proof showing classifyFailoverSignal now returns overloaded for 429 'temporarily overloaded' messages. All 7 runtime tests pass, 105 unit tests pass. @clawsweeper re-review |
…te_limit Some providers (Z.ai/GLM, Anthropic) return HTTP 429 with an 'overloaded' message body when their model fleet is at capacity. This is a transient server-side overload, not a per-account rate limit. Two changes in errors.ts: 1. classifyFailoverClassificationFromMessage: check isOverloadedErrorMessage BEFORE isRateLimitErrorMessage. The rateLimit pattern /429/ was matching '429 The service may be temporarily overloaded' first, returning 'rate_limit' before isOverloadedErrorMessage was ever evaluated. 2. classifyFailoverClassificationFromHttpStatus: add overloaded check for HTTP 429 (matching existing 503/499 handlers that already check messageReason === 'overloaded'). Previously, 429 overloaded responses triggered immediate model fallback instead of retry-with-backoff, causing unnecessary failovers and ~30-60s stalls on every turn when ZAI was overloaded. Added 6 test cases covering: 'temporarily overloaded', bare 'overloaded', 'model is at capacity', and regression tests for 'rate limit exceeded', 'too many requests', and billing messages.
af75d14 to
416905b
Compare
|
Squashed to a single clean commit (removed stale #15297 from commit message and source comments). Updated evidence with full 3-file/113-test suite output including model-fallback and assistant-failover tests. @clawsweeper re-review |
Shiny media proof: Runtime classifier outputScreenshot of Key results visible in the screenshot:
Unit test suite: 113 tests pass across 4 test files (failover-matches, errors, model-fallback, assistant-failover) |
Real OpenClaw Runtime Path Evidence (Trajectory Logs)Providing redacted Evidence 1: June 24, 2026 ? Heartbeat session (2 separate failover chains)Z.ai/GLM returned HTTP 429 "temporarily overloaded" 4 times across two runs. Each was misclassified as Impact: Every single request during this window triggered an unnecessary model failover from Evidence 2: June 25, 2026 ? Subagent runs (4 chain exhaustions in 3 minutes)During a Z.ai fleet-wide overload window, 4 subagent runs all hit the same 429 overloaded response. All misclassified as Impact: With the fix, these would classify as What this proves
Related Issues
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
After-fix runtime regression proof (real OpenClaw provider path)Captured from a real OpenClaw session running the patched Trajectory event (from
|
| Before fix (June 24–25 logs) | After fix (June 28 log) | |
|---|---|---|
| Error body | 429 The service may be temporarily overloaded |
429 Rate limit reached for requests |
| Classified as | rate_limit ❌ (wrong — should be overloaded) |
rate_limit ✅ (correct — this IS a rate limit) |
| Root cause | isRateLimitErrorMessage matched /429/ first |
Fix reorders checks; genuine rate limits still hit rate_limit |
The patched code now correctly routes overloaded-worded 429s to overloaded while preserving rate_limit for genuine rate-limit 429s — on the real OpenClaw provider path, not just in isolation.
Why we can't capture an after-fix "overloaded" trajectory right now
Z.ai fleet overload is a server-side capacity event — we can't trigger it from a single API key. Our 15-request concurrency test hit our own per-key rate limit, not a fleet-wide overload. The before-fix trajectory logs (June 24–25) show the bug occurring during natural Z.ai capacity events, which happen every few days. The patched OpenClaw will capture the corrected overloaded classification automatically the next time one occurs.
@0xghost42 — would you be able to take a look? You authored the merged GLM overload classifier (#93211) that touched the same failover-matches.ts / errors.ts paths. ClawSweeper's P1 blocker is asking for after-fix provider-path proof of the changed overloaded classification, but Z.ai fleet overload is outside our control to trigger on demand. We have:
- ✅ Before-fix real trajectory logs showing the
rate_limitmisclassification on429 temporarily overloaded - ✅ After-fix real trajectory log showing
rate_limitcorrectly preserved for genuine rate-limit 429s - ✅ After-fix classifier output showing
overloadedclassification working - ✅ 113 passing tests across 3 files
- ✅ All CI checks green
If you're satisfied with the source-level proof and regression evidence, a maintainer proof override would unblock this. Happy to add anything else that would help.
|
Superseded by #98165, landed as The official Z.AI error contract defines HTTP 429 as limiting and business code 1305 as a triggered rate limit; code 1312 is the separate model-high-traffic condition. Reclassifying 1305 to #98165 fixes the valid user-visible defect instead: it preserves overload wording when no more actionable retry detail exists, retains explicit retry/reset guidance, and leaves internal 429 backoff as |

What Problem This Solves
Some providers (Z.ai/GLM, Anthropic) return HTTP 429 with an "overloaded" message body when their model fleet is at capacity. This is a transient server-side overload, not a per-account rate limit.
OpenClaw was misclassifying these as
rate_limit, triggering immediate model fallback instead of retry-with-backoff. This caused unnecessary failovers and ~30-60s stalls on every turn when the provider was overloaded.Root Cause
Two issues in
src/agents/embedded-agent-helpers/errors.ts:1.
classifyFailoverClassificationFromMessage— ordering bugThe
isRateLimitErrorMessagepattern includes/429/as a match. So a message like"429 The service may be temporarily overloaded"matchedrate_limitbeforeisOverloadedErrorMessagewas ever evaluated.2.
classifyFailoverClassificationFromHttpStatus— missing overloaded checkThe HTTP 429 handler always returned
rate_limitfor non-billing 429s. The 503 and 499 handlers already checkmessageReason === "overloaded"— the 429 handler should do the same.Fix
classifyFailoverClassificationFromMessageto checkisOverloadedErrorMessagebeforeisRateLimitErrorMessageif (messageReason === "overloaded") return messageClassification;to the 429 status handlerImpact
rate_limit→ immediate model fallback (~30-60s stall)overloaded→ retry with backoff (same as 503 behavior)Evidence
Screenshot (runtime classifier proof)
Full test suite output (3 test files, 113 tests, all pass)
Runtime classifier proof (classifyFailoverSignal — the actual path OpenClaw uses)
Key observations:
overloaded(notrate_limit)classifyProviderRuntimeFailureKindreturnstimeout(retryable) for overloaded, vsrate_limitfor actual rate limits — this is the existing behavior that was being bypassedReal OpenClaw runtime path evidence (trajectory logs)
Redacted
model.fallback_steptrajectory events extracted from real OpenClaw session.trajectory.jsonllogs — the actual runtime failover path, not isolated classifier output.Before-fix: June 24, 2026 — Heartbeat session (4 unnecessary failovers)
Z.ai/GLM returned HTTP 429 "temporarily overloaded" 4 times across two runs. Each was misclassified as
rate_limit, triggering unnecessary model fallback:Before-fix: June 25, 2026 — Subagent runs (4 chain exhaustions in 3 min)
During a Z.ai fleet-wide overload, 4 subagent runs all hit 429 overloaded. All misclassified as
rate_limit, all resulted in chain_exhausted:With the fix, these classify as
overloaded→ retry-with-backoff on the same model, avoiding cascading chain exhaustion across fallback models (which were all on the same overloaded Z.ai fleet).Before-fix logs (real-world)
After fix, this same error classifies as
failoverReason=overloaded, engaging retry-with-backoff instead of immediate fallback.New unit tests (6 in failover-matches.test.ts)
"429 The service may be temporarily overloaded..."overloaded"429 overloaded"overloaded"429 The selected model is at capacity"overloaded"429 Rate limit exceeded"rate_limit"429 Too many requests"rate_limit'429 {"code":1311,...}'(billing)billingRelated Issues