Merge branch 'fix/p0-4-omo-agent-variant' into dev
This commit is contained in:
@@ -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 () => {
|
test("forwards category-derived model override to background executor", async () => {
|
||||||
//#given
|
//#given
|
||||||
const launch = mock((_input: { model?: { providerID: string; modelID: string } }) => Promise.resolve({
|
const launch = mock((_input: { model?: { providerID: string; modelID: string } }) => Promise.resolve({
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import type { DelegatedModelConfig } from "../../shared/model-resolution-types"
|
|||||||
import type { FallbackEntry } from "../../shared/model-requirements"
|
import type { FallbackEntry } from "../../shared/model-requirements"
|
||||||
import { AGENT_MODEL_REQUIREMENTS } from "../../shared/model-requirements"
|
import { AGENT_MODEL_REQUIREMENTS } from "../../shared/model-requirements"
|
||||||
import { getAgentConfigKey } from "../../shared/agent-display-names"
|
import { getAgentConfigKey } from "../../shared/agent-display-names"
|
||||||
import { normalizeModelFormat } from "../../shared/model-format-normalizer"
|
|
||||||
import { normalizeFallbackModels } from "../../shared/model-resolver"
|
import { normalizeFallbackModels } from "../../shared/model-resolver"
|
||||||
import { buildFallbackChainFromModels } from "../../shared/fallback-chain-from-models"
|
import { buildFallbackChainFromModels } from "../../shared/fallback-chain-from-models"
|
||||||
import { log } from "../../shared"
|
import { log } from "../../shared"
|
||||||
|
import { parseModelString } from "../delegate-task/model-string-parser"
|
||||||
import { executeBackground } from "./background-executor"
|
import { executeBackground } from "./background-executor"
|
||||||
import { executeSync } from "./sync-executor"
|
import { executeSync } from "./sync-executor"
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ function resolveModelAndFallbackChain(args: {
|
|||||||
|
|
||||||
let model: DelegatedModelConfig | undefined
|
let model: DelegatedModelConfig | undefined
|
||||||
if (agentOverride?.model) {
|
if (agentOverride?.model) {
|
||||||
const normalized = normalizeModelFormat(agentOverride.model)
|
const normalized = parseModelString(agentOverride.model)
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
model = agentOverride.variant ? { ...normalized, variant: agentOverride.variant } : normalized
|
model = agentOverride.variant ? { ...normalized, variant: agentOverride.variant } : normalized
|
||||||
log("[call_omo_agent] Resolved model override from agent config", {
|
log("[call_omo_agent] Resolved model override from agent config", {
|
||||||
@@ -46,7 +46,7 @@ function resolveModelAndFallbackChain(args: {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (agentCategoryModel) {
|
} else if (agentCategoryModel) {
|
||||||
const normalized = normalizeModelFormat(agentCategoryModel)
|
const normalized = parseModelString(agentCategoryModel)
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
const variantToUse = agentOverride?.variant ?? agentCategoryVariant
|
const variantToUse = agentOverride?.variant ?? agentCategoryVariant
|
||||||
model = variantToUse ? { ...normalized, variant: variantToUse } : normalized
|
model = variantToUse ? { ...normalized, variant: variantToUse } : normalized
|
||||||
|
|||||||
Reference in New Issue
Block a user