openclaw - 💡(How to fix) Fix resolvePersistedLiveSelection() overrides emergency failover decisions, causing infinite overload retry loops [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#58512Fetched 2026-04-08 02:01:32
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
closed ×1locked ×1

When Anthropic returns 503 overloaded errors, the failover system correctly decides to switch to a fallback provider. However, resolvePersistedLiveSelection() immediately overrides this decision for persistent sessions (e.g. agent:main:main, agent:main:telegram:direct:*), forcing the model back to claude-sonnet-4-6. This creates an infinite retry loop that cannot be broken by the fallback system.

Root Cause

resolvePersistedLiveSelection() restores the persisted modelOverride for long-lived sessions, which takes precedence over the emergency failover decision. The failover system escalates within the same auth profile (cycling between Sonnet instances) rather than escaping to a different provider.

Fix Action

Fix / Workaround

Current Workaround

RAW_BUFFERClick to expand / collapse

Summary

When Anthropic returns 503 overloaded errors, the failover system correctly decides to switch to a fallback provider. However, resolvePersistedLiveSelection() immediately overrides this decision for persistent sessions (e.g. agent:main:main, agent:main:telegram:direct:*), forcing the model back to claude-sonnet-4-6. This creates an infinite retry loop that cannot be broken by the fallback system.

Root Cause

resolvePersistedLiveSelection() restores the persisted modelOverride for long-lived sessions, which takes precedence over the emergency failover decision. The failover system escalates within the same auth profile (cycling between Sonnet instances) rather than escaping to a different provider.

Impact (Observed 2026-03-31 ~06:00-09:12 AM PT)

  • ~204 overloaded errors
  • ~756 empty assistant messages
  • ~1,124 total spam/retry messages across 3 conversations
  • Main session unresponsive for ~3 hours
  • SLBE nightly cron failures same evening

Expected Behavior

Emergency failover decisions must take precedence over resolvePersistedLiveSelection(). When a global circuit breaker trips on a provider, persistent sessions should yield to the failover decision rather than override it. On recovery (3 clean windows), restore persisted selection.

Proposed Fix

  1. resolvePersistedLiveSelection() must check for active emergency failover state before restoring persisted model selection
  2. When failover active: skip restoring override, allow fallback provider to serve the request
  3. On recovery: restore persisted selection
  4. Priority queue during HALF-OPEN recovery: interactive DMs > trading > background research

Current Workaround

Launchd-based failover monitor shell script that directly edits sessions.json to override modelOverride/providerOverride when overload count >= 5 in 10 min. Functional but fragile.

Related Issues

#24378 #32533 #29014 #17465 #56960

extent analysis

TL;DR

Modify resolvePersistedLiveSelection() to check for active emergency failover state before restoring persisted model selection to prevent infinite retry loops.

Guidance

  • Review the proposed fix steps to ensure resolvePersistedLiveSelection() correctly yields to failover decisions for persistent sessions.
  • Verify that the failover system can successfully switch to a fallback provider when Anthropic returns 503 overloaded errors.
  • Test the priority queue during HALF-OPEN recovery to ensure correct ordering of interactive DMs, trading, and background research.
  • Consider replacing the launchd-based failover monitor shell script with a more robust solution integrated into the main codebase.

Example

def resolvePersistedLiveSelection(session):
    if is_emergency_failover_active():
        # Skip restoring override, allow fallback provider to serve the request
        return
    # Restore persisted model selection
    session.modelOverride = get_persisted_model_override(session)

Notes

The current workaround using a launchd-based failover monitor shell script is functional but fragile and should be replaced with a more robust solution.

Recommendation

Apply the proposed fix to modify resolvePersistedLiveSelection() to check for active emergency failover state, as this will prevent infinite retry loops and ensure correct failover behavior.

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