Skip to content

fix: inherit Plan mode permissions when spawning sub-agents - #6532

Closed
w0wl0lxd wants to merge 2 commits into
anomalyco:devfrom
w0wl0lxd:fix/plan-mode-subagent-permissions
Closed

fix: inherit Plan mode permissions when spawning sub-agents#6532
w0wl0lxd wants to merge 2 commits into
anomalyco:devfrom
w0wl0lxd:fix/plan-mode-subagent-permissions

Conversation

@w0wl0lxd

@w0wl0lxdw0wl0lxd commented Dec 31, 2025

Copy link
Copy Markdown

Summary

Fixes a security bypass where the model could escape Plan mode restrictions by spawning sub-agents.

Problem

When in Plan mode (read-only), the model could bypass restrictions by spawning sub-agents via the Task tool. Through reasoning/thinking or arbitrary decisions, the model could instruct sub-agents to run with full edit/write/bash permissions - completely circumventing Plan mode's safety guarantees.

Solution

  • Sub-agents from restricted parents (edit="deny") now run as Plan agent
  • Inherits Plan's bash whitelist (read-only commands: grep, ls, git status, etc.)
  • Explicitly disables edit/write tools for sub-agents
  • Throws descriptive error if Plan agent is unavailable
  • Adds comprehensive tests for Plan mode security restrictions

Testing

  • Added 7 new tests in test/tool/task.test.ts
  • All existing tests pass

Fixes#6527

@w0wl0lxd
w0wl0lxdforce-pushed the fix/plan-mode-subagent-permissions branch from fedc62c to 5a53f2fCompareDecember 31, 2025 16:15
@thoroc

Copy link
Copy Markdown

Rebase needed

@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CRITICAL Security Issue/Bug] Plan mode restrictions bypassed when spawning sub-agents

2 participants

@w0wl0lxd@thoroc