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

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

Originally created by @malhashemi on GitHub (Jan 12, 2026).

Originally assigned to: @thdxr on GitHub.

Description

After the permission rework in #6319, agents can no longer enable the task tool via permission frontmatter to allow nested sub-agents.

Steps to Reproduce

  1. Create an agent with permission: { task: "allow" } in frontmatter:
---
name: orchestrator
mode: subagent
permission:
  task: allow
---
  1. Call this agent via the Task tool from a primary agent
  2. The sub-agent cannot spawn other sub-agents despite having task: allow

Expected Behavior

Agents with permission: { task: "allow" } should be able to use the Task tool to spawn nested sub-agents.

Actual Behavior

The task tool is always disabled for sub-agents regardless of agent permissions.

Root Cause

In #6319, the ...agent.tools spread was removed from task.ts that previously allowed agents to override the default task: false restriction:

tools: {
  todowrite: false,
  todoread: false,
  task: false,
  ...Object.fromEntries((config.experimental?.primary_tools ?? []).map((t) => [t, false])),
- ...agent.tools,  // This was removed
},

The old agent schema had a tools: z.record(z.string(), z.boolean()) field that enabled this override. With the new permission system, this capability was lost.

Environment

  • opencode version: v1.1.15+
  • Affects: Any agent trying to use nested sub-agents
Originally created by @malhashemi on GitHub (Jan 12, 2026). Originally assigned to: @thdxr on GitHub. ## Description After the permission rework in #6319, agents can no longer enable the task tool via permission frontmatter to allow nested sub-agents. ## Steps to Reproduce 1. Create an agent with `permission: { task: "allow" }` in frontmatter: ```yaml --- name: orchestrator mode: subagent permission: task: allow --- ``` 2. Call this agent via the Task tool from a primary agent 3. The sub-agent cannot spawn other sub-agents despite having `task: allow` ## Expected Behavior Agents with `permission: { task: "allow" }` should be able to use the Task tool to spawn nested sub-agents. ## Actual Behavior The task tool is always disabled for sub-agents regardless of agent permissions. ## Root Cause In #6319, the `...agent.tools` spread was removed from `task.ts` that previously allowed agents to override the default `task: false` restriction: ```diff tools: { todowrite: false, todoread: false, task: false, ...Object.fromEntries((config.experimental?.primary_tools ?? []).map((t) => [t, false])), - ...agent.tools, // This was removed }, ``` The old agent schema had a `tools: z.record(z.string(), z.boolean())` field that enabled this override. With the new permission system, this capability was lost. ## Environment - opencode version: v1.1.15+ - Affects: Any agent trying to use nested sub-agents
yindo closed this issue 2026-02-16 17:49:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5126