openclaw - 💡(How to fix) Fix /model can become unusable when the current provider is unavailable, and configured fallbacks do not recover the session [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#58039Fetched 2026-04-08 01:54:40
View on GitHub
Comments
1
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
commented ×1

When the currently selected model provider becomes unavailable, /model may also become unusable, and configured fallbacks do not recover the session.

This makes the session effectively stuck on a broken provider, which feels incorrect because /model is a control action and should still allow switching away from a failing provider.

Root Cause

This makes the session effectively stuck on a broken provider, which feels incorrect because /model is a control action and should still allow switching away from a failing provider.

RAW_BUFFERClick to expand / collapse

Summary

When the currently selected model provider becomes unavailable, /model may also become unusable, and configured fallbacks do not recover the session.

This makes the session effectively stuck on a broken provider, which feels incorrect because /model is a control action and should still allow switching away from a failing provider.

Current behavior

If the active provider is down/unavailable, one or more of the following can happen:

  • /model does not successfully switch to another provider/model
  • the session remains pinned to the broken provider
  • configured fallbacks do not help recover normal usage
  • the user can become unable to continue the conversation without manual external intervention

Expected behavior

A provider outage should not make /model unusable.

More specifically, I would expect at least one of these to work:

  1. /model should be handled as a local/session control action and persist the model switch even if the current provider is failing
  2. if the current provider is unavailable, OpenClaw should allow switching to another provider immediately
  3. configured fallbacks should be able to recover the session in this scenario instead of leaving it stuck on the failed provider

Why this seems wrong

There appears to be a control-plane vs execution-plane coupling issue here:

  • /model is a control operation
  • provider inference is an execution operation

If the execution provider is down, the control operation should still be able to move the session away from it.

Right now, it feels like the user can lose both:

  • the ability to talk to the current model
  • the ability to switch away from it

Version

I checked the latest public repo/changelog before filing this and did not find a clear fix for this exact failure mode.

I did notice the recent changelog entry:

Agents/model switching: apply /model changes to active embedded runs at the next safe retry boundary...

But that seems to address switching during active embedded runs/retries, not the case where the current provider is unavailable and /model itself becomes ineffective.

Repro idea

A rough repro pattern is:

  1. Configure a session with provider A as current model
  2. Configure fallbacks to provider B/C
  3. Make provider A unavailable (network failure, auth invalidation, provider outage, etc.)
  4. Try using /model to switch to a model on provider B
  5. Observe that the session may remain unusable or stuck, and fallbacks do not recover it

Suggested fix direction

Possible design improvements:

  • treat /model as a local/session state change first, not something blocked by the currently failing provider
  • ensure failover/fallback logic also covers model-switch recovery flows
  • if a provider is unavailable, auto-switch to a healthy fallback or at least permit forced switching
  • provide a clear user-facing message like:
    • “Current provider is unavailable; switched to fallback X”
    • or “Model override saved; new provider will be used on next turn”

Additional context

Happy to provide more repro details if needed.

extent analysis

Fix Plan

To address the issue, we need to modify the /model endpoint to handle provider unavailability and allow switching to a fallback provider. Here are the steps:

  • Decouple control-plane and execution-plane logic:
    • Modify the /model endpoint to first update the local session state with the new model provider.
    • Only then attempt to switch to the new provider.
  • Implement fallback logic:
    • Check if the current provider is unavailable before attempting to switch.
    • If unavailable, automatically switch to a healthy fallback provider.
  • Provide user-facing feedback:
    • Display a clear message indicating the switch to a fallback provider.

Example Code

def switch_model(session, new_provider):
    # Update local session state first
    session.model_provider = new_provider
    
    # Check if current provider is unavailable
    if not is_provider_available(session.current_provider):
        # Switch to a healthy fallback provider
        fallback_provider = get_fallback_provider(session)
        session.model_provider = fallback_provider
        return f"Switched to fallback provider {fallback_provider}"
    
    # Attempt to switch to the new provider
    try:
        # Switch to the new provider
        switch_to_provider(session, new_provider)
        return f"Switched to provider {new_provider}"
    except ProviderUnavailableError:
        # If the new provider is also unavailable, switch to a fallback
        fallback_provider = get_fallback_provider(session)
        session.model_provider = fallback_provider
        return f"Switched to fallback provider {fallback_provider}"

def is_provider_available(provider):
    # Implement logic to check if a provider is available
    # ...

def get_fallback_provider(session):
    # Implement logic to get a healthy fallback provider
    # ...

def switch_to_provider(session, provider):
    # Implement logic to switch to a new provider
    # ...

Verification

To verify the fix, follow the repro steps and check that:

  • The session can be switched to a new provider even if the current provider is unavailable.
  • The fallback logic kicks in and switches to a healthy provider if the current provider is unavailable.
  • A clear user-facing message is displayed indicating the switch to a fallback provider.

Extra Tips

  • Ensure that the is_provider_available and get_fallback_provider functions are implemented correctly to handle different scenarios.
  • Consider adding additional logging and monitoring to detect provider unavailability and fallback switches.
  • Review the code to ensure that it handles edge cases, such as multiple concurrent provider failures.

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…

FAQ

Expected behavior

A provider outage should not make /model unusable.

More specifically, I would expect at least one of these to work:

  1. /model should be handled as a local/session control action and persist the model switch even if the current provider is failing
  2. if the current provider is unavailable, OpenClaw should allow switching to another provider immediately
  3. configured fallbacks should be able to recover the session in this scenario instead of leaving it stuck on the failed provider

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix /model can become unusable when the current provider is unavailable, and configured fallbacks do not recover the session [1 comments, 1 participants]