From fecc4888483b6b25cff26c5d7caab0ceb55f102f Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 9 Feb 2026 23:42:14 +0900 Subject: [PATCH] fix(sisyphus-junior): disambiguate blocked delegation tool from allowed task management tools When task_system is enabled, the prompt said 'task tool: BLOCKED' which LLMs interpreted as blocking task_create/task_update/task_list/task_get too. Now the constraints section explicitly separates 'task (agent delegation tool): BLOCKED' from 'task_create, task_update, ...: ALLOWED' so Junior no longer refuses to use task management tools. --- src/agents/sisyphus-junior/default.ts | 32 +++++++++++---- src/agents/sisyphus-junior/gpt.ts | 51 ++++++++++++++++++------ src/agents/sisyphus-junior/index.test.ts | 42 +++++++++++++++++++ 3 files changed, 105 insertions(+), 20 deletions(-) diff --git a/src/agents/sisyphus-junior/default.ts b/src/agents/sisyphus-junior/default.ts index 95cce6078..fea9e7150 100644 --- a/src/agents/sisyphus-junior/default.ts +++ b/src/agents/sisyphus-junior/default.ts @@ -12,6 +12,7 @@ export function buildDefaultSisyphusJuniorPrompt( promptAppend?: string ): string { const todoDiscipline = buildTodoDisciplineSection(useTaskSystem) + const constraintsSection = buildConstraintsSection(useTaskSystem) const verificationText = useTaskSystem ? "All tasks marked completed" : "All todos marked completed" @@ -21,13 +22,7 @@ Sisyphus-Junior - Focused executor from OhMyOpenCode. Execute tasks directly. NEVER delegate or spawn other agents. - -BLOCKED ACTIONS (will fail if attempted): -- task tool: BLOCKED - -ALLOWED: call_omo_agent - You CAN spawn explore/librarian agents for research. -You work ALONE for implementation. No delegation of implementation tasks. - +${constraintsSection} ${todoDiscipline} @@ -48,6 +43,29 @@ Task NOT complete without: return prompt + "\n\n" + promptAppend } +function buildConstraintsSection(useTaskSystem: boolean): string { + if (useTaskSystem) { + return ` +BLOCKED ACTIONS (will fail if attempted): +- task (agent delegation tool): BLOCKED — you cannot delegate work to other agents + +ALLOWED tools: +- call_omo_agent: You CAN spawn explore/librarian agents for research +- task_create, task_update, task_list, task_get: ALLOWED — use these for tracking your work + +You work ALONE for implementation. No delegation of implementation tasks. +` + } + + return ` +BLOCKED ACTIONS (will fail if attempted): +- task (agent delegation tool): BLOCKED — you cannot delegate work to other agents + +ALLOWED: call_omo_agent - You CAN spawn explore/librarian agents for research. +You work ALONE for implementation. No delegation of implementation tasks. +` +} + function buildTodoDisciplineSection(useTaskSystem: boolean): string { if (useTaskSystem) { return ` diff --git a/src/agents/sisyphus-junior/gpt.ts b/src/agents/sisyphus-junior/gpt.ts index 03653ba0a..e4a849651 100644 --- a/src/agents/sisyphus-junior/gpt.ts +++ b/src/agents/sisyphus-junior/gpt.ts @@ -21,6 +21,7 @@ export function buildGptSisyphusJuniorPrompt( promptAppend?: string ): string { const taskDiscipline = buildGptTaskDisciplineSection(useTaskSystem) + const blockedActionsSection = buildGptBlockedActionsSection(useTaskSystem) const verificationText = useTaskSystem ? "All tasks marked completed" : "All todos marked completed" @@ -45,19 +46,7 @@ Role: Execute tasks directly. You work ALONE. - Do NOT expand task boundaries beyond what's written. - -BLOCKED (will fail if attempted): -| Tool | Status | -|------|--------| -| task | BLOCKED | - -ALLOWED: -| Tool | Usage | -|------|-------| -| call_omo_agent | Spawn explore/librarian for research ONLY | - -You work ALONE for implementation. No delegation. - +${blockedActionsSection} - If a task is ambiguous or underspecified: @@ -99,6 +88,42 @@ Task NOT complete without evidence: return prompt + "\n\n" + promptAppend } +function buildGptBlockedActionsSection(useTaskSystem: boolean): string { + if (useTaskSystem) { + return ` +BLOCKED (will fail if attempted): +| Tool | Status | Description | +|------|--------|-------------| +| task | BLOCKED | Agent delegation tool — you cannot spawn other agents | + +ALLOWED: +| Tool | Usage | +|------|-------| +| call_omo_agent | Spawn explore/librarian for research ONLY | +| task_create | Create tasks to track your work | +| task_update | Update task status (in_progress, completed) | +| task_list | List active tasks | +| task_get | Get task details by ID | + +You work ALONE for implementation. No delegation. +` + } + + return ` +BLOCKED (will fail if attempted): +| Tool | Status | Description | +|------|--------|-------------| +| task | BLOCKED | Agent delegation tool — you cannot spawn other agents | + +ALLOWED: +| Tool | Usage | +|------|-------| +| call_omo_agent | Spawn explore/librarian for research ONLY | + +You work ALONE for implementation. No delegation. +` +} + function buildGptTaskDisciplineSection(useTaskSystem: boolean): string { if (useTaskSystem) { return ` diff --git a/src/agents/sisyphus-junior/index.test.ts b/src/agents/sisyphus-junior/index.test.ts index d574f57ca..748d89245 100644 --- a/src/agents/sisyphus-junior/index.test.ts +++ b/src/agents/sisyphus-junior/index.test.ts @@ -238,6 +238,48 @@ describe("createSisyphusJuniorAgentWithOverrides", () => { expect(result.prompt).toContain("todowrite") expect(result.prompt).not.toContain("TaskCreate") }) + + test("useTaskSystem=true explicitly lists task management tools as ALLOWED for Claude", () => { + //#given + const override = { model: "anthropic/claude-sonnet-4-5" } + + //#when + const result = createSisyphusJuniorAgentWithOverrides(override, undefined, true) + + //#then - prompt must disambiguate: delegation tool blocked, management tools allowed + expect(result.prompt).toContain("task_create") + expect(result.prompt).toContain("task_update") + expect(result.prompt).toContain("task_list") + expect(result.prompt).toContain("task_get") + expect(result.prompt).toContain("agent delegation tool") + }) + + test("useTaskSystem=true explicitly lists task management tools as ALLOWED for GPT", () => { + //#given + const override = { model: "openai/gpt-5.2" } + + //#when + const result = createSisyphusJuniorAgentWithOverrides(override, undefined, true) + + //#then - prompt must disambiguate: delegation tool blocked, management tools allowed + expect(result.prompt).toContain("task_create") + expect(result.prompt).toContain("task_update") + expect(result.prompt).toContain("task_list") + expect(result.prompt).toContain("task_get") + expect(result.prompt).toContain("Agent delegation tool") + }) + + test("useTaskSystem=false does NOT list task management tools in constraints", () => { + //#given - Claude model without task system + const override = { model: "anthropic/claude-sonnet-4-5" } + + //#when + const result = createSisyphusJuniorAgentWithOverrides(override, undefined, false) + + //#then - no task management tool references in constraints section + expect(result.prompt).not.toContain("task_create") + expect(result.prompt).not.toContain("task_update") + }) }) describe("prompt composition", () => {