From 0d0bf4d384e1acf404adbeb93f2bc32b5f88d074 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Thu, 8 Jan 2026 14:36:15 +0900 Subject: [PATCH] feat(sisyphus-task): make skills parameter required - Add validation for skills parameter (must be provided, use [] if empty) - Update schema to remove .optional() - Update type definition to make skills non-optional - Fix existing tests to include skills parameter --- src/tools/sisyphus-task/tools.test.ts | 48 +++++++++++++++++++++++++-- src/tools/sisyphus-task/tools.ts | 7 ++-- src/tools/sisyphus-task/types.ts | 2 +- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/tools/sisyphus-task/tools.test.ts b/src/tools/sisyphus-task/tools.test.ts index 84b6f8a6..d76c2f26 100644 --- a/src/tools/sisyphus-task/tools.test.ts +++ b/src/tools/sisyphus-task/tools.test.ts @@ -213,6 +213,48 @@ describe("sisyphus-task", () => { expect(SISYPHUS_TASK_DESCRIPTION).toContain("skills") expect(SISYPHUS_TASK_DESCRIPTION).toContain("Array of skill names") }) + + test("skills parameter is required - returns error when not provided", async () => { + // #given + const { createSisyphusTask } = require("./tools") + + const mockManager = { launch: async () => ({}) } + const mockClient = { + app: { agents: async () => ({ data: [] }) }, + session: { + create: async () => ({ data: { id: "test-session" } }), + prompt: async () => ({ data: {} }), + messages: async () => ({ data: [] }), + }, + } + + const tool = createSisyphusTask({ + manager: mockManager, + client: mockClient, + }) + + const toolContext = { + sessionID: "parent-session", + messageID: "parent-message", + agent: "Sisyphus", + abort: new AbortController().signal, + } + + // #when - skills not provided (undefined) + const result = await tool.execute( + { + description: "Test task", + prompt: "Do something", + category: "ultrabrain", + run_in_background: false, + }, + toolContext + ) + + // #then - should return error about missing skills + expect(result).toContain("skills") + expect(result).toContain("REQUIRED") + }) }) describe("resume with background parameter", () => { @@ -268,7 +310,8 @@ describe("sisyphus-task", () => { description: "Resume test", prompt: "Continue the task", resume: "ses_resume_test", - background: false, + run_in_background: false, + skills: [], }, toolContext ) @@ -321,7 +364,8 @@ describe("sisyphus-task", () => { description: "Resume bg test", prompt: "Continue in background", resume: "ses_bg_resume", - background: true, + run_in_background: true, + skills: [], }, toolContext ) diff --git a/src/tools/sisyphus-task/tools.ts b/src/tools/sisyphus-task/tools.ts index 353e805c..e46ba978 100644 --- a/src/tools/sisyphus-task/tools.ts +++ b/src/tools/sisyphus-task/tools.ts @@ -121,17 +121,20 @@ export function createSisyphusTask(options: SisyphusTaskToolOptions): ToolDefini subagent_type: tool.schema.string().optional().describe("Agent name directly (e.g., 'oracle', 'explore'). Mutually exclusive with category."), run_in_background: tool.schema.boolean().describe("Run in background. MUST be explicitly set. Use false for task delegation, true only for parallel exploration."), resume: tool.schema.string().optional().describe("Session ID to resume - continues previous agent session with full context"), - skills: tool.schema.array(tool.schema.string()).optional().describe("Array of skill names to prepend to the prompt. Skills will be resolved and their content prepended with a separator."), + skills: tool.schema.array(tool.schema.string()).describe("Array of skill names to prepend to the prompt. Use [] if no skills needed."), }, async execute(args: SisyphusTaskArgs, toolContext) { const ctx = toolContext as ToolContextWithMetadata if (args.run_in_background === undefined) { return `❌ Invalid arguments: 'run_in_background' parameter is REQUIRED. Use run_in_background=false for task delegation, run_in_background=true only for parallel exploration.` } + if (args.skills === undefined) { + return `❌ Invalid arguments: 'skills' parameter is REQUIRED. Use skills=[] if no skills needed.` + } const runInBackground = args.run_in_background === true let skillContent: string | undefined - if (args.skills && args.skills.length > 0) { + if (args.skills.length > 0) { const { resolved, notFound } = resolveMultipleSkills(args.skills) if (notFound.length > 0) { const available = createBuiltinSkills().map(s => s.name).join(", ") diff --git a/src/tools/sisyphus-task/types.ts b/src/tools/sisyphus-task/types.ts index e1cc25b5..f60bbece 100644 --- a/src/tools/sisyphus-task/types.ts +++ b/src/tools/sisyphus-task/types.ts @@ -5,5 +5,5 @@ export interface SisyphusTaskArgs { subagent_type?: string run_in_background: boolean resume?: string - skills?: string[] + skills: string[] }