-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
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
- Add a custom agent with permissive rules to
opencode.json:{ "agent": { "auto": { "description": "Autonomous mode with full permissions", "mode": "primary", "permission": "allow" } } } - Switch to the
autoagent - Perform a task that triggers a subagent (e.g., TaskTool spawning
exploreorgeneral) - 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