feat(delegate): orchestrator role and configurable spawn depth (default flat)#13691
Merged
Conversation
…lt flat) Adds role='leaf'|'orchestrator' to delegate_task. With max_spawn_depth>=2, an orchestrator child retains the 'delegation' toolset and can spawn its own workers; leaf children cannot delegate further (identical to today). Default posture is flat — max_spawn_depth=1 means a depth-0 parent's children land at the depth-1 floor and orchestrator role silently degrades to leaf. Users opt into nested delegation by raising max_spawn_depth to 2 or 3 in config.yaml. Also threads acp_command/acp_args through the main agent loop's delegate dispatch (previously silently dropped in the schema) via a new _dispatch_delegate_task helper, and adds a DelegateEvent enum with legacy-string back-compat for gateway/ACP/CLI progress consumers. Config (hermes_cli/config.py defaults): delegation.max_concurrent_children: 3 # floor-only, no upper cap delegation.max_spawn_depth: 1 # 1=flat (default), 2-3 unlock nested delegation.orchestrator_enabled: true # global kill switch Salvaged from @pefontana's PR #11215. Overrides vs. the original PR: concurrency stays at 3 (PR bumped to 5 + cap 8 — we keep the floor only, no hard ceiling); max_spawn_depth defaults to 1 (PR defaulted to 2 which silently enabled one level of orchestration for every user). Co-authored-by: pefontana <fontana.pedro93@gmail.com>
9 tasks
Collaborator
|
Supersedes #11215 with flat-by-default posture (max_spawn_depth=1 vs original's 2). |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
role="leaf"|"orchestrator"ondelegate_task. Whendelegation.max_spawn_depth >= 2, an orchestrator child retains thedelegationtoolset and can spawn its own workers. Default stays flat (depth 1 = current behavior) — users opt in by raisingmax_spawn_depthin config.yaml.Also fixes a silent drop of
acp_command/acp_argson the main agent loop's delegate path, and adds aDelegateEventenum with legacy-string back-compat for gateway/ACP/CLI progress consumers.Salvaged from @pefontana's #11215 with these deliberate overrides:
max_concurrent_childrendefaultmax_spawn_depthdefaultmax_spawn_depthrangeChanges
tools/delegate_tool.py:roleparam on schema +delegate_task()signature;_dispatch_delegate_taskhelper (fixes acp_args drop);_build_child_agentdegrades role to leaf when depth >=max_spawn_depthOR the kill switch is off; role-aware system prompt;DelegateEventenum +_LEGACY_EVENT_MAP+_build_child_progress_callbackaccepts enum + new-style strings + legacy strings; dedicatedTASK_PROGRESSrender branch (no more misrendering batched summaries as tool names).hermes_cli/config.pydefaults:max_concurrent_children: 3,max_spawn_depth: 1,orchestrator_enabled: true.cli-config.yaml.example,website/docs/user-guide/features/delegation.md,guides/delegation-patterns.md,features/overview.md,hermes_cli/tips.py: docs + example config updated to match the flat-by-default posture.max_spawn_depth: 2in their mock config since the default is now flat).Validation
py_compileon all changed filespytest tests/tools/test_delegate.py tests/hermes_cli/test_config_drift.py tests/agent/test_subagent_progress.pydelegate_taskdispatch)max_spawn_depth: 2→ role honored, delegation toolset re-addedmax_concurrent_children: 50returns 50 (no ceiling); 0 floors to 1max_spawn_depth: 99clamps to 3;max_spawn_depth: 0clamps to 1Rollout
Existing users see zero behavior change at defaults: delegation is still flat, still 3 parallel children, orchestrator role is a no-op. Raising
max_spawn_depthto 2 or 3 is an explicit opt-in documented incli-config.yaml.exampleand the delegation docs.Closes the orchestrator portion of #11215. Credit to @pefontana — commit authorship preserved via rebase-merge.