Merge branch 'fix/p0-4-omo-agent-variant' into dev

This commit is contained in:
YeonGyu-Kim
2026-04-01 18:23:18 -07:00
2 changed files with 53 additions and 3 deletions
+50
View File
@@ -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({
+3 -3
View File
@@ -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