fix: honor category-derived model overrides in call_omo_agent

This commit is contained in:
YeonGyu-Kim
2026-03-31 17:03:42 -07:00
parent 9f2c4500e8
commit de7d72db27
2 changed files with 72 additions and 0 deletions
+54
View File
@@ -265,6 +265,60 @@ describe("createCallOmoAgent", () => {
})
})
test("forwards category-derived model override to background executor", async () => {
//#given
const launch = mock((_input: { model?: { providerID: string; modelID: string } }) => Promise.resolve({
id: "task-category-model",
sessionID: "sub-session",
description: "Test task",
agent: "explore",
status: "pending",
}))
const managerWithLaunch = {
launch,
getTask: mock(() => undefined),
}
const toolDef = createCallOmoAgent(
mockCtx,
managerWithLaunch,
[],
{
explore: {
category: "research",
},
},
{
research: {
model: "openai/gpt-5.4",
},
},
)
const executeFunc = toolDef.execute as Function
//#when
await executeFunc(
{
description: "Test category model override",
prompt: "Test prompt",
subagent_type: "explore",
run_in_background: true,
},
{ sessionID: "test", messageID: "msg", agent: "test", abort: new AbortController().signal }
)
//#then
const firstLaunchCall = launch.mock.calls[0]
if (firstLaunchCall === undefined) {
throw new Error("Expected launch to be called")
}
const [launchArgs] = firstLaunchCall
expect(launchArgs.model).toEqual({
providerID: "openai",
modelID: "gpt-5.4",
})
})
test("should return a tool error when sync spawn depth validation fails", async () => {
//#given
reserveSubagentSpawnMock.mockRejectedValueOnce(new Error("Subagent spawn blocked: child depth 4 exceeds background_task.maxDepth=3."))