Skip to content

LiveSessionModelSwitch blocks isolated cron sessions with explicit model override #57581

@ukr-coder

Description

@ukr-coder

Bug Description

Isolated cron sessions that specify an explicit model in their payload (e.g., anthropic/claude-sonnet-4-6) are blocked by the LiveSessionModelSwitch guard when the parent agent's default model differs (e.g., anthropic/claude-opus-4-6).

Expected Behavior

Isolated cron sessions should respect the model field in the cron payload without triggering LiveSessionModelSwitch. The isolation boundary should allow model selection independent of the parent agent's default.

Actual Behavior

  1. Cron job triggers with payload.model: 'anthropic/claude-sonnet-4-6'
  2. Parent agent (main) has model.primary: 'anthropic/claude-opus-4-6'
  3. OC detects model mismatch and throws LiveSessionModelSwitchError
  4. Sonnet is rejected, Gemini fallback is also rejected (same error)
  5. Only Opus (matching agent default) succeeds via 3rd fallback attempt

Impact

  • All cron jobs run on Opus instead of Sonnet — significant cost increase (~$60/month for typical setup)
  • Fallback chain adds latency — 3 attempts before success
  • Concurrent batch triggers timeout — fallback overhead × concurrent jobs = 600s timeout hit
  • Workaround required — must create a separate agent with Sonnet as primary and assign all crons to it

Log Evidence

live session model switch detected before attempt for <run-id>: anthropic/claude-sonnet-4-6 -> anthropic/claude-opus-4-6
LiveSessionModelSwitchError: Live session model switch requested: anthropic/claude-sonnet-4-6

Fallback decision pattern:

{
  "event": "model_fallback_decision",
  "decision": "candidate_failed",
  "requestedModel": "claude-sonnet-4-6",
  "candidateModel": "claude-sonnet-4-6",
  "errorPreview": "Live session model switch requested: anthropic/claude-opus-4-6"
}

Reproduction

  1. Configure agent with model.primary: 'anthropic/claude-opus-4-6'
  2. Create cron job with sessionTarget: 'isolated' and payload.model: 'anthropic/claude-sonnet-4-6'
  3. Trigger the cron job
  4. Observe LiveSessionModelSwitchError in logs

Environment

  • OpenClaw 2026.3.28 (f9b1079)
  • Windows 11 / Node 24.13.0
  • Agent: main with Opus 4.6 primary, Sonnet 4.6 + Gemini 3.1 Pro as fallbacks

Suggested Fix

For sessionTarget: 'isolated' sessions, the payload.model should be treated as the session's native model rather than triggering LiveSessionModelSwitch detection against the parent agent's default.

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