Skip to content

fix(core): limit subagent nesting depth - #37124

Merged
rekram1-node merged 1 commit into
devfrom
subagent-depth
Jul 15, 2026
Merged

fix(core): limit subagent nesting depth#37124
rekram1-node merged 1 commit into
devfrom
subagent-depth

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Summary

  • add subagent_depth with a default effective limit of 1
  • reject task dispatch once the configured nesting depth is reached
  • cover the default guard and explicit nesting opt-in

Fixes#36878

Tests

  • bun test test/tool/task.test.ts
  • bun typecheck (packages/core)
  • bun typecheck (packages/sdk/js)
  • bun typecheck (packages/opencode) timed out under host contention

@thdxr
thdxr enabled auto-merge (squash) July 15, 2026 13:52
@rekram1-node
rekram1-node disabled auto-merge July 15, 2026 14:53
@rekram1-node
rekram1-node merged commit 285d315 into devJul 15, 2026
9 of 10 checks passed
@rekram1-node
rekram1-node deleted the subagent-depth branch July 15, 2026 14:53
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 17, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 20, 2026
3kaiu pushed a commit to 3kaiu/opencode-x that referenced this pull request Jul 31, 2026
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
Co-authored-by: Dax <mail@thdxr.com>
panyw5 added a commit to panyw5/opencode that referenced this pull request Aug 4, 2026
Add configurable subagent_depth (default 1) and reject nested task spawns when the parent session chain already reaches the limit, matching upstream anomalyco#37124.
banlanzs pushed a commit to banlanzs/opencode that referenced this pull request Aug 6, 2026
charlesverge pushed a commit to charlesverge/opencode that referenced this pull request Aug 11, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subagents can still recursively self-dispatch with global task permission (v1.17.20)

2 participants

@thdxr@rekram1-node