fix(agents): apply subagent spawn model selection#72877
Conversation
Greptile SummaryThis PR fixes two related model-selection issues in subagent spawning: it reverses the precedence order so Confidence Score: 5/5Safe to merge — changes are focused, self-contained, and covered by targeted tests. All changes are two-line precedence swaps and three additive field writes. Tests are updated to reflect the new expected behaviour in both the native and cron paths. No P0/P1 findings were identified. No files require special attention. Reviews (1): Last reviewed commit: "fix(agents): apply subagent spawn model ..." | Re-trigger Greptile |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. This PR is superseded: current main already has the child-session override persistence piece in a source-aware form, the Yuanbao catalog pin is already present, and the remaining subagent precedence work is tracked by narrower open follow-ups. The PR head also still has a correctness bug around explicit spawn model source handling, so it should not be merged as-is. So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Close this superseded branch and consolidate review on the narrower precedence/runtime follow-up, while keeping current main’s source-aware child-session override persistence rather than reintroducing all-auto model override source handling. Do we have a high-confidence way to reproduce the issue? Yes. The code-level reproduction is to spawn with an explicit sessions_spawn.model on the PR head: the plan only passes model, buildDirectChildSessionPatch stores it as auto, and fallback resolution treats auto overrides as eligible for configured fallbacks. Is this the best way to solve the issue? No. The intended precedence direction is plausible, but this branch is stale against current main’s override-source handling and duplicates remaining work already covered by #58823 and #72984. Security review: Security review cleared: The diff touches supply-chain-sensitive catalog metadata, but the Yuanbao exact npm spec and integrity are already present on current main and the patch does not broaden scripts, permissions, or credential handling. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 359d871293e8. |
Summary
agents.defaults.subagents.modelwins over the target agent primary model when no per-agentsubagents.modelis set.sessions_spawnmodel onto child sessions as selected model override fields (providerOverride/modelOverride, sourceauto) before the first childagentrun.Why
Native
sessions_spawncould reportmodelApplied: truewhile the child run still executed on the target agent/default model. The spawn path persisted only runtime identity fields (model/modelProvider), butagentCommandselects frommodelOverride/providerOverride, so the resolved spawn model was visible in some status surfaces without necessarily controlling the actual provider call.This also covers the default precedence case discussed in #58822 / #58823, and adds the explicit-spawn-model application path related to #6295.
Tests
corepack pnpm vitest run src/agents/model-selection.test.ts src/agents/openclaw-tools.subagents.sessions-spawn.model.test.ts src/agents/subagent-spawn.model-session.test.ts src/cron/isolated-agent.model-formatting.test.tsPATH="/tmp/openclaw-pnpm-shim:$PATH" corepack pnpm check:changed