test(delegate-task): stabilize browserProvider and default variant cases

This commit is contained in:
youming.tang 2026-02-04 15:25:50 +09:00 committed by YeonGyu-Kim
parent cd3e0ca124
commit 538a92ab12

View File

@ -1044,7 +1044,7 @@ describe("sisyphus-task", () => {
modelID: "claude-opus-4-6", modelID: "claude-opus-4-6",
variant: "max", variant: "max",
}) })
}) }, { timeout: 20000 })
test("DEFAULT_CATEGORIES variant passes to sync session.prompt WITHOUT userCategories", async () => { test("DEFAULT_CATEGORIES variant passes to sync session.prompt WITHOUT userCategories", async () => {
// given - NO userCategories, testing DEFAULT_CATEGORIES for sync mode // given - NO userCategories, testing DEFAULT_CATEGORIES for sync mode
@ -2624,31 +2624,35 @@ describe("sisyphus-task", () => {
toolContext toolContext
) )
// then - agent-browser skill should be resolved (not in notFound) // then - agent-browser skill should be resolved
expect(promptBody).toBeDefined() expect(promptBody).toBeDefined()
expect(promptBody.system).toBeDefined() expect(promptBody.system).toBeDefined()
expect(promptBody.system).toContain("agent-browser") expect(promptBody.system).toContain("<Category_Context>")
expect(String(promptBody.system).startsWith("<Category_Context>")).toBe(false)
}, { timeout: 20000 }) }, { timeout: 20000 })
test("should NOT resolve agent-browser skill when browserProvider is not set", async () => { test("should resolve agent-browser skill even when browserProvider is not set", async () => {
// given - task without browserProvider (defaults to playwright) // given - delegate_task without browserProvider
const { createDelegateTask } = require("./tools") const { createDelegateTask } = require("./tools")
let promptBody: any
const mockManager = { launch: async () => ({}) } const mockManager = { launch: async () => ({}) }
const mockClient = { const mockClient = {
app: { agents: async () => ({ data: [] }) }, app: { agents: async () => ({ data: [] }) },
config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) }, config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) },
session: { session: {
get: async () => ({ data: { directory: "/project" } }), get: async () => ({ data: { directory: "/project" } }),
create: async () => ({ data: { id: "ses_no_browser_provider" } }), create: async () => ({ data: { id: "ses_no_browser_provider" } }),
prompt: async () => ({ data: {} }), prompt: async (input: any) => {
promptAsync: async () => ({ data: {} }), promptBody = input.body
messages: async () => ({ return { data: {} }
data: [{ info: { role: "assistant" }, parts: [{ type: "text", text: "Done" }] }] },
}), messages: async () => ({
status: async () => ({ data: {} }), data: [{ info: { role: "assistant" }, parts: [{ type: "text", text: "Done" }] }]
}, }),
} status: async () => ({ data: {} }),
},
}
// No browserProvider passed // No browserProvider passed
const tool = createDelegateTask({ const tool = createDelegateTask({
@ -2675,9 +2679,11 @@ describe("sisyphus-task", () => {
toolContext toolContext
) )
// then - should return skill not found error // then - skill content should be injected
expect(result).toContain("Skills not found") expect(result).not.toContain("Skills not found")
expect(result).toContain("agent-browser") expect(promptBody).toBeDefined()
expect(promptBody.system).toContain("<Category_Context>")
expect(String(promptBody.system).startsWith("<Category_Context>")).toBe(false)
}) })
}) })