openclaw - 💡(How to fix) Fix sessions_spawn model parameter still ignored — all subagents run on parent's default model (2026.4.25) [1 comments, 2 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#73180Fetched 2026-04-29 06:22:32
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
cross-referenced ×2closed ×1commented ×1

The model parameter in sessions_spawn is silently ignored. All subagents run on the parent session's default model (agents.defaults.model.primary), regardless of what model is specified.

This is a different bug from #17479 which was fixed in PR #21088. The PR fix (capturing allowAnyModel from buildAllowedModelSet) IS present in our codebase, but subagents still use the default model.

Root Cause

The model parameter in sessions_spawn is silently ignored. All subagents run on the parent session's default model (agents.defaults.model.primary), regardless of what model is specified.

This is a different bug from #17479 which was fixed in PR #21088. The PR fix (capturing allowAnyModel from buildAllowedModelSet) IS present in our codebase, but subagents still use the default model.

Fix Action

Workaround

None found for subagents. The only working workaround is to change the parent session model via session_status(model=...) and run the task in the main session instead of a subagent.

Code Example

sessions_spawn(model="ollama/kimi-k2.6:cloud", task="What model are you?")
sessions_spawn(model="ollama/deepseek-v4-pro:cloud", task="What model are you?")
sessions_spawn(model="ollama/glm-5.1:cloud", task="What model are you?")
RAW_BUFFERClick to expand / collapse

Bug: sessions_spawn model override is completely ignored

Summary

The model parameter in sessions_spawn is silently ignored. All subagents run on the parent session's default model (agents.defaults.model.primary), regardless of what model is specified.

This is a different bug from #17479 which was fixed in PR #21088. The PR fix (capturing allowAnyModel from buildAllowedModelSet) IS present in our codebase, but subagents still use the default model.

Environment

  • OpenClaw: 2026.4.25 (aa36ee6)
  • Default model: ollama/glm-5.1:cloud
  • Ollama provider with cloud models

Reproduction

  1. Set agents.defaults.model.primary to ollama/glm-5.1:cloud
  2. Add ollama/deepseek-v4-pro:cloud and ollama/kimi-k2.6:cloud to agents.defaults.models
  3. Also set agents.defaults.subagents.model.primary to ollama/deepseek-v4-pro:cloud
  4. Spawn subagents with different models:
sessions_spawn(model="ollama/kimi-k2.6:cloud", task="What model are you?")
sessions_spawn(model="ollama/deepseek-v4-pro:cloud", task="What model are you?")
sessions_spawn(model="ollama/glm-5.1:cloud", task="What model are you?")

Expected behavior

Each subagent runs on the specified model.

Actual behavior

All three subagents run on GLM 5.1, the parent's default model.

Subagent session transcripts confirm "model_change": {"provider": "ollama", "modelId": "glm-5.1:cloud"} in all cases.

Verified configurations that do NOT work

ConfigResult
sessions_spawn.model = "ollama/kimi-k2.6:cloud"❌ Runs as GLM 5.1
sessions_spawn.model = "ollama/deepseek-v4-pro:cloud"❌ Runs as GLM 5.1
agents.defaults.subagents.model.primary = "ollama/deepseek-v4-pro:cloud"❌ Runs as GLM 5.1
session_status(model="ollama/deepseek-v4-pro:cloud") on parent session❌ Subagents still GLM 5.1

Code analysis

The fix from PR #21088 IS present in agent-command-Bxk-YetL.js (line 520: let allowAnyModel = !hasAllowlist). However, sessions_spawn tool execution goes through subagent-spawn-cbH-XgdN.js which calls resolveSubagentSpawnModelSelection() → returns the correct model string → passes it to persistInitialChildSessionRuntimeModel() → writes to session store.

But the session transcript shows the model was never changed from glm-5.1:cloud. The model_change event in the subagent transcript always records the parent's default model.

This suggests the model resolution happens at a different layer (possibly the PI agent loop or Ollama provider routing) that overrides the stored model selection before the first inference.

Related issues

  • #17479 — Original bug (fixed by PR #21088, but fix doesn't cover this path)
  • #13159 — Model override ignored in isolated sessions
  • #10963 — Subagents ignore agents.defaults.subagents.model.primary
  • zooclaw.ai workaround article — Documents the bug and suggests session_status(model=...) as workaround (which also doesn't work for subagents)

Workaround

None found for subagents. The only working workaround is to change the parent session model via session_status(model=...) and run the task in the main session instead of a subagent.

extent analysis

TL;DR

The sessions_spawn model override issue may be resolved by investigating and adjusting the model resolution logic in the PI agent loop or Ollama provider routing.

Guidance

  • Review the subagent-spawn-cbH-XgdN.js file to ensure the resolveSubagentSpawnModelSelection() function is correctly resolving the model selection.
  • Investigate the persistInitialChildSessionRuntimeModel() function to verify it is writing the correct model to the session store.
  • Check the Ollama provider routing configuration to see if it is overriding the model selection before the first inference.
  • Consider adding logging or debugging statements to track the model selection process and identify where the override is being ignored.

Example

No code snippet is provided as the issue requires further investigation into the specific implementation details.

Notes

The fix from PR #21088 is present in the codebase, but it does not cover this specific path. The issue may be related to the model resolution happening at a different layer, such as the PI agent loop or Ollama provider routing.

Recommendation

Apply a workaround by changing the parent session model via session_status(model=...) and running the task in the main session instead of a subagent, as suggested in the zooclaw.ai workaround article. However, this is not a permanent solution and the root cause should be investigated and addressed.

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…

FAQ

Expected behavior

Each subagent runs on the specified model.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix sessions_spawn model parameter still ignored — all subagents run on parent's default model (2026.4.25) [1 comments, 2 participants]