CLAUDE_CODE_SUBAGENT_MODEL=inherit ignores per-call Task model param (contradicts docs)

Open 💬 1 comment Opened Jun 14, 2026 by AlvaroRojas

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

  1. settings.json -> "model": "opus", env "CLAUDE_CODE_SUBAGENT_MODEL": "inherit". Restart Claude Code.
  2. Dispatch a subagent (Task tool) with model: "haiku" (or "sonnet").
  3. Inspect the subagent transcript ~/.claude/projects/<proj>/<session>/subagents/agent-<id>.jsonl and 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)

  1. Code: make inherit defer to the per-call model param as documented; or
  2. Docs: clarify that inherit forces the session model and the variable must be unset for the per-call model to be honored.

Impact

Silent cost blow-up — orchestrator-intended haiku/sonnet subagents all silently ran Opus.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗