You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7a1c057
Browse filesBrowse the repository at this point in the historyBrowse files
feat(opencode): open nested subagent spawning by default up to depth 5
Depth-gate the subagent auto-denies instead of blanket-blocking every
child (T6, design-final §2/§4):
- deriveSubagentSessionPermission gains {childDepth, maxDepth}: the
task deny (plus a NEW workflow deny) is emitted only for a child AT
the maximum nesting depth; the canTask exact-match asymmetry is gone,
so the default wildcard allow suffices to spawn. Single source of the
task/todowrite/workflow auto-denies — task.ts keeps only the
experimental.primary_tools denies.
- workflow agent dispatch derives the child depth from the run
session's real lineage and guards before sessions.create; a depth
violation maps onto node `failed` like AgentLimitError and is never
swallowed by onError:"null".
- config: experimental.subagent_max_depth (PositiveInt; default 5,
2 = pre-nesting behavior, 1 = kill switch), consumed only via the
SubagentLimits.maxDepth clamp helper.
- resolve-time filter: SessionTools.resolve derives the session depth
once (shared with ask-origin attribution; lineage failure => Infinity)
and ToolRegistry.tools filters task+workflow at depth >= maxDepth —
covering the kill switch and a lowered max_depth — and appends the
depth hint to the task description on levels 2..max-1.
- task.txt documents nesting, the deepest work-only level, and the
task_id own-children-only rule.
- tests: depth-gating + deny-monotonicity property suite for the
derive helper, registry depth-filter/hint/kill-switch cases, task
child-permission pins updated (general child may now spawn; at-limit
child carries task+workflow denies), workflow depth guard + callsite
regression, subtask PIN flipped with a new at-limit case, config
parse test.
Co-Authored-By: Claude Fable 5 <[email protected]>
"Maximum subagent nesting depth (the root session is depth 1; clamped to 1..10). Default 5. Set 2 to restore the pre-nesting behavior (the root spawns, subagents do not); 1 is the kill switch that removes the task tool entirely.",
Copy file name to clipboardExpand all lines: packages/opencode/src/tool/task.txt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -17,3 +17,5 @@ Usage notes:
17
17
5. The agent's outputs should generally be trusted
18
18
6. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent. Tell it how to verify its work if possible (e.g., relevant test commands).
19
19
7. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
20
+
8. Agents may themselves delegate to deeper sub-agents. Nesting is allowed up to a configured maximum depth (your own session counts as one level; the root session is depth 1). On the deepest level this tool is not available — an agent there must do the remaining work itself and report results in its final message.
21
+
9. task_id can only resume tasks that THIS session started itself (its own direct children). Passing the id of a parent, sibling, or unrelated session fails; an unknown id starts a fresh session.
0 commit comments