Skip to content

Conversation

@malhashemi
Copy link
Contributor

@malhashemi malhashemi commented Jan 13, 2026

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

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

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

Based on my search, I found several related PRs that address similar concerns around task tool permissions and sub-agent functionality:

Potentially Related PRs:

  1. feat(task): Add configurable subagent-to-subagent task delegation with budgets, and persistent sessions #7756 - "feat(task): Add configurable subagent-to-subagent task delegation with budgets, and persistent sessions"

    • Directly related to task delegation and sub-agent configuration
  2. feat(agent): add subagents config for per-agent task tool filtering #7271 - "feat(agent): add subagents config for per-agent task tool filtering"

    • Addresses per-agent task tool filtering, which is closely related to your permission-based fix
  3. fix: inherit Plan mode permissions when spawning sub-agents #6532 - "fix: inherit Plan mode permissions when spawning sub-agents"

    • Related to permission inheritance when spawning sub-agents
  4. Permission revamp docs + new API endpoints #6612 - "Permission revamp docs + new API endpoints"

  5. feat(tui): fire-and-forget async subagent tasks #7206 - "feat(tui): fire-and-forget async subagent tasks"

    • Involves subagent task handling

These PRs all touch on the intersection of agent permissions, task tools, and sub-agent functionality. You may want to review them to ensure your fix doesn't conflict with or duplicate any ongoing work in these areas.

The permission rework in anomalyco#6319 removed the ability to override the default
task tool restriction via agent frontmatter.

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.
If not specified, the default deny behavior is preserved.
@malhashemi malhashemi force-pushed the fix/restore-nested-subagent-permission branch from 3b361db to 94eb30b Compare January 13, 2026 02:27
@malhashemi malhashemi changed the title fix(task): restore ability to enable task tool via agent permission fix(task): respect agent task permission for nested sub-agents Jan 13, 2026
@rekram1-node rekram1-node merged commit 5d37e58 into anomalyco:dev Jan 13, 2026
4 checks passed
@malhashemi malhashemi deleted the fix/restore-nested-subagent-permission branch January 13, 2026 11:14
sauerdaniel pushed a commit to sauerdaniel/opencode that referenced this pull request Jan 13, 2026
dl-alexandre pushed a commit to dl-alexandre/opencode that referenced this pull request Jan 13, 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.

Task tool permission override no longer works for nested sub-agents

2 participants