Skip to content

Bug: Main agent falls back to 3rd-priority model (claude-sonnet) instead of 2nd (gpt-5.4-mini) on Ollama init failure #66951

Description

@ai-winston03

Summary

On session initialization, when the primary model (ollama/phi4-mini:latest) is unavailable (Ollama process running but model unresponsive), the main agent skips the configured 2nd fallback (openai/gpt-5.4-mini) and launches directly on the 3rd fallback (anthropic/claude-sonnet-4-6).

Environment

  • OpenClaw version: 2026.4.14
  • Host: macOS Darwin 24.6.0 (arm64)
  • Channel: iMessage
  • Agent: main (default)

Agent model config (from openclaw.json)

{
  "id": "main",
  "default": true,
  "model": {
    "primary": "ollama/phi4-mini:latest",
    "fallbacks": [
      "openai/gpt-5.4-mini",
      "anthropic/claude-sonnet-4-6"
    ]
  }
}

Steps to Reproduce

  1. Ollama is running (pgrep -x ollama returns a PID) but phi4-mini is unresponsive or slow to load.
  2. Start a new OpenClaw session via iMessage (or /new).
  3. Session initializes on anthropic/claude-sonnet-4-6 instead of openai/gpt-5.4-mini.

Expected Behavior

Fallback chain should be respected in order:

  1. ollama/phi4-mini:latest (primary) — fails
  2. openai/gpt-5.4-mini (1st fallback) — should be selected
  3. anthropic/claude-sonnet-4-6 (2nd fallback) — only if gpt-mini also fails

Actual Behavior

Session launched on anthropic/claude-sonnet-4-6 (3rd in chain), skipping openai/gpt-5.4-mini entirely.

Runtime header (from session)

model=anthropic/claude-sonnet-4-6 | default_model=ollama/phi4-mini:latest

Additional Notes

  • After restarting Ollama (pkill ollama && open -a Ollama), phi4-mini loads correctly.
  • The openclaw.json config is correctly structured — this appears to be a fallback selection bug at session init, not a config issue.
  • This has a real cost impact: Sonnet is significantly more expensive than gpt-5.4-mini.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions