openclaw - 💡(How to fix) Fix sessions_spawn model parameter ignored — sub-agents always inherit primary model [1 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#63400Fetched 2026-04-09 07:54:12
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

When calling sessions_spawn with a model parameter, the sub-agent ignores the requested model and runs on the primary model (openrouter/anthropic/claude-opus-4-6) instead.

Root Cause

When calling sessions_spawn with a model parameter, the sub-agent ignores the requested model and runs on the primary model (openrouter/anthropic/claude-opus-4-6) instead.

Code Example

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "openrouter/anthropic/claude-opus-4-6"
      },
      "subagents": {
        "model": "openrouter/google/gemini-2.5-flash"
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Bug Report

OpenClaw Version: 2026.4.5 (build d74a122) Platform: Railway (Linux x64)

Description

When calling sessions_spawn with a model parameter, the sub-agent ignores the requested model and runs on the primary model (openrouter/anthropic/claude-opus-4-6) instead.

Steps to Reproduce

  1. Set agents.defaults.model.primary to openrouter/anthropic/claude-opus-4-6
  2. Set agents.defaults.subagents.model to openrouter/google/gemini-2.5-flash
  3. Call sessions_spawn({ task: "...", model: "openrouter/google/gemini-2.5-flash", mode: "run" })
  4. Check OpenRouter logs — the sub-agent request shows as Opus, not Gemini Flash

Expected Behavior

Sub-agent should use the model specified in the sessions_spawn call, or fall back to agents.defaults.subagents.model.

Actual Behavior

Sub-agent always uses the primary model from agents.defaults.model.primary, regardless of:

  • The model parameter passed to sessions_spawn
  • The agents.defaults.subagents.model config setting

Evidence

20+ consecutive OpenRouter API calls all show Claude Opus 4.6 despite explicit model overrides to Gemini Flash and Codex. Config was changed and gateway restarted — no effect.

Impact

Significant cost impact — simple lookup tasks that should cost $0.001 on Gemini Flash are costing $0.50-0.80 on Opus. One 20-minute session of sub-agent work cost ~$5.50 unnecessarily.

Config (relevant section)

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "openrouter/anthropic/claude-opus-4-6"
      },
      "subagents": {
        "model": "openrouter/google/gemini-2.5-flash"
      }
    }
  }
}

extent analysis

TL;DR

The sub-agent ignoring the requested model and using the primary model instead can be fixed by verifying the sessions_spawn function's handling of the model parameter and ensuring it correctly overrides the primary model setting.

Guidance

  • Review the sessions_spawn function to ensure it properly handles the model parameter and overrides the agents.defaults.model.primary setting when provided.
  • Check the OpenRouter API documentation to confirm the correct syntax and usage of the model parameter in the sessions_spawn call.
  • Verify that the agents.defaults.subagents.model config setting is being correctly applied when the model parameter is not provided in the sessions_spawn call.
  • Test the sessions_spawn function with different model parameters to confirm the issue is resolved and the correct model is being used.

Example

No code snippet is provided as the issue does not include the implementation details of the sessions_spawn function.

Notes

The issue may be related to a bug in the sessions_spawn function or a misconfiguration in the OpenRouter setup. Further investigation is needed to determine the root cause.

Recommendation

Apply a workaround by modifying the sessions_spawn function to correctly handle the model parameter and override the primary model setting. This will ensure the correct model is used for sub-agent requests until a permanent fix is available.

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