diff --git a/src/tools/call-omo-agent/tools.test.ts b/src/tools/call-omo-agent/tools.test.ts index 56893ee7c..5d499b7bb 100644 --- a/src/tools/call-omo-agent/tools.test.ts +++ b/src/tools/call-omo-agent/tools.test.ts @@ -265,6 +265,56 @@ describe("createCallOmoAgent", () => { }) }) + test("parses inline model variant from agent config override", async () => { + //#given + const launch = mock((_input: { model?: { providerID: string; modelID: string; variant?: string } }) => Promise.resolve({ + id: "task-inline-variant", + sessionID: "sub-session", + description: "Test task", + agent: "explore", + status: "pending", + })) + const managerWithLaunch = { + launch, + getTask: mock(() => undefined), + } + const toolDef = createCallOmoAgent( + mockCtx, + managerWithLaunch, + [], + { + explore: { + model: "openai/gpt-5.4 high", + }, + }, + ) + const executeFunc = toolDef.execute as Function + + //#when + await executeFunc( + { + description: "Test inline variant", + 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", + variant: "high", + }) + }) + test("forwards category-derived model override to background executor", async () => { //#given const launch = mock((_input: { model?: { providerID: string; modelID: string } }) => Promise.resolve({ diff --git a/src/tools/call-omo-agent/tools.ts b/src/tools/call-omo-agent/tools.ts index 9b62ef7e3..00358b8e1 100644 --- a/src/tools/call-omo-agent/tools.ts +++ b/src/tools/call-omo-agent/tools.ts @@ -7,10 +7,10 @@ import type { DelegatedModelConfig } from "../../shared/model-resolution-types" import type { FallbackEntry } from "../../shared/model-requirements" import { AGENT_MODEL_REQUIREMENTS } from "../../shared/model-requirements" import { getAgentConfigKey } from "../../shared/agent-display-names" -import { normalizeModelFormat } from "../../shared/model-format-normalizer" import { normalizeFallbackModels } from "../../shared/model-resolver" import { buildFallbackChainFromModels } from "../../shared/fallback-chain-from-models" import { log } from "../../shared" +import { parseModelString } from "../delegate-task/model-string-parser" import { executeBackground } from "./background-executor" import { executeSync } from "./sync-executor" @@ -36,7 +36,7 @@ function resolveModelAndFallbackChain(args: { let model: DelegatedModelConfig | undefined if (agentOverride?.model) { - const normalized = normalizeModelFormat(agentOverride.model) + const normalized = parseModelString(agentOverride.model) if (normalized) { model = agentOverride.variant ? { ...normalized, variant: agentOverride.variant } : normalized log("[call_omo_agent] Resolved model override from agent config", { @@ -46,7 +46,7 @@ function resolveModelAndFallbackChain(args: { }) } } else if (agentCategoryModel) { - const normalized = normalizeModelFormat(agentCategoryModel) + const normalized = parseModelString(agentCategoryModel) if (normalized) { const variantToUse = agentOverride?.variant ?? agentCategoryVariant model = variantToUse ? { ...normalized, variant: variantToUse } : normalized