Skip to content

fix(delegation): stop mixed platform bundles from re-exposing blocked tools to leaf children - #66817

Merged
teknium1 merged 2 commits into
mainfrom
hermes/delegate-authority-fix
Jul 18, 2026
Merged

fix(delegation): stop mixed platform bundles from re-exposing blocked tools to leaf children#66817
teknium1 merged 2 commits into
mainfrom
hermes/delegate-authority-fix

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

A leaf subagent can no longer inherit the six blocked tools (delegate_task, execute_code, memory, clarify, cronjob, send_message) when the parent's toolset is a mixed platform bundle. This closes a live authority escape on the entire gateway surface.

Salvages the authority-fix portion of @DictatorBacon's #66036 (scoped to the security fix + its regressions; the doc/schema edits are dropped as redundant with #66576, and the interrupt-detachment change is left for a separate follow-up).

Root cause

_strip_blocked_tools() operates at toolset granularity — it only drops a toolset when every tool in it is blocked. Every gateway platform bundle (hermes-cli, hermes-telegram, hermes-discord, +20 more) is mixed: it carries the blocked tools alongside terminal/web/read_file/etc. So when a gateway parent's enabled_toolsets is a bundle name, the bundle survives stripping, the child inherits it, and model_tools expands it back into the blocked tools. A leaf child spawned from any gateway platform could recursively delegate, run code, and write memory.

Fix

_blocked_toolsets_for_role() returns exact one-tool deny toolsets, threaded into the child's disabled_toolsets so model_tools subtracts the blocked names after composite expansion — and the restriction survives later registry/MCP refreshes. Orchestrators regain only delegate_task.

Validation

Live E2E (real get_tool_definitions() on a child built from ["hermes-telegram"]):

Before After
leaf child blocked tools delegate_task, execute_code, memory, clarify leaked 0
orchestrator child regains only delegate_task

scripts/run_tests.sh tests/tools/test_delegate.py → 158/158 pass, including two new regressions (test_mixed_composite_is_subtracted_at_child_assembly, test_orchestrator_composite_regains_only_delegate_task).

Infographic

subagent-authority-fix

Mason Tanguay and others added 2 commits July 18, 2026 01:04
… tools to leaf children

A leaf subagent is meant to be denied delegate_task, execute_code, memory,
clarify, cronjob, and send_message. _strip_blocked_tools() only drops a
toolset when EVERY tool in it is blocked, so mixed platform bundles
(hermes-cli, hermes-telegram, and every other gateway bundle) survived
stripping and re-exposed the blocked tools after composite expansion. A
leaf child spawned from any gateway platform could recursively delegate,
run code, and write memory.

Pass exact one-tool deny toolsets into the child's disabled_toolsets so
model_tools subtracts the blocked names AFTER composite expansion, and the
restriction survives later registry/MCP refreshes. Orchestrators regain
only delegate_task.

Salvaged from #66036 by Mason Tanguay (@DictatorBacon); scoped to the
authority fix + its regressions (docs/interrupt changes dropped).

Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets tool/delegate Subagent delegation P2 Medium — degraded but workaround exists needs-decision Awaiting maintainer decision before any implementation labels Jul 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.
Related competing work: #66036 bundles the same mixed-toolset repair with completion changes, while #54555 uses a broader subtraction that conflicts with orchestrator delegation. Maintainer selection is needed.

@teknium1
teknium1 merged commit 5402cb5 into main Jul 18, 2026
33 checks passed
@teknium1
teknium1 deleted the hermes/delegate-authority-fix branch July 18, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets needs-decision Awaiting maintainer decision before any implementation 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.

2 participants