openclaw - 💡(How to fix) Fix Heartbeat model override ignored — always falls back to default model (LiveSessionModelSwitch) [4 comments, 4 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#58517Fetched 2026-04-08 02:01:46
View on GitHub
Comments
4
Participants
4
Timeline
6
Reactions
0
Timeline (top)
commented ×4mentioned ×1subscribed ×1

Root Cause

The fallbackNoticeSelectedModel field confirms that OpenClaw correctly reads the heartbeat.model config and initially selects the right model. However, something in the session initialization or model resolution pipeline detects a model mismatch with the existing session context and triggers a LiveSessionModelSwitch, which forces a fallback to the global default.

This happens even with isolatedSession: true — fresh sessions still exhibit the behavior, suggesting the switch detection may be comparing against the agent-level default rather than the heartbeat-specific model config.

The heartbeat model override appears to be non-functional in practice — the global default always wins.

Code Example

{
  "agents": {
    "defaults": {
      "model": { "primary": "anthropic/claude-opus-4-6", "fallbacks": ["openai-codex/gpt-5.4", "ollama/qwen3.5:122b"] },
      "heartbeat": {
        "every": "30m",
        "model": "anthropic/claude-sonnet-4-6",
        "isolatedSession": true,
        "activeHours": { "start": "07:00", "end": "23:00", "timezone": "America/Chicago" },
        "target": "last"
      }
    }
  }
}

---

fallbackNoticeSelectedModel: anthropic/claude-sonnet-4-6
fallbackNoticeActiveModel: anthropic/claude-opus-4-6

---

live session model switch detected before attempt: anthropic/claude-sonnet-4-6 -> anthropic/claude-opus-4-6
RAW_BUFFERClick to expand / collapse

Version: OpenClaw 2026.3.28 (f9b1079) OS: macOS 15.6.1 (arm64), Node 25.8.1

Problem

agents.defaults.heartbeat.model is ignored. Heartbeat always runs on the global default model regardless of the heartbeat-specific model setting.

Config

{
  "agents": {
    "defaults": {
      "model": { "primary": "anthropic/claude-opus-4-6", "fallbacks": ["openai-codex/gpt-5.4", "ollama/qwen3.5:122b"] },
      "heartbeat": {
        "every": "30m",
        "model": "anthropic/claude-sonnet-4-6",
        "isolatedSession": true,
        "activeHours": { "start": "07:00", "end": "23:00", "timezone": "America/Chicago" },
        "target": "last"
      }
    }
  }
}

Expected

Heartbeat runs on claude-sonnet-4-6 (or whichever model is set in heartbeat.model).

Actual

Heartbeat always runs on claude-opus-4-6 (the global default). Sessions.json shows:

fallbackNoticeSelectedModel: anthropic/claude-sonnet-4-6
fallbackNoticeActiveModel: anthropic/claude-opus-4-6

Gateway logs show:

live session model switch detected before attempt: anthropic/claude-sonnet-4-6 -> anthropic/claude-opus-4-6

The heartbeat model is selected correctly, but then a LiveSessionModelSwitch overrides it to the global default before the API call is made.

Reproduction

  1. Set agents.defaults.model.primary to anthropic/claude-opus-4-6
  2. Set agents.defaults.heartbeat.model to any different model (tested with anthropic/claude-sonnet-4-6 and ollama/qwen3.5:27b)
  3. Enable agents.defaults.heartbeat.isolatedSession: true
  4. Wait for heartbeat to fire
  5. Check sessions.json — heartbeat session will show the global default model, not the heartbeat model

What I have tried (all failed)

  • Setting heartbeat.model to Sonnet — falls back to Opus
  • Setting heartbeat.model to ollama/qwen3.5:27b — falls back to Opus
  • Enabling isolatedSession: true — no effect
  • Deleting heartbeat session entries AND transcript files from sessions.json — fresh session still falls back
  • Multiple gateway restarts — no effect
  • Clearing all model/provider/authProfile override fields from heartbeat session entries — overrides reappear on next run

Analysis

The fallbackNoticeSelectedModel field confirms that OpenClaw correctly reads the heartbeat.model config and initially selects the right model. However, something in the session initialization or model resolution pipeline detects a model mismatch with the existing session context and triggers a LiveSessionModelSwitch, which forces a fallback to the global default.

This happens even with isolatedSession: true — fresh sessions still exhibit the behavior, suggesting the switch detection may be comparing against the agent-level default rather than the heartbeat-specific model config.

The heartbeat model override appears to be non-functional in practice — the global default always wins.

extent analysis

TL;DR

The LiveSessionModelSwitch mechanism is likely causing the heartbeat to fall back to the global default model, and modifying the session initialization or model resolution pipeline may be necessary to fix the issue.

Guidance

  • Investigate the LiveSessionModelSwitch detection logic to understand why it's triggering a fallback to the global default model, even when isolatedSession: true.
  • Verify that the heartbeat.model config is being correctly read and applied during session initialization.
  • Consider adding logging or debugging statements to the model resolution pipeline to understand the decision-making process behind the model switch.
  • Review the documentation for isolatedSession to ensure it's being used correctly and as intended.

Example

No code snippet is provided as the issue seems to be related to the internal logic of OpenClaw, and modifying the code without a clear understanding of the underlying mechanics may not be effective.

Notes

The issue may be related to a bug or unintended behavior in OpenClaw, and further investigation or debugging may be necessary to identify the root cause. The provided configuration and reproduction steps suggest that the issue is reproducible, but the exact cause and solution may require additional information or insight into the OpenClaw codebase.

Recommendation

Apply a workaround by modifying the agents.defaults.model.primary to match the desired heartbeat model, although this may not be a scalable or desirable solution in the long term. A more permanent fix would require addressing the underlying issue with the LiveSessionModelSwitch mechanism.

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