Describe the bug
Subagents spawned via the task tool can call plan_exit to escape plan mode. The tools map passed to SessionPrompt.prompt() in task.ts does not include plan_exit: false, so the deny rules set via deriveSubagentSessionPermission() are silently overwritten when the prompt function rewrites session permissions from the tools map.
Steps to reproduce
- Enter plan mode
- Have the plan agent spawn a subagent via the task tool
- The subagent can call
plan_exit and switch to build mode
Expected behavior
Subagents should not be able to call plan_exit. The tools map in the task tool should deny plan_exit for all subagent sessions.
System info
- OpenCode version: v1.15.3
- OS: Linux
Describe the bug
Subagents spawned via the
tasktool can callplan_exitto escape plan mode. Thetoolsmap passed toSessionPrompt.prompt()intask.tsdoes not includeplan_exit: false, so the deny rules set viaderiveSubagentSessionPermission()are silently overwritten when the prompt function rewrites session permissions from the tools map.Steps to reproduce
plan_exitand switch to build modeExpected behavior
Subagents should not be able to call
plan_exit. The tools map in the task tool should denyplan_exitfor all subagent sessions.System info