[bug] Restrict which subagents a custom agent can spawn (built-in Plan mode can write files via sub agent) #2819

Closed
opened 2026-02-16 17:37:22 -05:00 by yindo · 3 comments
Owner

Originally created by @tbarron-xyz on GitHub (Nov 12, 2025).

Original title: [FEATURE]: Restrict which subagents a custom agent can spawn

Feature hasn't been suggested before.

Describe the enhancement you want to request

My edit-disabled, task-tool-enabled custom planning agent will just spawn a subagent when it wants to edit files. I want it to have subagent capability for e.g. researching multiple things at the same time, but I want to restrict which types of subagent it can spawn. Or, ensure it can only spawn subagents with less-or-equal capabilities than itself.

Image
Originally created by @tbarron-xyz on GitHub (Nov 12, 2025). Original title: `[FEATURE]: Restrict which subagents a custom agent can spawn` ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. - Related: https://github.com/sst/opencode/issues/3808 ### Describe the enhancement you want to request My edit-disabled, task-tool-enabled custom planning agent will just spawn a subagent when it wants to edit files. I want it to have subagent capability for e.g. researching multiple things at the same time, but I want to restrict which types of subagent it can spawn. Or, ensure it can only spawn subagents with less-or-equal capabilities than itself. <img width="702" height="271" alt="Image" src="https://github.com/user-attachments/assets/92e3f37d-586c-4612-a00b-415054f032d4" />
yindo added the discussion label 2026-02-16 17:37:22 -05:00
yindo closed this issue 2026-02-16 17:37:22 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 12, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3808: Task should inherit current agent permissions/tools for MCP - This describes the same core problem where agents with restricted permissions can circumvent their limitations by delegating tasks to subagents that don't inherit the same restrictions.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 12, 2025): This issue might be a duplicate of existing issues. Please check: - #3808: Task should inherit current agent permissions/tools for MCP - This describes the same core problem where agents with restricted permissions can circumvent their limitations by delegating tasks to subagents that don't inherit the same restrictions. Feel free to ignore if none of these address your specific case.
Author
Owner

@tbarron-xyz commented on GitHub (Nov 12, 2025):

I'm changing this from a feature request to a Bug. It just happened to me on the default Plan agent (spawned a task which wrote a file). Seems like a problem that the default Plan agent can write files lol.

@tbarron-xyz commented on GitHub (Nov 12, 2025): I'm changing this from a feature request to a Bug. It just happened to me on the default Plan agent (spawned a task which wrote a file). Seems like a problem that the default Plan agent can write files lol.
Author
Owner

@NaikSoftware commented on GitHub (Nov 12, 2025):

Same issue, plan agent always trying to edit something. My plan agent config:

"agent": {
    "plan": {
      "mode": "primary",
      "model": "anthropic/claude-opus-4-1-20250805",
      "tools": {
        "write": false,
        "edit": false,
        "bash": false
      }
    }
  },

Maybe the issue is more critical and not related to subagents, because when you asked Plan agent like this "Let’s refactor..." he tries to edit code immediately instead of planning it first.

IMHO now we should focus on stability over features, because the basic usage flow has a lot of problems and a lot of regressions after migration to the new TUI. For example such a simple thing as editing Java file now very unstable, periodically broke syntax, append the same lines twice, etc. Maybe problem with jdtls, but it is one of the tens of bugs I faced in the every session when I give yet another chance to use opencode instead of claude or codex.

@NaikSoftware commented on GitHub (Nov 12, 2025): Same issue, plan agent always trying to edit something. My plan agent config: ```json "agent": { "plan": { "mode": "primary", "model": "anthropic/claude-opus-4-1-20250805", "tools": { "write": false, "edit": false, "bash": false } } }, ``` Maybe the issue is more critical and not related to subagents, because when you asked Plan agent like this "Let’s refactor..." he tries to edit code immediately instead of planning it first. IMHO now we should focus on stability over features, because the basic usage flow has a lot of problems and a lot of regressions after migration to the new TUI. For example such a simple thing as editing Java file now very unstable, periodically broke syntax, append the same lines twice, etc. Maybe problem with jdtls, but it is one of the tens of bugs I faced in the every session when I give yet another chance to use opencode instead of claude or codex.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2819