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,19 +849,30 @@ 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 promptMock = async (input: any) => {
promptBody = input.body
return { data: {} }
}
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: {
create: async () => ({ data: { id: "test-session" } }), get: async () => ({ data: { directory: "/project" } }),
prompt: async () => ({ data: {} }), create: async () => ({ data: { id: "ses_default_skills" } }),
promptAsync: async () => ({ data: {} }), prompt: promptMock,
messages: async () => ({ data: [] }), promptAsync: promptMock,
messages: async () => ({
data: [{ info: { role: "assistant" }, parts: [{ type: "text", text: "Done" }] }]
}),
status: async () => ({ data: {} }),
}, },
} }
@ -877,9 +888,8 @@ describe("sisyphus-task", () => {
abort: new AbortController().signal, abort: new AbortController().signal,
} }
// when - skills not provided (undefined) // when - load_skills not provided (undefined) - should default to []
// then - should throw error about missing skills await tool.execute(
await expect(tool.execute(
{ {
description: "Test task", description: "Test task",
prompt: "Do something", prompt: "Do something",
@ -887,8 +897,11 @@ describe("sisyphus-task", () => {
run_in_background: false, run_in_background: false,
}, },
toolContext toolContext
)).rejects.toThrow("IT IS HIGHLY RECOMMENDED") )
})
// 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.`)