openclaw - 💡(How to fix) Fix Feature request: gateway.routing.persist_auto_fallback config flag

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…

buildFallbackSelectionState() in agent-runner.runtime-*.js (line ~324 in 2026.5.7) unconditionally writes modelOverrideSource: "auto" to the per-session store whenever a fallback model is selected during a turn. This causes the session to be silently locked to the fallback model on subsequent turns, even if the primary model later recovers.

Root Cause

For production deployments that prefer "primary or explicit override, never silent stickiness":

  • Auto-pin makes incident recovery slower (operator clears the pin manually after platform recovers)
  • Auto-pin can degrade quality silently (a single 30-second timeout pins to a weaker model for the entire session lifetime)
  • Auto-pin is invisible at the API surface — the only signal is sessions.json contents

A config flag preserves current behavior for users who like the stickiness while letting others opt out.

Fix Action

Fix / Workaround

The current workaround is a periodic out-of-band sweep of sessions.json to remove modelOverrideSource: "auto" entries (runs hourly via systemd timer in our deployment). This is reactive and adds operational overhead.

Code Example

{
  "gateway": {
    "routing": {
      "persist_auto_fallback": false
    }
  }
}
RAW_BUFFERClick to expand / collapse

Context

buildFallbackSelectionState() in agent-runner.runtime-*.js (line ~324 in 2026.5.7) unconditionally writes modelOverrideSource: "auto" to the per-session store whenever a fallback model is selected during a turn. This causes the session to be silently locked to the fallback model on subsequent turns, even if the primary model later recovers.

Use case impact

In multi-agent orchestration setups, when the primary model (e.g., ollama-cloud/deepseek-v4-pro) hits a transient timeout and a fallback succeeds (e.g., openrouter/openai/gpt-4o-mini), the session is silently and persistently pinned to the fallback. There is no config surface to disable this — it is currently observable only by inspecting sessions.json after the fact or by detecting capability regressions in downstream tasks.

The current workaround is a periodic out-of-band sweep of sessions.json to remove modelOverrideSource: "auto" entries (runs hourly via systemd timer in our deployment). This is reactive and adds operational overhead.

Proposed flag

Add a top-level config option in openclaw.json:

{
  "gateway": {
    "routing": {
      "persist_auto_fallback": false
    }
  }
}

When false (default true for backwards compatibility), buildFallbackSelectionState() would still select the fallback for the current turn but would NOT persist modelOverrideSource: "auto" to the session store. The next turn would re-evaluate model availability from scratch.

Why this matters

For production deployments that prefer "primary or explicit override, never silent stickiness":

  • Auto-pin makes incident recovery slower (operator clears the pin manually after platform recovers)
  • Auto-pin can degrade quality silently (a single 30-second timeout pins to a weaker model for the entire session lifetime)
  • Auto-pin is invisible at the API surface — the only signal is sessions.json contents

A config flag preserves current behavior for users who like the stickiness while letting others opt out.

References

  • Related: #83716 (companion request for disabledTools / PreToolUse hook)
  • Source location: /app/dist/agent-runner.runtime-*.js line ~324 in 2026.5.7

Happy to submit a PR. Single-line change in the config schema + 5-10 lines in buildFallbackSelectionState() for the conditional.

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

openclaw - 💡(How to fix) Fix Feature request: gateway.routing.persist_auto_fallback config flag