Skip to content

General's built-in subagent deny makes experimental.subagent_depth ineffective for General #60961

Open

Description

@pascalandr

Description

experimental.subagent_depth controls how deep subagents can nest, but the built-in agent plugin also denies the subagent tool to General (packages/core/src/plugin/agent.ts). Raising the depth therefore does nothing for General, the default worker most delegations use. Users also have to find a second setting and allow subagent for General in their agent config.

The deny was added on 2026-06-30 (c26f6f9, "deny subagent tool for default subagents"), two weeks before the depth limit (#37124). At the default depth of 1 it is redundant, since the depth check already stops a subagent from starting another one. Its only remaining effect at depth 1 is hiding the tool, which avoids the failing calls described in #53356.

Proposal

  1. Fix subagent: tool remains advertised at the maximum session depth #53356: don't offer the subagent tool when the session is at the depth limit.
  2. Then remove the subagent deny from General, so subagent_depth is the single control.

The default behavior stays the same: at depth 1, only the primary agent delegates. Raising the depth then works without a second setting, and users who never want General to delegate can still deny it in their config.

Related: #53356, #59826, #50539.

OpenCode 2.2.5

Activity

  1. opencodejr commented on Oct 31, 2026

    @opencodejr

    Thanks for the clear write-up, @pascalandr!

    The request: once the subagent tool is no longer offered at the depth limit (#53356), drop the built-in subagent deny from General so that experimental.subagent_depth is the only setting that controls nesting. Today the deny in packages/core/src/plugin/agent.ts is deliberate, so this is a change to the defaults rather than a bug. Maintainers will consider it.

    Until then, as you mention, raising subagent_depth and allowing subagent for General in your agent config gives the nested behaviour.

    Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions