Merge 90af2e7e675d5557ed3afe66dd9e52b01dd42287 into 5e417b44e1540f528d2ae63e3e20229a902d1db2

This commit is contained in:
Dongyan Qian 2026-03-20 18:52:13 -07:00 committed by GitHub
commit eb63fc29c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import {
resolveConfiguredModelRef,
resolveThinkingDefault,
resolveModelRefFromString,
resolveSubagentConfiguredModelSelection,
} from "./model-selection.js";
const EXPLICIT_ALLOWLIST_CONFIG = {
@ -835,3 +836,21 @@ describe("normalizeModelSelection", () => {
expect(normalizeModelSelection(42)).toBeUndefined();
});
});
describe("resolveSubagentConfiguredModelSelection", () => {
it("prefers the target agent subagents.model over global defaults.subagents.model and agent.primary", () => {
const cfg = {
agents: {
defaults: {
subagents: { model: "minimax/MiniMax-M2.5" },
model: { primary: "openai/gpt-5.4" },
},
list: [{ id: "research", model: { primary: "opencode/claude" } }],
},
} as OpenClawConfig;
expect(resolveSubagentConfiguredModelSelection({ cfg, agentId: "research" })).toBe(
"minimax/MiniMax-M2.5",
);
});
});

View File

@ -229,6 +229,24 @@ describe("openclaw-tools: subagents (sessions_spawn model + thinking)", () => {
});
});
it("sessions_spawn prefers target agent primary model over global subagent default", async () => {
await expectSpawnUsesConfiguredModel({
config: {
session: { mainKey: "main", scope: "per-sender" },
agents: {
defaults: {
subagents: { model: "minimax/MiniMax-M2.5" },
model: { primary: "openai/gpt-5.4" },
},
list: [{ id: "research", model: { primary: "opencode/claude" } }],
},
},
runId: "run-agent-primary-over-subagent-default",
callId: "call-agent-primary-over-subagent-default",
expectedModel: "minimax/MiniMax-M2.5",
});
});
it("sessions_spawn prefers target agent primary model over global default", async () => {
await expectSpawnUsesConfiguredModel({
config: {