fix(delegate): block skills tools from leaf subagents to reduce prompt bloat - #76081
fix(delegate): block skills tools from leaf subagents to reduce prompt bloat#76081kshitijk4poor wants to merge 2 commits into
Conversation
…t bloat Subagents inherited the parent's skills toolset (skills_list, skill_view, skill_manage), injecting a ~2,800-token skill index into the child's system prompt. On models with smaller effective context windows this caused context-overflow errors before the subagent made its first API call (NousResearch#42809). Add the three skills tools to DELEGATE_BLOCKED_TOOLS. The derived _strip_blocked_tools() filter then auto-strips the 'skills' toolset (all its tools are now blocked), and system_prompt.py's has_skills_tools gate already prevents the skill index from being injected when the tools are absent from valid_tool_names. Cherry-picked from PR NousResearch#42822 by @Morad37. The original PR also proposed gating TASK_COMPLETION_GUIDANCE behind is_subagent, but that block is a deliberately universal anti-stub/anti-fabrication directive (a4d8f0f) and is retained for subagents. The delegate_tool.py hunk was reworked to use the derived filter introduced in NousResearch#56386. Co-authored-by: Morad37 <Morad37@users.noreply.github.com>
For PR NousResearch#42822 salvage — cherry-picked commit authored by Morad37 <Morad37@users.noreply.github.com>.
SummaryFour PRs address #42809. #42823 and #42831 contain the same narrow, now-stale toolset-name filter; #42822 adds broader prompt-guidance removal; and #76081 salvages the root-cause fix against the current derived filtering architecture with regression coverage while retaining universal task-completion guidance. Related pull requests
Duplicates#42823 and #42831 are exact duplicates. Their narrow behavior also overlaps with the skills-stripping portion of #42822 and is superseded by the current-architecture implementation in #76081. Suggested consolidationKeep #76081 open with a salvage path: preserve its per-tool Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I42809(["issue #42809 (open)"])
subgraph Dup42822 ["PRs duplicating each other"]
P42822["PR #42822 (closed)"]
P42823["PR #42823 (closed)"]
P42831["PR #42831 (closed)"]
P76081["PR #76081 (open)"]
end
P76081 -->|best fix| I42809
class I42809 open
class P42822 closed
class P42823 closed
class P42831 closed
class P76081 open
class P42831 best
class P76081 best
class P76081 target
click I42809 "https://github.com/NousResearch/hermes-agent/issues/42809"
click P42822 "https://github.com/NousResearch/hermes-agent/pull/42822"
click P42823 "https://github.com/NousResearch/hermes-agent/pull/42823"
click P42831 "https://github.com/NousResearch/hermes-agent/pull/42831"
click P76081 "https://github.com/NousResearch/hermes-agent/pull/76081"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 4 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 10 kB of PR diffs, 7 kB of issue/PR text, 3 kB of discussion (8 comments), 8 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Summary
Leaf subagents no longer receive the skills toolset, eliminating ~2,800 tokens of skill-index bloat from the child's system prompt that caused context-overflow failures on models with smaller effective context windows.
Root cause: subagents inherited the parent's skills tools (
skills_list,skill_view,skill_manage), which triggered the full skill index injection insystem_prompt.py. On models likeqwen3-coder-nextwith a lower effective context than configured, the API rejected the payload before the first call (#42809).Changes
tools/delegate_tool.py: Addskills_list,skill_view,skill_managetoDELEGATE_BLOCKED_TOOLS. The derived_strip_blocked_tools()filter auto-strips theskillstoolset (all its tools are now blocked), and_blocked_toolsets_for_role()subtracts them from mixed platform bundles.system_prompt.py's existinghas_skills_toolsgate already prevents the skill index from being injected when the tools are absent — no prompt changes needed.tests/tools/test_delegate.py: 3 regression tests — strip test, constant assertion,_blocked_toolsets_for_roleassertion.contributors/emails/: Morad37 attribution.Design decisions
TASK_COMPLETION_GUIDANCEgate from the original PR. The sweeper correctly flagged that this block is a deliberately universal anti-stub/anti-fabrication directive (commit a4d8f0f), not subagent-specific bloat.code_executionremains unblocked per Teknium's Jul 2026 decision (feat(delegation): let subagents use execute_code #69325).Validation
Cherry-picked from #42822 by @Morad37. Closes #42809.