Skip to content

[FEATURE]: Document infinite subagent recursion risk when permission.task is set globally #17722

Closed as not planned

Description

@coygeek

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The problem: Adding "task": "allow" to the global permission block silently enables infinite subagent recursion. There's no depth limit in the codebase — subagents spawn subagents indefinitely, each with its own steps counter and context window. I hit 10 levels of nesting and 3+ hours of runaway token usage before noticing.

Why it's a trap: The default "*": "allow" wildcard does NOT trigger this — only an explicit "task" key does. So adding "task": "allow" alongside other permissions like "bash": "allow" seems harmless but completely overrides the built-in nesting guard in task.ts:

const hasTaskPermission = agent.permission.some((rule) => rule.permission === "task")

Neither steps (per-session counter, each child gets its own) nor doom_loop (single-session detection) protect against this.

The ask: Add warnings to the docs:

  1. Agents docs (permission.task section): Warn that global/subagent-level task permissions enable unlimited recursive nesting. Show safe vs unsafe patterns.
  2. Permissions docs (task entry): Note that global "task": "allow" propagates to all agents including subagents.
  3. Config docs (permissions section): Brief caution about "task": "allow" being different from other permissions.

I'm happy to submit a docs PR for this — just want to confirm the approach is welcome first.

Related issues:

Activity

  1. added a commit that references this issue on Mar 16, 2026
    3cfad38
  2. github-actions commented on Mar 16, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to existing issues. Please check:

  3. github-actions commented on Jul 7, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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