-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
fix(agents): subagent model precedence — global default shadowed by parent agent's own model #58822
Copy link
Copy link
Open
BingqingLyu/openclaw
#1771Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.Thin issue quality; more reproduction proof or environment detail is needed.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.Thin issue quality; more reproduction proof or environment detail is needed.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug
PR #58003 (commit e394262, merged 2026-03-31) reordered the fallback chain in
resolveSubagentConfiguredModelSelectionto preferagentConfig.model(the agent's own model) overagents.defaults.subagents.model(the global subagent default).This is correct for named agents with an explicit
subagents.modeloverride, but it introduces a regression for the common case: the main agent.Reproduction
Config:
Expected: subagents spawned from the main agent use
openai/gpt-5.4(the global subagent default).Actual: subagents use
anthropic/claude-opus-4-6(the main agent's own model), because the agent's own model is checked before the global subagent default.Root cause
In
src/agents/model-selection.ts,resolveSubagentConfiguredModelSelection:An agent's own model (what model runs the agent) is conceptually different from what model its subagents should use. The agent's own model should only be a last-resort fallback, not take priority over an explicitly configured global subagent default.
The same issue exists in
src/cron/isolated-agent/model-selection.ts.Correct precedence
agentConfig.subagents.model— explicit per-agent subagent config (highest priority)cfg.agents.defaults.subagents.model— global subagent defaultagentConfig.model— agent's own model (last-resort fallback only)Related