Skip to content

feat(delegate): configurable max recursion depth#3633

Closed
Mibayy wants to merge 2 commits into
NousResearch:mainfrom
Mibayy:feat/configurable-max-depth
Closed

feat(delegate): configurable max recursion depth#3633
Mibayy wants to merge 2 commits into
NousResearch:mainfrom
Mibayy:feat/configurable-max-depth

Conversation

@Mibayy

@Mibayy Mibayy commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

Makes delegation recursion depth configurable via delegation.max_depth in config.yaml.

What changed

  • Added delegation.max_depth config option (default: 2)
  • _get_max_depth() reads from config, falls back to 1 if missing/invalid
  • Existing depth enforcement now uses configurable value instead of hardcoded constant

Use case

Power users can increase depth for complex multi-layer delegation workflows, while safe defaults (2 levels) remain for everyone else.

Tests

3 tests covering:

  • Default fallback behavior
  • Config value respected when present
  • Graceful handling of missing/malformed config

Part 3/3 of #3387 review response:

  1. ✅ Skill injection (feat(delegate): skill inheritance for subagents #3631)
  2. ✅ MCP workspace guard (feat(delegate): MCP workspace guard for subagents #3632)
  3. ✅ Configurable max_depth (this PR)

All three PRs are focused, tested, and contain zero rejected features (no DAG, blackboard, generator-critic, retry, checkpointing, or DELEGATION_GUIDANCE).

Mibayy added 2 commits March 29, 2026 00:22
Adds delegation.max_depth config option (default: 2) to limit nested delegation depth.

Implementation:
- _get_max_depth() reads from config.yaml delegation.max_depth
- Falls back to 1 if config missing or invalid
- Existing depth check in delegate_tool now uses configurable value

Tests:
- Default fallback to 1
- Reads from config when present
- Handles missing/invalid config gracefully

Allows power users to increase delegation depth while maintaining safe defaults.
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused PR, @Mibayy! This feature landed on main before this PR was opened.

This is an automated hermes-sweeper review.

  • _get_max_spawn_depth() reads delegation.max_spawn_depth from config.yaml, with clamping and fallback to MAX_DEPTH=1tools/delegate_tool.py line 390
  • The config default is documented in hermes_cli/config.py line 776: max_spawn_depth: 1 # 1=flat (default), 2-3 unlock nested
  • The depth guard in delegate_task() at line 1835 references _get_max_spawn_depth() and surfaces the config key in its error message
  • Landed in commit 48ecb98f8feat(delegate): orchestrator role and configurable spawn depth (default flat)

Note: this implementation uses the key delegation.max_spawn_depth (not delegation.max_depth), and intentionally defaults to 1 (flat) rather than 2, to avoid silently enabling nested orchestration for all users. The semantics are otherwise equivalent to what this PR proposes.

@teknium1 teknium1 closed this Apr 27, 2026
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have tool/delegate Subagent delegation labels Apr 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Superseded by #13691 — merged PR that added orchestrator role and configurable max_spawn_depth.

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

Labels

P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants