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.
This commit is contained in:
@@ -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.
|
||||
</Role>
|
||||
|
||||
<Critical_Constraints>
|
||||
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.
|
||||
</Critical_Constraints>
|
||||
${constraintsSection}
|
||||
|
||||
${todoDiscipline}
|
||||
|
||||
@@ -48,6 +43,29 @@ Task NOT complete without:
|
||||
return prompt + "\n\n" + promptAppend
|
||||
}
|
||||
|
||||
function buildConstraintsSection(useTaskSystem: boolean): string {
|
||||
if (useTaskSystem) {
|
||||
return `<Critical_Constraints>
|
||||
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.
|
||||
</Critical_Constraints>`
|
||||
}
|
||||
|
||||
return `<Critical_Constraints>
|
||||
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.
|
||||
</Critical_Constraints>`
|
||||
}
|
||||
|
||||
function buildTodoDisciplineSection(useTaskSystem: boolean): string {
|
||||
if (useTaskSystem) {
|
||||
return `<Task_Discipline>
|
||||
|
||||
@@ -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.
|
||||
</scope_and_design_constraints>
|
||||
|
||||
<blocked_actions>
|
||||
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.
|
||||
</blocked_actions>
|
||||
${blockedActionsSection}
|
||||
|
||||
<uncertainty_and_ambiguity>
|
||||
- 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_actions>
|
||||
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.
|
||||
</blocked_actions>`
|
||||
}
|
||||
|
||||
return `<blocked_actions>
|
||||
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.
|
||||
</blocked_actions>`
|
||||
}
|
||||
|
||||
function buildGptTaskDisciplineSection(useTaskSystem: boolean): string {
|
||||
if (useTaskSystem) {
|
||||
return `<task_discipline_spec>
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user