Skip to content

fix(delegation): harden subagents against truncated tool-call output - #20993

Closed
stefan-mcf wants to merge 1 commit into
NousResearch:mainfrom
stefan-mcf:fix/delegation-max-tokens-truncation
Closed

fix(delegation): harden subagents against truncated tool-call output#20993
stefan-mcf wants to merge 1 commit into
NousResearch:mainfrom
stefan-mcf:fix/delegation-max-tokens-truncation

Conversation

@stefan-mcf

@stefan-mcf stefan-mcf commented May 7, 2026

Copy link
Copy Markdown

Summary

  • add the missing public config/docs note for delegation.max_tokens
  • document that child subagents can need a larger output-token budget than the parent
  • explain that this knob is for Hermes-side truncated tool-call recovery, not for changing user prompting expectations

Why

This PR fixes a Hermes-side delegation robustness issue. When a subagent hits finish_reason="length" while emitting tool-call arguments, Hermes correctly refuses to execute incomplete arguments, but operators need a documented child-specific output budget override to prevent repeated failures in code-edit-heavy lanes.

This is not caused by incorrect user prompting. It is a Hermes-side hardening gap around truncated subagent tool-call output.

Test plan

  • python -m pytest tests/tools/test_delegate.py -q -k 'delegation_max_tokens or prompt_tells_subagents_to_avoid_oversized_tool_calls'
  • python -m pytest tests/run_agent/test_run_agent.py -q -k 'truncated_tool_call'

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/delegate Subagent delegation labels May 7, 2026
@stefan-mcf
stefan-mcf force-pushed the fix/delegation-max-tokens-truncation branch from 91891ae to 711abf4 Compare May 7, 2026 03:08
@stefan-mcf
stefan-mcf force-pushed the fix/delegation-max-tokens-truncation branch from 711abf4 to fe4729e Compare May 7, 2026 09:15
@stefan-mcf stefan-mcf changed the title fix(delegation): tune child output budgets fix(delegation): harden subagents against truncated tool-call output May 7, 2026
@stefan-mcf

Copy link
Copy Markdown
Author

Closing and replacing with two narrower PRs for cleaner review: the delegation/subagent truncation hardening remains in this PR branch history but is now updated as a focused delegation-only PR, and the separate compression continuity advisory change now lives in #21118.

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint 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