Skip to content

Regression v2026.3.28: LiveSessionModelSwitchError when spawning subagent with different model than parent #58305

Closed

Description

@frank-punzo

Description

After upgrading from v2026.3.23-2 to v2026.3.28, spawning a subagent with a different model than the parent session fails with LiveSessionModelSwitchError: Live session model switch requested: <model>.

Steps to Reproduce

  1. Parent session running on anthropic/claude-sonnet-4-6
  2. Call sessions_spawn with agentId: "marketing" and model: "google/gemini-2.5-pro"
  3. Error fires immediately at spawn time (runtime ~1s, 0 tokens consumed)

Expected Behavior

Subagent should start on google/gemini-2.5-pro as requested. This worked correctly in v2026.3.23-2.

Actual Behavior

LiveSessionModelSwitchError: Live session model switch requested: google/gemini-2.5-pro

Variants Tried

  • Passing model explicitly in sessions_spawn
  • Setting model.primary on the agent in agents.list
  • Removing model.primary from agent config and passing at spawn time
  • All variants produce the same error

Config

{
  "agents": {
    "list": [
      { "id": "main", "model": { "primary": "anthropic/claude-sonnet-4-6" } },
      { "id": "marketing", "model": { "primary": "google/gemini-2.5-pro" } }
    ]
  }
}

Environment

  • OpenClaw v2026.3.28
  • OS: Ubuntu Linux 6.17.0-19-generic (x64)
  • Node: v22.22.0
  • Parent model: anthropic/claude-sonnet-4-6
  • Target subagent model: google/gemini-2.5-pro

Impact

Multi-agent setups where different agents run on different models are completely broken. Specifically, any agent configured with a non-default model cannot be used as a subagent from a parent running on a different model.

Suspected Cause

The v2026.3.28 changelog mentions moving bundled CLI inference defaults onto the plugin surface and changes to model inference routing. This likely tightened live session model switching in a way that inadvertently blocks legitimate subagent model overrides.

Workaround

None found. Running all subagents on the parent session's model (Sonnet) as a temporary workaround.

Activity

  1. danielsan1 commented on Mar 31, 2026

    @danielsan1

    Same here! I’m downgrading now to .24 as my cron jobs are burning my token as it constantly switches basic Haiku jobs to Opus - not usable.

  2. goncalovelosa commented on Mar 31, 2026

    @goncalovelosa
  3. steipete commented on Apr 25, 2026

    @steipete
    Contributor

    Closing this as implemented after Codex review.

    Current main already implements the reported fix. Subagent spawns now persist the child session's runtime model before the child run starts, regression coverage asserts that ordering, and the changelog records the LiveSessionModelSwitchError fix in the 2026.3.31 release notes.

    What I checked:

    • Current spawn path persists child runtime model before launch: persistInitialChildSessionRuntimeModel writes model/modelProvider into the child session store, and spawnSubagentDirect calls it before the agent gateway start. (src/agents/subagent-spawn.ts:204, 0783090da009)
    • Regression test covers the exact ordering: Test asserts sessions.patch happens first, then session-store runtime-model persistence, then agent launch, for a child spawned with an explicit different model. (src/agents/subagent-spawn.model-session.test.ts:48, 0783090da009)
    • Model-selection coverage still supports per-agent subagent models differing from the parent: Tests verify agents.list[].subagents.model wins over the agent primary model, matching the reported cross-model parent/child configuration. (src/agents/model-selection.test.ts:1440, 90877e0d4274)
    • User-facing docs still describe distinct subagent model overrides: Docs say subagents can use agents.defaults.subagents.model, per-agent agents.list[].subagents.model, or explicit sessions_spawn.model overrides. Public docs: docs/tools/subagents.md. (docs/tools/subagents.md:72, 90877e0d4274)
    • Release notes record this exact bug class as fixed: The 2026.3.31 changelog says transient cron and subagent model overrides no longer get misread as persisted live-session switches, avoiding LiveSessionModelSwitchError in isolated runs. (CHANGELOG.md:1900, 90877e0d4274)

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review notes: reviewed against 90877e0d4274; fix evidence: release 2026.3.31, commit 0783090da009.

  4. locked as resolved and limited conversation to collaborators on Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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