You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
V2 subagent tool does not enforce per-target subagent permissions #35238
In V2, the subagent tool only has coarse whole-tool visibility filtering. Per-target rules such as allowing only one subagent are not reflected in the model-facing tool definition and are not enforced when the tool executes.
Current behavior
ToolRegistry.materialize(...) can hide the entire subagent tool when the active agent has a whole-tool deny such as subagent:*.
packages/core/src/tool/subagent.ts checks that the requested target agent exists and is not mode: "primary".
It does not call PermissionV2.assert({ action: "subagent", resources: [input.agent], ... }) before spawning the child session.
The subagent tool schema/description does not expose a filtered list of subagents allowed by the active agent.
Expected behavior
If an agent is configured to only invoke a subset of subagents, for example only explore, V2 should either:
expose only those allowed target subagents to the model, and
reject execution for disallowed targets with a clear permission error,
or otherwise document a different explicit policy. The current behavior makes per-target subagent permission rules ineffective as a runtime boundary.
Why this matters
An agent configured with narrow subagent permissions can still call another configured non-primary agent if it knows or guesses the name. This is different from the intended permission model and makes V2 subagent delegation harder to reason about.
I’m working on a focused V2 fix. Current v2 already has runtime PermissionV2.assert enforcement from #35794, but the per-agent model-facing subagent list was removed with the session request hook in 761f373. I’m restoring the filtered list through the current instruction-guidance path (without reintroducing the removed public hook), and adding coverage for target-specific deny/allow behavior.
yes, I can confirm this issue, I deny all task permissions but for one specific agent in one of my agents. When I accidentally instructed it to update something that can only be done by an agent that is not whitelisted, it still went through and instructed such agent to do the changes for me.
The V2 subagent tool enforces per-target permissions. The list of subagents shown to the model leaves out any target the agent's permissions deny, and each call checks subagent permission for that specific target.
The current implementation is in tool/plugin/subagent.ts (#35794).
Activity
tlysanhuo commentedon Jul 11, 2026
I’m working on a focused V2 fix. Current
v2already has runtimePermissionV2.assertenforcement from #35794, but the per-agent model-facing subagent list was removed with the session request hook in761f373. I’m restoring the filtered list through the current instruction-guidance path (without reintroducing the removed public hook), and adding coverage for target-specific deny/allow behavior.martin-braun commentedon Aug 6, 2026
yes, I can confirm this issue, I deny all task permissions but for one specific agent in one of my agents. When I accidentally instructed it to update something that can only be done by an agent that is not whitelisted, it still went through and instructed such agent to do the changes for me.
686f6c61 commentedon Aug 7, 2026
I'll take this: enforce per-target subagent permissions in the V2 subagent tool (assert + filtered target list for the model).
fix: address 5 more community-reported issues
neriousy commentedon Oct 1, 2026
The V2 subagent tool enforces per-target permissions. The list of subagents shown to the model leaves out any target the agent's permissions deny, and each call checks
subagentpermission for that specific target.The current implementation is in
tool/plugin/subagent.ts(#35794).Closing as completed.