openclaw - 💡(How to fix) Fix String model config silently disables fallbacks (resolveAgentModelFallbackValues returns [] for strings) [1 pull requests]

Official PRs (…)
ON THIS PAGE

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…

Fix Action

Fixed

Code Example

export function resolveAgentModelFallbackValues(model?: AgentModelConfig): string[] {
  if (!model || typeof model !== "object") {
    return [];  // string config = no fallbacks, no warning
  }
  return Array.isArray(model.fallbacks) ? model.fallbacks : [];
}
RAW_BUFFERClick to expand / collapse

Problem

When agents.defaults.model is set as a string (e.g. "anthropic/claude-opus-4-7"), the function resolveAgentModelFallbackValues() in src/config/model-input.ts returns an empty array — silently disabling all fallback behavior:

export function resolveAgentModelFallbackValues(model?: AgentModelConfig): string[] {
  if (!model || typeof model !== "object") {
    return [];  // string config = no fallbacks, no warning
  }
  return Array.isArray(model.fallbacks) ? model.fallbacks : [];
}

This is easy to trigger: if an agent or tool sets the model config to a string (e.g. via the model-switching tool), any previously configured fallbacks are silently lost.

Impact

  • When the primary model returns overloaded_error, there is no fallback — the request fails entirely
  • No warning is logged when fallbacks are lost
  • The config appears valid (string model refs are accepted everywhere else)

Suggested fix

  1. Log a warning when model config is a string and fallbacks would have been available in the previous config
  2. The model-switching tool should preserve the existing config structure — update primary field without replacing the whole object
  3. Consider auto-wrapping string configs: "model-name"{primary: "model-name", fallbacks: []} with a deprecation warning

Environment

  • OpenClaw v2026.5.6
  • Discovered after an agent autonomously changed model config from object to string format

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 String model config silently disables fallbacks (resolveAgentModelFallbackValues returns [] for strings) [1 pull requests]