Skip to content

specialist: no hard maximum depth limit on Task / nested specialists #470

Description

@euxaristia

Problem

Specialist / Task tool nesting has no hard upper bound.

// internal/specialist/exec.go
if options.CurrentDepth < 0 { ... }
// then always:
args = append(..., "--depth", strconv.Itoa(input.CurrentDepth+1), ...)

Only a negative check. Depth is just metadata passed down to child zero processes.

Impact

  • A specialist (or the model) can recursively spawn more specialists indefinitely.
  • Leads to process explosion, high CPU/memory, stack overflow, or runaway costs.
  • No protection against accidental or adversarial deep recursion.

Suggested fix

  • Add a hard MaxDepth (e.g. 5-8) in TaskRunOptions / Executor.Run / swarm launcher.
  • Return clear error when exceeded.
  • Document and expose via CLI flag if needed.
  • Consider a global per-run limit in the main agent loop.

Activity

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