Skip to content

Subagents Bypass Plan Mode READ-ONLY Restrictions #26514

@isxlan0

Description

@isxlan0

Description

Bug Report: Plan Mode Permission Bypass via Subagents

Description

In Plan Mode (READ-ONLY phase), the main agent's file editing permissions are correctly restricted, but subagents retain full file modification capabilities, creating a security bypass.

Steps to Reproduce

  1. Enable Plan Mode in opencode
  2. As the main agent, attempt to use edit or write tool → Blocked by rules
  3. Use the task tool to spawn a subagent (type: general)
  4. Instruct the subagent to use edit or write tool → Succeeds

Expected Behavior

Subagents should inherit the same READ-ONLY restrictions as the main agent when Plan Mode is active.

Actual Behavior

  • Main agent: edit/write blocked with error: "The user has specified a rule which prevents you from using this specific tool call"
  • Subagent: edit/write execute successfully, bypassing Plan Mode restrictions

Impact

This is a permission bypass vulnerability. Users enable Plan Mode to prevent unintended modifications during planning/review phase. The subagent loophole allows circumventing this safety mechanism.

Tools Affected

  • edit (file editing)
  • write (file creation)
  • Likely affects other modification tools as well

Environment

  • OS: Windows (win32)
  • Shell: PowerShell 7+

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

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