Skip to content

Subagents don’t respect "*": "allow" agent permissions #12566

@brittlewis12

Description

@brittlewis12

Description

Custom agent permission rules don't propagate to subagents spawned via TaskTool. When a custom primary agent is configured with "permission": "allow" (for unattended/autonomous use), subagents spawned by that agent do not inherit the parent's permissive rules. Any tool call in the subagent that evaluates to "ask" will block indefinitely since there's no human to respond.

The root cause is in packages/opencode/src/session/prompt.ts:416:

ruleset: PermissionNext.merge(taskAgent.permission, session.permission ?? [])

ruleset: PermissionNext.merge(taskAgent.permission, session.permission ?? []),

This merges the subagent's built-in permission ruleset with the child session's permission — neither of which includes the parent agent's permission rules. The child session created at packages/opencode/src/tool/task.ts:72-101 only receives hard-coded deny rules for todowrite, todoread, and optionally task — it never inherits the parent agent's or parent session's permission configuration.

Plugins

n/a

OpenCode version

1.1.53

Steps to reproduce

  1. Add a custom agent with permissive rules to opencode.json:
    {
      "agent": {
        "auto": {
          "description": "Autonomous mode with full permissions",
          "mode": "primary",
          "permission": "allow"
        }
      }
    }
  2. Switch to the auto agent
  3. Perform a task that triggers a subagent (e.g., TaskTool spawning explore or general)
  4. The subagent hits a permission prompt (e.g., bash command matching "ask") and blocks forever

Expected behavior: The subagent should inherit the parent agent's "allow" permission, or the parent session's permission rules should propagate to the child session so the merged ruleset at prompt.ts:416 includes them.

Screenshot and/or share link

No response

Operating System

macos 15.7.1

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions