openclaw - 💡(How to fix) Fix Codex profile rotation skips remaining profiles and jumps to fallback model chain on rate limit [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62022Fetched 2026-04-08 03:10:13
View on GitHub
Comments
1
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
commented ×1

Error Message

When a Codex profile in the rotation order returns a rate limit error, OpenClaw skips the remaining profiles in the rotation and immediately escalates to the next model in the fallback chain (e.g., from gpt-5.3-codex to *next_fallback_model*), rather than continuing to try the remaining profiles in the current model's auth rotation. The rate limit error appears to be treated as a hard failure that short-circuits the auth rotation loop and moves to the next fallback model, rather than as a retryable condition that should advance the profile rotation. This means even when healthy profiles exist later in the rotation, they are never tried.

Root Cause

The rate limit error appears to be treated as a hard failure that short-circuits the auth rotation loop and moves to the next fallback model, rather than as a retryable condition that should advance the profile rotation. This means even when healthy profiles exist later in the rotation, they are never tried.

Fix Action

Workaround

Reorder the rotation to put healthy profiles first (exhausted profiles to the back). This is fragile and requires manual maintenance — especially problematic when multiple profiles are simultaneously exhausted.

Code Example

openai-codex:default → openai-codex:profile1 → openai-codex:profile2 → openai-codex:profile3
RAW_BUFFERClick to expand / collapse

Bug Description

When a Codex profile in the rotation order returns a rate limit error, OpenClaw skips the remaining profiles in the rotation and immediately escalates to the next model in the fallback chain (e.g., from gpt-5.3-codex to *next_fallback_model*), rather than continuing to try the remaining profiles in the current model's auth rotation.

Expected Behavior

Rate limit errors on one profile should trigger rotation to the next profile within the same model (using the models auth order rotation), not jump to a different model entirely.

Steps to Reproduce

  1. Configure agents.list.<agent>.model to openai-codex/gpt-5.3-codex
  2. Set agents.list.<agent>.fallbackModels to include *another_model*
  3. Set auth rotation order: profile1 (exhausted) → profile2profile3default
  4. Send a request that triggers Codex — profile1 hits rate limit immediately
  5. Observed: System escalates to gpt-5.2-codex without trying profile2, profile3, or default
  6. Expected: System should rotate to profile3 (next in auth order) before escalating

Current Rotation Order (after workaround)

openai-codex:default → openai-codex:profile1 → openai-codex:profile2 → openai-codex:profile3

(Healthy profiles first; exhausted ones moved to back.)

Environment

  • OpenClaw 2026.4.5 (3e72c03)
  • Provider: openai-codex with 4 OAuth profiles
  • Gateway config: ~/.openclaw/openclaw.json

Analysis

The rate limit error appears to be treated as a hard failure that short-circuits the auth rotation loop and moves to the next fallback model, rather than as a retryable condition that should advance the profile rotation. This means even when healthy profiles exist later in the rotation, they are never tried.

Suggested Fix

Profile rotation should continue through all profiles in the models auth order before escalating to the next model in the fallback chain. A rate limit on profile N should advance to profile N+1, not directly to *next-fallback-model.

Workaround

Reorder the rotation to put healthy profiles first (exhausted profiles to the back). This is fragile and requires manual maintenance — especially problematic when multiple profiles are simultaneously exhausted.

extent analysis

TL;DR

Modify the OpenClaw configuration to treat rate limit errors as retryable conditions that advance the profile rotation instead of immediately escalating to the next fallback model.

Guidance

  • Review the OpenClaw configuration to ensure that rate limit errors are handled as retryable conditions, allowing the system to rotate through all profiles in the models auth order before escalating to the next model.
  • Update the openclaw.json file to reflect the correct rotation order, prioritizing healthy profiles first.
  • Consider implementing a more robust rotation strategy that dynamically adjusts the order based on profile health and availability.
  • Verify the updated configuration by simulating rate limit errors and observing the system's behavior to ensure it now correctly rotates through profiles before escalating to the next fallback model.

Example

No code snippet is provided as the issue does not explicitly mention specific code changes, but rather a configuration update.

Notes

The suggested fix requires modifying the OpenClaw configuration to change how rate limit errors are handled. This may involve updating the openclaw.json file or adjusting the rotation strategy. The current workaround of reordering the rotation to put healthy profiles first is fragile and requires manual maintenance.

Recommendation

Apply the workaround by reordering the rotation to put healthy profiles first, but also investigate and implement a more robust solution that treats rate limit errors as retryable conditions, allowing the system to dynamically adjust the rotation order based on profile health and availability. This will provide a more reliable and maintainable solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING