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
commit 89e251da72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 mockManager = { launch: async () => ({}) }
const mockClient = {
app: { agents: async () => ({ data: [] }) },
config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) },
session: {
create: async () => ({ data: { id: "test-session" } }),
prompt: async () => ({ data: {} }),
promptAsync: async () => ({ data: {} }),
messages: async () => ({ data: [] }),
},
}
const tool = createDelegateTask({ const promptMock = async (input: any) => {
manager: mockManager, promptBody = input.body
client: mockClient, return { data: {} }
}) }
const toolContext = { const mockClient = {
sessionID: "parent-session", app: { agents: async () => ({ data: [] }) },
messageID: "parent-message", config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) },
agent: "sisyphus", session: {
abort: new AbortController().signal, get: async () => ({ data: { directory: "/project" } }),
} create: async () => ({ data: { id: "ses_default_skills" } }),
prompt: promptMock,
promptAsync: promptMock,
messages: async () => ({
data: [{ info: { role: "assistant" }, parts: [{ type: "text", text: "Done" }] }]
}),
status: async () => ({ data: {} }),
},
}
// when - skills not provided (undefined) const tool = createDelegateTask({
// then - should throw error about missing skills manager: mockManager,
await expect(tool.execute( client: mockClient,
{ })
description: "Test task",
prompt: "Do something", const toolContext = {
category: "ultrabrain", sessionID: "parent-session",
run_in_background: false, messageID: "parent-message",
}, agent: "sisyphus",
toolContext abort: new AbortController().signal,
)).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.`)