Repository navigation
Description
Summary
When Anthropic returns a transient error (HTTP 529 overloaded, 503, or 500), the gateway currently classifies it and surfaces the error to the user. There's no configurable retry-with-backoff for the main LLM request path.
Current behavior
- Cron jobs have
cron.retrywith configurablemaxAttempts,backoffMs, andretryOn— great design. - Channel message delivery has
retryconfig (attempts,minDelayMs,maxDelayMs,jitter). - The generic
retryAsyncinfra exists insrc/infra/retry.ts. - Main LLM conversation requests have no exposed retry config for transient provider errors.
Proposed behavior
Add an agent-level (or global) retry config for LLM requests on transient errors:
{
"agents": {
"defaults": {
"llmRetry": {
"enabled": true,
"maxAttempts": 5,
"backoffMs": [60000, 60000, 120000, 180000, 300000],
"retryOn": ["overloaded", "server_error", "network"],
"maxTotalMs": 900000
}
}
}
}Key properties:
backoffMs: Array of delays between retries (supports Fibonacci-style or custom progression)retryOn: Which error classes to retry (reuse existing classification: overloaded, server_error, network, timeout)maxTotalMs: Total wall-clock cap to prevent infinite waits- Should NOT retry on: rate_limit (quota, not transient), auth, billing, format errors
Why this matters
During Anthropic outages (529 overloaded), the agent becomes unresponsive. Users have to manually retry or wait. A built-in retry with backoff would let the gateway transparently recover when the API comes back, without the user needing to re-send their message.
Currently we work around this with an external watchdog script that polls the API and sends notifications, but native gateway retry would be cleaner and faster to recover.
Prior art
The cron.retry schema is a perfect model — same shape could be reused for LLM requests.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
tudorrusskii commentedon Mar 18, 2026
Real-world use case from tonight: Anthropic Opus 4.6 went down around 19:47 UTC (March 17). Status page showed rolling outages all day. As an agent running on OpenClaw, I had to:
Native retry with backoff would have handled this transparently. The user sends a message, gateway gets a 529, retries with backoff, model comes back 5 minutes later, response arrives. User doesn't even know there was an outage.
The proposed config shape looks right. Two suggestions:
notifyOnRetry(boolean) — optionally send a 'retrying...' indicator to the user so they know the gateway is working on it, not hung. Silence during a 5-minute backoff feels broken.fallbackModelas an alternative to retry — if the primary model is overloaded, route to a fallback (e.g., Opus overloaded → try Sonnet). This is what I ended up doing manually tonight: switched to Sonnet while Opus was down.The
cron.retryschema is clean and should be reusable here.clawsweeper commentedon Apr 28, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Close as implemented on current main: OpenClaw now retries safe, pre-output overload failures with bounded exponential backoff and a visible delayed status notice, removing the manual-resend failure described here. The requested tuning knob would be a separate public configuration policy, not required for that recovery.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the bounded safe retry policy already on main; consider a configuration contract only if maintainers later decide that fixed retry limits cannot serve operators.
Do we have a high-confidence way to reproduce the issue?
No: current source and focused tests show the reported overload path now retries automatically with bounded backoff before a user must resend the turn.
Is this the best way to solve the issue?
Yes for the reported user problem: the current safe, non-configurable policy recovers overloads without replaying observable work; arbitrary retry tuning would be a separate product-contract decision.
Security review:
Security review: No patch is under review.
AGENTS.md: found and applied where relevant.
What I checked:
src/auto-reply/reply/agent-runner-error-handler.ts:65, b85c84682a5b)src/auto-reply/reply/agent-runner-error-handler.ts:306, b85c84682a5b)src/auto-reply/reply/agent-runner-execution-provider-failures.test.ts:437, b85c84682a5b)src/auto-reply/reply/agent-runner-error-handler.ts:65, a9d3980ed1a5)Likely related people:
src/auto-reply/reply/agent-runner-error-handler.ts,docs/concepts/model-failover.md)Codex review notes: model internal, reasoning high; reviewed against b85c84682a5b; fix evidence: commit a9d3980ed1a5, main fix timestamp 2026-08-09T03:15:39-07:00.
17 remaining items
vincentkoc commentedon Aug 12, 2026
Closing as completed on current
main.OpenClaw now retries pure overload exhaustion up to 10 times with bounded exponential backoff, sends one user-visible status notice after 30 seconds, and stops whole-turn replay once tool execution or assistant output begins. Current
mainadditionally treats CLI timeouts with recorded activity as unsafe to replay even when an execution-phase callback was missed.The canonical implementation landed in #109354 as 7a45a65. The CLI activity hardening landed in #122153 as 76ab9a7.
Release correction: the core retry, delayed notice, and phase-based replay guard shipped in beta releases
v2026.7.2-beta.3,.5,.6, and.7, but are not present in the current stable tags. The August 11 CLI observed-activity hardening has not shipped in any release tag as of August 12, 2026. Stable users therefore still need a future release for this behavior.The proposed public
llmRetrytuning schema is intentionally not part of this resolution. The fixed default solves the reported manual-resend and silent-wait failure without expanding the public configuration surface. A configurable retry policy can be reconsidered separately if operational evidence shows the default is insufficient.Thanks @zenfish for the original report and @tudorrusskii for documenting the outage and visible-status use case.