Skip to content

fix(delegate): expand composite toolsets before intersection in delegate_task#19455

Closed
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/delegate-composite-toolset-intersection
Closed

fix(delegate): expand composite toolsets before intersection in delegate_task#19455
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/delegate-composite-toolset-intersection

Conversation

@luyao618

@luyao618 luyao618 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #19447

When the parent agent uses a composite toolset like hermes-cli (which bundles 44+ tools), calling delegate_task(toolsets=["web"]) resulted in zero tools because the intersection compared toolset names rather than the tools within them: "web" ∉ {"hermes-cli"}.

Changes

tools/delegate_tool.py

  • Add _expand_parent_toolsets() helper that collects all tool names from parent toolsets, then recognises any individual toolset whose tools are a subset of the parent's available tools
  • Call it before the intersection on the if toolsets: branch so individual toolset names (e.g. web, terminal, browser) are recognised when parent uses a composite like hermes-cli

tests/tools/test_delegate_composite_toolsets.py (new)

  • 5 unit tests covering: composite expansion, individual toolsets unchanged, empty set, unknown toolset passthrough, end-to-end intersection

How it works

def _expand_parent_toolsets(parent_toolsets):
    # 1. Collect all tool names from parent toolsets
    # 2. For each toolset in TOOLSETS, if its tools ⊆ parent_tool_names, add it
    # 3. Return expanded set (original names preserved)

Test results

  • 160/161 delegate tests pass (1 pre-existing flaky timing test)
  • 5/5 new composite expansion tests pass

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/delegate Subagent delegation labels May 4, 2026
…ate_task

When the parent agent uses a composite toolset like hermes-cli, calling
delegate_task with individual toolsets (e.g. web, terminal) resulted in
zero tools because the name-based intersection failed: 'web' != 'hermes-cli'.

Add _expand_parent_toolsets() which collects all tool names from parent
toolsets, then recognises any individual toolset whose tools are a subset
of the parent's available tools. This allows delegate_task(toolsets=['web'])
to work correctly when the parent has hermes-cli enabled.

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

Labels

P2 Medium — degraded but workaround exists tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: delegate_task toolset intersection fails with composite toolsets (e.g. hermes-cli)

2 participants