Skip to content

fix: Sub-Agent permissions override#21540

Closed
nightguarder wants to merge 2 commits intoanomalyco:devfrom
nightguarder:fix/6527-subagent-permissions
Closed

fix: Sub-Agent permissions override#21540
nightguarder wants to merge 2 commits intoanomalyco:devfrom
nightguarder:fix/6527-subagent-permissions

Conversation

@nightguarder
Copy link
Copy Markdown

@nightguarder nightguarder commented Apr 8, 2026

fix: Sub-Agents permissions override

Plan mode restrictions bypassed when spawning sub-agents

Fixes #6527

Closes #6527

Type of change

  • Bug fix

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:

  1. task.ts: Inherit parent session permissions when creating child session
  2. In task.ts, we get parent permissions and pass them to child session creation
  3. prompt.ts: Merge existing session permissions with tools flags instead of replacing
  4. In prompt.ts we ensure the permissions get merged - not replaced with input.tools flag

How did you verify your code works?

  • Code compiles and follows existing patterns
  • Follows the same permission merge logic used elsewhere in the codebase

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one highly related PR that addresses the same issue:

Potential Duplicate:

Related PRs (not duplicates, but similar scope):

Recommend checking PR #12584 to ensure this PR isn't addressing the same fix that was already attempted.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 8, 2026
@github-actions github-actions bot closed this Apr 8, 2026
Sign up for free to 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

1 participant