Merge pull request #1645 from code-yeongyu/fix/load-skills-default-1493

fix: add default value for load_skills parameter in task tool (#1493)
This commit is contained in:
YeonGyu-Kim
2026-02-08 14:07:08 +09:00
committed by GitHub
2 changed files with 53 additions and 40 deletions

View File

@@ -849,46 +849,59 @@ describe("sisyphus-task", () => {
}) })
describe("skills parameter", () => { describe("skills parameter", () => {
test("skills parameter is required - throws error when not provided", async () => { test("load_skills defaults to empty array when not provided (undefined)", async () => {
// given // given
const { createDelegateTask } = require("./tools") const { createDelegateTask } = require("./tools")
let promptBody: any
const mockManager = { launch: async () => ({}) }
const mockClient = { const mockManager = { launch: async () => ({}) }
app: { agents: async () => ({ data: [] }) },
config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) }, const promptMock = async (input: any) => {
session: { promptBody = input.body
create: async () => ({ data: { id: "test-session" } }), return { data: {} }
prompt: async () => ({ data: {} }), }
promptAsync: async () => ({ data: {} }),
messages: async () => ({ data: [] }), const mockClient = {
}, app: { agents: async () => ({ data: [] }) },
} config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) },
session: {
const tool = createDelegateTask({ get: async () => ({ data: { directory: "/project" } }),
manager: mockManager, create: async () => ({ data: { id: "ses_default_skills" } }),
client: mockClient, prompt: promptMock,
}) promptAsync: promptMock,
messages: async () => ({
const toolContext = { data: [{ info: { role: "assistant" }, parts: [{ type: "text", text: "Done" }] }]
sessionID: "parent-session", }),
messageID: "parent-message", status: async () => ({ data: {} }),
agent: "sisyphus", },
abort: new AbortController().signal, }
}
const tool = createDelegateTask({
// when - skills not provided (undefined) manager: mockManager,
// then - should throw error about missing skills client: mockClient,
await expect(tool.execute( })
{
description: "Test task", const toolContext = {
prompt: "Do something", sessionID: "parent-session",
category: "ultrabrain", messageID: "parent-message",
run_in_background: false, agent: "sisyphus",
}, abort: new AbortController().signal,
toolContext }
)).rejects.toThrow("IT IS HIGHLY RECOMMENDED")
}) // when - load_skills not provided (undefined) - should default to []
await tool.execute(
{
description: "Test task",
prompt: "Do something",
category: "ultrabrain",
run_in_background: false,
},
toolContext
)
// then - should proceed without error, prompt should be called
expect(promptBody).toBeDefined()
}, { timeout: 20000 })
test("null skills throws error", async () => { test("null skills throws error", async () => {
// given // given

View File

@@ -74,7 +74,7 @@ Prompts MUST be in English.`
return tool({ return tool({
description, description,
args: { args: {
load_skills: tool.schema.array(tool.schema.string()).describe("Skill names to inject. REQUIRED - pass [] if no skills needed, but IT IS HIGHLY RECOMMENDED to pass proper skills like [\"playwright\"], [\"git-master\"] for best results."), load_skills: tool.schema.array(tool.schema.string()).default([]).describe("Skill names to inject. Pass [] if no skills needed, but IT IS HIGHLY RECOMMENDED to pass proper skills like [\"playwright\"], [\"git-master\"] for best results."),
description: tool.schema.string().describe("Short task description (3-5 words)"), description: tool.schema.string().describe("Short task description (3-5 words)"),
prompt: tool.schema.string().describe("Full detailed prompt for the agent"), prompt: tool.schema.string().describe("Full detailed prompt for the agent"),
run_in_background: tool.schema.boolean().describe("true=async (returns task_id), false=sync (waits). Default: false"), run_in_background: tool.schema.boolean().describe("true=async (returns task_id), false=sync (waits). Default: false"),
@@ -97,7 +97,7 @@ Prompts MUST be in English.`
throw new Error(`Invalid arguments: 'run_in_background' parameter is REQUIRED. Use run_in_background=false for task delegation, run_in_background=true only for parallel exploration.`) throw new Error(`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.load_skills === undefined) { if (args.load_skills === undefined) {
throw new Error(`Invalid arguments: 'load_skills' parameter is REQUIRED. Pass [] if no skills needed, but IT IS HIGHLY RECOMMENDED to pass proper skills like ["playwright"], ["git-master"] for best results.`) args.load_skills = []
} }
if (args.load_skills === null) { if (args.load_skills === null) {
throw new Error(`Invalid arguments: load_skills=null is not allowed. Pass [] if no skills needed, but IT IS HIGHLY RECOMMENDED to pass proper skills.`) throw new Error(`Invalid arguments: load_skills=null is not allowed. Pass [] if no skills needed, but IT IS HIGHLY RECOMMENDED to pass proper skills.`)