Skip to content

Subagent can call plan_exit to escape plan mode #27886

@BYK

Description

@BYK

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

  1. Enter plan mode
  2. Have the plan agent spawn a subagent via the task tool
  3. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions