Skip to content

Heartbeat model override ignored — always falls back to default model (LiveSessionModelSwitch) #58517

@davidbennett1979

Description

@davidbennett1979

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions