Skip to content

Subagent model override from agents.defaults.subagents.model is silently discarded (modelOverrideSource:"auto" matches legacy-cleanup heuristic) #92486

Description

@PatrickTrent

Version

2026.6.5 (build 5181e4f), reproduced on macOS and Linux.

Summary

A subagent model configured via agents.defaults.subagents.model.primary is resolved correctly at spawn time, but discarded before the child run starts. The child silently runs on agents.defaults.model.primary instead. Depending on that default this either hard-fails the spawn (pre-flight thinking validation) or silently runs every delegation on the wrong (potentially much more expensive) model.

Reproduction

  1. Configure e.g.:
    "agents": { "defaults": {
      "model": { "primary": "some-openai-compat/model-without-thinking" },
      "subagents": { "model": { "primary": "minimax/MiniMax-M2.5" }, "thinking": "low" }
    }}
  2. Have the agent call sessions_spawn without an explicit model param.
  3. sessions_spawn returns resolvedModel: "minimax/MiniMax-M2.5", modelApplied: true — but the child fails pre-flight with Thinking level "low" is not supported for <agent-default-model>. Use one of: off. — runtime 0s, 0 tokens. The configured subagent model (and its fallbacks) is never attempted.

If the agent-default model does support the configured thinking level, there is no error at all: every delegation silently runs on the agent default instead of the configured subagent model (in our case Sonnet instead of MiniMax — a pure cost leak).

Root cause (dist trace, 2026.6.5)

  1. subagent-spawn-plan-*.jsresolveSubagentModelAndThinkingPlan builds initialSessionPatch with modelOverrideSource: params.modelOverride?.trim() ? "user" : "auto". A config-driven choice therefore gets labeled "auto", with no modelOverrideFallbackOriginProvider/Model set.
  2. agent-scope-*.jshasLegacyAutoFallbackWithoutOrigin(entry) returns true for modelOverrideSource === "auto" without origin fields. That was meant to clean up stale auto-fallback leftovers, but every fresh spawn patch matches by construction.
  3. agent-command-*.jsstoredModelOverride = hasLegacyAutoFallbackOverrideWithoutOrigin ? void 0 : sessionEntry?.modelOverride?.trim() → the configured override is dropped; the child resolves to the agent default. The session's thinkingLevel (from subagents.thinking) still counts as an explicit override, so unsupported levels throw instead of downgrading.

Suggested fix

Either have the spawn plan set user-equivalent provenance (or the origin fields) for config-driven subagent model choices, or exclude fresh spawn patches from the legacy-auto-fallback cleanup heuristic.

Workaround

Passing an explicit model on every sessions_spawn call (→ modelOverrideSource: "user") survives the heuristic; or set subagents.thinking: "off" to at least make the spawn succeed on the (wrong) default model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions