CLAUDE_CODE_SUBAGENT_MODEL=inherit ignores per-call Task model param (contradicts docs)
Summary
On Claude Code 2.1.177, setting CLAUDE_CODE_SUBAGENT_MODEL=inherit causes dispatched subagents to ignore the per-call model parameter and always run the main session model. The model-config docs state inherit means "use normal model resolution," and the sub-agents docs rank the per-invocation model param above the session model — so per-call routing should work with inherit. It does not. Unsetting the variable entirely makes it work as documented.
Environment
- Claude Code 2.1.177, Windows 11
settings.json: top-level"model": "opus", env"CLAUDE_CODE_SUBAGENT_MODEL": "inherit"
Repro
settings.json->"model": "opus", env"CLAUDE_CODE_SUBAGENT_MODEL": "inherit". Restart Claude Code.- Dispatch a subagent (Task tool) with
model: "haiku"(or"sonnet"). - Inspect the subagent transcript
~/.claude/projects/<proj>/<session>/subagents/agent-<id>.jsonland grep"model".
Actual
model:"haiku" and model:"sonnet" both ran claude-opus-4-8 (the session model). The per-call param is dropped — it is not even recorded in the subagent transcript.
Expected
Per the documented precedence (per-invocation model param > session model; inherit = normal resolution), the subagent should run claude-haiku-4-5.
What actually works
Removing CLAUDE_CODE_SUBAGENT_MODEL entirely (unset) + restart -> model:"haiku" correctly runs claude-haiku-4-5-20251001. So inherit does not behave like "unset," contrary to the docs.
Fix (either resolves it)
- Code: make
inheritdefer to the per-callmodelparam as documented; or - Docs: clarify that
inheritforces the session model and the variable must be unset for the per-callmodelto be honored.
Impact
Silent cost blow-up — orchestrator-intended haiku/sonnet subagents all silently ran Opus.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗