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
Task tool ignores per-target deny and allows self-dispatch recursion #11324
Task tool ignores per-target deny rules and allows an agent to dispatch itself. This enables recursive subagent spawning (self-dispatch loop) even when permission.task denies that target.
Steps to reproduce
Define an agent sre with task permission allowing * but denying sre as a target.
The core issue appears to be that the task tool systematically ignores configured permission rules. The most relevant are #7474 (nearly identical - ignoring per-target permissions) and #6527 (same root cause - restrictions ignored).
Feel free to ignore if your specific case isn't addressed by these issues.
I inspected packages/opencode/src/tool/task.ts (lines ~23-60). Root cause: per-target deny is only used to filter the tool description (accessibleAgents). The execute path does not enforce it and proceeds to Agent.get even when PermissionNext.evaluate("task", params.subagent_type, caller.permission) is deny.
Suggestion (treat deny as not existing): add a guard in execute before Agent.get:
if(ctx.agent&&PermissionNext.evaluate("task",params.subagent_type,ctx.agent.permission).action==="deny"){thrownewError(`Unknown agent type: ${params.subagent_type} is not a valid agent type`)}
This keeps denied targets hidden and prevents self-dispatch loops (e.g., @sre -> task(subagent_type: "sre")).
Activity
github-actions commentedon Jan 30, 2026
This issue might be a duplicate of existing issues. Please check:
The core issue appears to be that the task tool systematically ignores configured permission rules. The most relevant are #7474 (nearly identical - ignoring per-target permissions) and #6527 (same root cause - restrictions ignored).
Feel free to ignore if your specific case isn't addressed by these issues.
HyunggyuJang commentedon Jan 30, 2026
I inspected
packages/opencode/src/tool/task.ts(lines ~23-60). Root cause: per-target deny is only used to filter the tool description (accessibleAgents). The execute path does not enforce it and proceeds toAgent.geteven whenPermissionNext.evaluate("task", params.subagent_type, caller.permission)isdeny.Suggestion (treat deny as not existing): add a guard in execute before
Agent.get:This keeps denied targets hidden and prevents self-dispatch loops (e.g., @sre -> task(subagent_type: "sre")).
github-actions commentedon Apr 1, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.