Subagent can call plan_exit to escape plan mode #27886
Copy link
Copy link
Closed as not planned
Description
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_exitand 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Jul 16, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.