fix(delegate-task): honor explicit category model over sisyphus-junior

This commit is contained in:
Lynricsy
2026-02-04 11:51:20 +08:00
parent 06522a96fe
commit 176f15ce5b
2 changed files with 69 additions and 3 deletions
+62
View File
@@ -1770,6 +1770,68 @@ describe("sisyphus-task", () => {
expect(launchInput.model.providerID).toBe("anthropic")
expect(launchInput.model.modelID).toBe("claude-sonnet-4-5")
})
test("explicit category model takes precedence over sisyphus-junior model", async () => {
// given - explicit category model differs from sisyphus-junior override
const { createDelegateTask } = require("./tools")
let launchInput: any
const mockManager = {
launch: async (input: any) => {
launchInput = input
return {
id: "task-category-precedence",
sessionID: "ses_category_precedence_test",
description: "Category precedence test",
agent: "sisyphus-junior",
status: "running",
}
},
}
const mockClient = {
app: { agents: async () => ({ data: [] }) },
config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) },
model: { list: async () => [] },
session: {
create: async () => ({ data: { id: "test-session" } }),
prompt: async () => ({ data: {} }),
messages: async () => ({ data: [] }),
},
}
const tool = createDelegateTask({
manager: mockManager,
client: mockClient,
sisyphusJuniorModel: "anthropic/claude-sonnet-4-5",
userCategories: {
ultrabrain: { model: "openai/gpt-5.2-codex" },
},
})
const toolContext = {
sessionID: "parent-session",
messageID: "parent-message",
agent: "sisyphus",
abort: new AbortController().signal,
}
// when - using ultrabrain category with explicit model override
await tool.execute(
{
description: "Category precedence test",
prompt: "Do something",
category: "ultrabrain",
run_in_background: true,
load_skills: [],
},
toolContext
)
// then - explicit category model should win
expect(launchInput.model.providerID).toBe("openai")
expect(launchInput.model.modelID).toBe("gpt-5.2-codex")
})
})
describe("browserProvider propagation", () => {