[PR #8111] fix(task): respect agent task permission for nested sub-agents #12628

Closed
opened 2026-02-16 18:17:31 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8111

State: closed
Merged: Yes


Fixes #8114

What does this PR do?

Restores the ability for agents to control the task tool via permission frontmatter.

The permission rework in #6319 removed the ...agent.tools spread that allowed agents to override the default task: false. This fix checks if the agent has any task permission rule defined - if so, we don't add our default deny, letting the agent's permission take effect.

Examples:

  • permission: { task: allow } → can spawn any sub-agent
  • permission: { task: { researcher: allow } } → can only spawn researcher
  • permission: { task: deny } → explicitly denied
  • No task permission → default deny (unchanged behavior)

How did you verify your code works?

  • bun test task - 21 tests pass
  • bun test permission - 82 tests pass
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8111 **State:** closed **Merged:** Yes --- Fixes #8114 ### What does this PR do? Restores the ability for agents to control the task tool via permission frontmatter. The permission rework in #6319 removed the `...agent.tools` spread that allowed agents to override the default `task: false`. This fix checks if the agent has any task permission rule defined - if so, we don't add our default deny, letting the agent's permission take effect. **Examples:** - `permission: { task: allow }` → can spawn any sub-agent - `permission: { task: { researcher: allow } }` → can only spawn researcher - `permission: { task: deny }` → explicitly denied - No task permission → default deny (unchanged behavior) ### How did you verify your code works? - `bun test task` - 21 tests pass - `bun test permission` - 82 tests pass
yindo added the pull-request label 2026-02-16 18:17:31 -05:00
yindo closed this issue 2026-02-16 18:17:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12628