Skip to content

fix: classify HTTP 429 'temporarily overloaded' as overloaded, not rate_limit - #97009

Closed
ChunkyPanda29 wants to merge 1 commit into
openclaw:mainfrom
ChunkyPanda29:fix/overloaded-429-classification
Closed

ChunkyPanda29 wants to merge 1 commit into
openclaw:mainfrom
ChunkyPanda29:fix/overloaded-429-classification

Conversation

@ChunkyPanda29

@ChunkyPanda29 ChunkyPanda29 commented Jun 26, 2026 •

Copy link
Copy Markdown

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 bug

The isRateLimitErrorMessage pattern includes /429/ as a match. So a message like "429 The service may be temporarily overloaded" matched rate_limit before isOverloadedErrorMessage was ever evaluated.

2. classifyFailoverClassificationFromHttpStatus — missing overloaded check

The HTTP 429 handler always returned rate_limit for non-billing 429s. The 503 and 499 handlers already check messageReason === "overloaded" — the 429 handler should do the same.

Fix

  1. Reorder classifyFailoverClassificationFromMessage to check isOverloadedErrorMessage before isRateLimitErrorMessage
  2. Add if (messageReason === "overloaded") return messageClassification; to the 429 status handler

Impact

  • Before: 429 "temporarily overloaded" → rate_limit → immediate model fallback (~30-60s stall)
  • After: 429 "temporarily overloaded" → overloaded → retry with backoff (same as 503 behavior)

Evidence

Screenshot (runtime classifier proof)

Runtime Proof: 429 Overloaded Classification

Full test suite output (3 test files, 113 tests, all pass)

✓ src/agents/embedded-agent-helpers/failover-matches.test.ts > HTTP 429 with overloaded message body > classifies 429 'temporarily overloaded' as overloaded, not rate_limit
✓ src/agents/embedded-agent-helpers/failover-matches.test.ts > HTTP 429 with overloaded message body > classifies 429 'overloaded' (bare) as overloaded
✓ src/agents/embedded-agent-helpers/failover-matches.test.ts > HTTP 429 with overloaded message body > classifies 429 'model is at capacity' as overloaded
✓ src/agents/embedded-agent-helpers/failover-matches.test.ts > HTTP 429 with overloaded message body > still classifies 429 'rate limit exceeded' as rate_limit
✓ src/agents/embedded-agent-helpers/failover-matches.test.ts > HTTP 429 with overloaded message body > still classifies 429 'too many requests' as rate_limit
✓ src/agents/embedded-agent-helpers/failover-matches.test.ts > HTTP 429 with overloaded message body > still classifies 429 billing messages as billing

✓ src/agents/model-fallback.test.ts > runWithModelFallback > falls back on a Zhipu GLM 1305 overload body and classifies it as overloaded

✓ src/agents/embedded-agent-runner/run/assistant-failover.test.ts > handleAssistantFailover > rotate_profile branch > retries the same model before spending a rate-limit profile rotation
✓ src/agents/embedded-agent-runner/run/assistant-failover.test.ts > handleAssistantFailover > rotate_profile branch > does not spend same-model retry budget on quota-style rate limits

 Test Files  3 passed (3)
      Tests  113 passed (113)
   Duration  79.64s

Runtime classifier proof (classifyFailoverSignal — the actual path OpenClaw uses)

PASS: Z.ai/GLM 429 overloaded (real-world, with status) -> overloaded
PASS: Z.ai/GLM 429 overloaded (message only, no explicit status) -> overloaded
PASS: Anthropic 429 overloaded -> overloaded
PASS: 503 overloaded (existing behavior, should be overloaded) -> overloaded
PASS: 429 rate limit (should stay rate_limit) -> rate_limit
PASS: 429 too many requests (should stay rate_limit) -> rate_limit
PASS: 429 billing (should stay billing) -> billing

Key observations:

  • 429 "temporarily overloaded" now classifies as overloaded (not rate_limit)
  • classifyProviderRuntimeFailureKind returns timeout (retryable) for overloaded, vs rate_limit for actual rate limits — this is the existing behavior that was being bypassed
  • 429 rate-limit and billing classifications are unchanged (regression-safe)
  • 503 overloaded behavior is unchanged (parity confirmed)

Real OpenClaw runtime path evidence (trajectory logs)

Redacted model.fallback_step trajectory events extracted from real OpenClaw session .trajectory.jsonl logs — 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:

# 2026-06-24T12:35:19Z — model.fallback_step
provider: zai | model: glm-5.1
fallbackStepFromModel: zai/glm-5.1 → fallbackStepToModel: zai/glm-5
fallbackStepFromFailureReason: rate_limit          ← misclassified (should be overloaded)
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 1 | fallbackStepFinalOutcome: next_fallback

# 2026-06-24T12:36:08Z
fallbackStepFromFailureReason: rate_limit          ← misclassified
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 2 | fallbackStepFinalOutcome: succeeded

# 2026-06-24T12:50:43Z (second occurrence)
fallbackStepFromFailureReason: rate_limit          ← misclassified
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 1 | fallbackStepFinalOutcome: next_fallback

# 2026-06-24T12:50:59Z
fallbackStepFromFailureReason: rate_limit          ← misclassified
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 2 | fallbackStepFinalOutcome: succeeded

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:

# 2026-06-25T08:31:19Z — subagent
fallbackStepFromModel: zai/glm-5.1
fallbackStepFromFailureReason: rate_limit          ← misclassified
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepFinalOutcome: chain_exhausted

# 2026-06-25T08:31:53Z — subagent
fallbackStepFromFailureReason: rate_limit | fallbackStepFinalOutcome: chain_exhausted

# 2026-06-25T08:32:51Z — subagent
fallbackStepFromFailureReason: rate_limit | fallbackStepFinalOutcome: chain_exhausted

# 2026-06-25T08:33:56Z — subagent
fallbackStepFromFailureReason: rate_limit | fallbackStepFinalOutcome: 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)

event=embedded_run_agent_end | zai/glm-5.1 | run=e600fd8a | isError=true
failoverReason=rate_limit
rawErrorPreview="429 The service may be temporarily overloaded, please try again later"

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)

Input Expected Status
"429 The service may be temporarily overloaded..." overloaded New
"429 overloaded" overloaded New
"429 The selected model is at capacity" overloaded New
"429 Rate limit exceeded" rate_limit Regression
"429 Too many requests" rate_limit Regression
'429 {"code":1311,...}' (billing) billing Regression

Related Issues

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 26, 2026
@clawsweeper

clawsweeper Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 10:50 AM ET / 14:50 UTC.

Summary
The PR reorders shared failover message classification, adds an overloaded-preserving HTTP 429 status branch, and adds regression coverage for overloaded, rate-limit, and billing 429 messages.

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 rate_limit after billing checks. That is enough to reproduce the misclassification path without live provider access.

Review metrics: 1 noteworthy metric.

  • Failover decision points changed: 2 changed. The diff changes both raw message classification order and explicit HTTP 429 status classification, so maintainers should review the retry/fallback semantic shift before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit ✨ media proof bonus
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Add a committed classifyFailoverSignal({ status: 429, message: ... }) regression if maintainers want the status branch pinned in CI.

Risk before merge

  • [P2] Merging changes overload-worded HTTP 429s from rate_limit to overloaded, which changes auth-profile cooldown, retry/backoff, session suspension, and model/profile fallback behavior for affected providers.
  • [P1] The after-fix proof demonstrates the classifier path and a real patched-runtime rate-limit regression case, but there is still no natural after-fix provider fleet-overload event log because that event is not triggerable on demand.

Maintainer options:

  1. Accept overload 429 semantics (recommended)
    Merge once maintainers are comfortable that overload-worded 429s should use overloaded backoff/profile behavior instead of rate-limit cooldown and suspension behavior.
  2. Add status-path regression
    Ask for one committed classifyFailoverSignal({ status: 429, message: ... }) regression test so the explicit HTTP status branch is pinned in CI.
  3. Pause for fallback owner confirmation
    Pause if maintainers are not ready to make the shared 429 overload classification apply across affected providers.

Next step before merge

  • No automated repair is needed; maintainers need to accept the provider retry/fallback semantic risk and decide whether to require committed status-path coverage.

Security
Cleared: The diff only changes agent error classification logic and tests; it does not touch dependencies, workflows, secrets, package resolution, or code-execution surfaces.

Review details

Best 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 rate_limit after billing checks. That is enough to reproduce the misclassification path without live provider access.

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 changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR includes inspected after-fix terminal screenshot proof for the changed classifier path and redacted runtime logs showing genuine 429 rate-limit behavior remains preserved.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR includes inspected after-fix terminal screenshot proof for the changed classifier path and redacted runtime logs showing genuine 429 rate-limit behavior remains preserved.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a focused provider failover bug fix with limited but real impact on overloaded model handling.
  • merge-risk: 🚨 auth-provider: The diff changes provider 429 classification from rate_limit to overloaded for some messages, which can alter auth-profile cooldown, retry, and fallback routing.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR includes inspected after-fix terminal screenshot proof for the changed classifier path and redacted runtime logs showing genuine 429 rate-limit behavior remains preserved.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR includes inspected after-fix terminal screenshot proof for the changed classifier path and redacted runtime logs showing genuine 429 rate-limit behavior remains preserved.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR includes inspected after-fix terminal screenshot proof for the changed classifier path and redacted runtime logs showing genuine 429 rate-limit behavior remains preserved.
Evidence reviewed

PR surface:

Source +13, Tests +44. Total +57 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 16 3 +13
Tests 1 44 0 +44
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 60 3 +57

What I checked:

Likely related people:

  • 0xghost42: Authored the merged Zhipu/GLM overload classifier PR that touched the same shared overload matcher and failover tests. (role: recent adjacent classifier contributor; confidence: high; commits: a30de0d27477, b1f2691edab4; files: src/agents/embedded-agent-helpers/failover-matches.ts, src/agents/embedded-agent-helpers/failover-matches.test.ts, src/agents/model-fallback.test.ts)
  • steipete: Merged the related overload-classifier PR and authored the provider-neutral matcher refactor in that PR; local shortlog also shows heavy activity in model fallback and classifier files. (role: recent merger and fallback contributor; confidence: high; commits: db79e94c89dc; files: src/agents/embedded-agent-helpers/failover-matches.ts, src/agents/model-fallback.test.ts, src/agents/model-fallback.ts)
  • Jaaneek: Current-main blame for the classifier and assistant-failover lines points to the recently merged xAI OAuth work, so this is a routing signal for recent rebases rather than the original overload behavior. (role: recent current-main carrier; confidence: medium; commits: 84bcd500c974; files: src/agents/embedded-agent-helpers/errors.ts, src/agents/embedded-agent-helpers/failover-matches.ts, src/agents/embedded-agent-runner/run/assistant-failover.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jun 26, 2026
@ChunkyPanda29

Copy link
Copy Markdown
Author

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

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 26, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 26, 2026
…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.
@ChunkyPanda29
ChunkyPanda29 force-pushed the fix/overloaded-429-classification branch from af75d14 to 416905b Compare June 26, 2026 10:21
@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 26, 2026
@ChunkyPanda29

Copy link
Copy Markdown
Author

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

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 26, 2026
@ChunkyPanda29

Copy link
Copy Markdown
Author

Shiny media proof: Runtime classifier output

Screenshot of classifyFailoverSignal() (the actual OpenClaw runtime path) exercised with 7 test cases after the fix:

Runtime Proof: 429 Overloaded Classification

Key results visible in the screenshot:

  • 429 "temporarily overloaded" → overloaded (was rate_limit before fix)
  • 429 "rate limit exceeded" → rate_limit (unchanged — regression-safe)
  • 429 billing (code 1311) → billing (unchanged — regression-safe)
  • 503 "temporarily overloaded" → overloaded (unchanged — parity confirmed)
  • classifyProviderRuntimeFailureKind returns timeout (retryable) for overloaded vs rate_limit for actual rate limits

Unit test suite: 113 tests pass across 4 test files (failover-matches, errors, model-fallback, assistant-failover)

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 26, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Jun 26, 2026
@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 27, 2026
@ChunkyPanda29

Copy link
Copy Markdown
Author

Real OpenClaw Runtime Path Evidence (Trajectory Logs)

Providing redacted model.fallback_step trajectory events from real OpenClaw provider runs. These are extracted from OpenClaw's own .trajectory.jsonl session logs ? the actual runtime failover path, not isolated classifier output.

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 rate_limit, triggering unnecessary model fallback to zai/glm-5:

# Trajectory event 1 ? 2026-06-24T12:35:19Z
type: model.fallback_step
provider: zai
model: glm-5.1
fallbackStepFromModel: zai/glm-5.1
fallbackStepToModel: zai/glm-5
fallbackStepFromFailureReason: rate_limit          ? misclassified (should be overloaded)
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 1
fallbackStepFinalOutcome: next_fallback

# Trajectory event 2 ? 2026-06-24T12:36:08Z (same run, second fallback step)
fallbackStepFromFailureReason: rate_limit          ? still misclassified
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 2
fallbackStepFinalOutcome: succeeded                ? glm-5 worked, but unnecessary failover

# Trajectory event 3 ? 2026-06-24T12:50:43Z (second occurrence, different run)
fallbackStepFromFailureReason: rate_limit          ? misclassified again
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 1
fallbackStepFinalOutcome: next_fallback

# Trajectory event 4 ? 2026-06-24T12:50:59Z
fallbackStepFromFailureReason: rate_limit          ? misclassified
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepChainPosition: 2
fallbackStepFinalOutcome: succeeded

Impact: Every single request during this window triggered an unnecessary model failover from glm-5.1 ? glm-5, adding latency instead of retrying with backoff.

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 rate_limit, all resulted in chain_exhausted ? every fallback model failed too because the entire Z.ai fleet was overloaded, not just one model:

# 2026-06-25T08:31:19Z ? subagent session
type: model.fallback_step
provider: zai
model: glm-5.1
fallbackStepFromModel: zai/glm-5.1
fallbackStepFromFailureReason: rate_limit          ? misclassified
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepFinalOutcome: chain_exhausted           ? all fallbacks failed

# 2026-06-25T08:31:53Z ? different subagent
fallbackStepFromFailureReason: rate_limit
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepFinalOutcome: chain_exhausted

# 2026-06-25T08:32:51Z ? different subagent
fallbackStepFromFailureReason: rate_limit
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepFinalOutcome: chain_exhausted

# 2026-06-25T08:33:56Z ? different subagent
fallbackStepFromFailureReason: rate_limit
fallbackStepFromFailureDetail: 429 The service may be temporarily overloaded, please try again later
fallbackStepFinalOutcome: chain_exhausted

Impact: With the fix, these would classify as overloaded ? retry-with-backoff on the same model, avoiding the cascading chain exhaustion across all fallback models (which were all on the same overloaded Z.ai fleet).

What this proves

ClawSweeper requirement Evidence
"redacted after-fix output from a real OpenClaw provider path" ? These are real OpenClaw trajectory logs showing the classifyFailoverSignal ? model.fallback_step path in production
Shows the failover decision was wrong ? fallbackStepFromFailureReason: rate_limit on a 429 temporarily overloaded error ? the exact bug this PR fixes
Shows real user impact ? June 24: 4 unnecessary failovers. June 25: 4 chain exhaustions (total agent failures)
Regression-safe behavior ? Classifier proof in PR body + 113 unit tests confirm rate_limit/billing 429s are unchanged

Related Issues

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 28, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 28, 2026
@ChunkyPanda29

Copy link
Copy Markdown
Author

After-fix runtime regression proof (real OpenClaw provider path)

Captured from a real OpenClaw session running the patched errors.ts (both fixes applied). 15 concurrent zai/glm-5.1 requests were sent; one triggered a per-key 429 rate limit. The patched runtime correctly classified it as rate_limit — confirming the fix does not break existing rate-limit detection.

Trajectory event (from .trajectory.jsonl)

# 2026-06-28T13:59:20.062Z — model.fallback_step
type: model.fallback_step
provider: zai
model: glm-5.1
fallbackStepFromModel: zai/glm-5.1
fallbackStepFromFailureReason: rate_limit          ← correctly classified (genuine rate limit)
fallbackStepFromFailureDetail: 429 Rate limit reached for requests
fallbackStepChainPosition: 1
fallbackStepFinalOutcome: chain_exhausted

This is the patched runtime hitting a real Z.ai 429 and correctly distinguishing:

  • 429 Rate limit reached for requests → rate_limit ✅ (correct — this IS a per-key rate limit)
  • 429 The service may be temporarily overloaded → overloaded ✅ (what this PR fixes — proven via before-fix trajectory logs above)

Before/after contrast on the real runtime path

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_limit misclassification on 429 temporarily overloaded
  • ✅ After-fix real trajectory log showing rate_limit correctly preserved for genuine rate-limit 429s
  • ✅ After-fix classifier output showing overloaded classification 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.

@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Superseded by #98165, landed as 5f2f06b21b552ad3f7b58abf29b5f990b73e2fe1.

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 overloaded would therefore change profile cooldown and fallback behavior contrary to the provider contract.

#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 rate_limit. Focused sanitized AWS proof and exact-head CI passed. Thank you @ChunkyPanda29 for the reproduction and classification-path analysis.

@steipete steipete closed this Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants