fix: Sub-Agents permission override#21533
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, I found a potentially related PR: Related PR:
This PR appears to address a very similar issue - propagating parent agent permissions to subagent child sessions. Since your current PR (21533) is also focused on inheriting parent session permissions when creating child sessions in sub-agents, this older PR may already have attempted to solve this problem or provide relevant context. You may want to review PR #12584 to understand:
|
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
fix: Sub-Agents permissions override
Plan mode restrictions bypassed when spawning sub-agents
Fixes #6527
Flow
Parent agent in Plan mode spawns sub-agent
Sub-agent can edit files despite parent being in Plan mode
Plan mode stores edit: deny on the session level, not the agent. The session has the actual runtime permissions, while the agent has the default config.
Our fix:
In
task.ts, we get parent permissions and pass them to child session creationIn
prompt.tswe ensure the permissions get merged - not replaced withinput.toolsflagType of change
What does this PR do?
Fixes sub-agent permission bypass: when spawning sub-agents from Plan mode, they now inherit the parent session's permissions (including
edit: deny). Previously, sub-agents ran with full permissions and could edit files despite Plan mode being active.Changes:
How did you verify your code works?
bun devon the repository to verify the project buildScreenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
bun devIf you do not follow this template your PR will be automatically rejected.