Skip to content

fix(delegation): forward model param in _dispatch_delegate_task - #19719

Closed
mailinglistenator wants to merge 2 commits into
NousResearch:mainfrom
mailinglistenator:fix/delegation-dispatch-drops-model-param
Closed

mailinglistenator wants to merge 2 commits into
NousResearch:mainfrom
mailinglistenator:fix/delegation-dispatch-drops-model-param

Conversation

@mailinglistenator

Copy link
Copy Markdown

Bug

_dispatch_delegate_task() drops the model parameter when forwarding the LLM's tool call to delegate_task(). The schema advertises model as a field and the registry accepts it, but the dispatch layer silently discards it.

This affects ALL providers — any user setting a per-invocation model override (or relying on delegation.model config) sees the child spawn as the parent's model instead.

Root Cause

The DELEGATE_TASK_SCHEMA includes:

"model": {"type": "object", "description": "Per-invocation model override..."}

The LLM correctly includes model={"model": "deepseek-v4-flash"} in its tool call args. But _dispatch_delegate_task() forwards goal, context, toolsets, tasks, max_iterations, acp_command, acp_args, role, parent_agent — everything except model.

The rest of the pipeline is correct (config → _resolve_delegation_credentials_build_child_agentAIAgent.__init__), but the LLM tool call path bypasses it entirely.

Fix

One line: add model=function_args.get("model") to the _delegate_task() call.

Verification

  • Parent model: deepseek-v4-pro
  • Config: delegation.model: deepseek-v4-flash
  • Child spawn via delegate_task(goal="Report your model"):
    • Before fix: child runs as deepseek-v4-pro (inherits parent)
    • After fix: child runs as deepseek-v4-flash (config respected) ✓

Confirmed via live debug tracing across config read, credential resolution, AIAgent construction, and run_conversation. Every checkpoint in the pipeline produces the correct value with this fix.

@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 4, 2026
KyleChoi added 2 commits May 6, 2026 22:48
_dispatch_delegate_task() was dropping the 'model' parameter when
forwarding the LLM's tool call to delegate_task(). The schema
advertised model as a field and the registry accepted it, but the
dispatch layer silently discarded it, so per-invocation model
overrides never reached the delegate_task() function.

This affected ALL providers — any user setting a per-invocation
model override (or relying on delegation.model config) would see
the child spawn as the parent's model instead.

Root cause confirmed via live debug tracing across config read,
credential resolution, AIAgent construction, and run_conversation.
The entire pipeline was correct except for this one missing kwarg.

Fix: one line — add model=function_args.get('model') to the
_delegate_task() call in _dispatch_delegate_task.
…forwards

The delegate_task() function signature was missing the 'model'
parameter. When _dispatch_delegate_task forwards it, the call
would raise TypeError without this.

Also updates DELEGATE_TASK_SCHEMA and the registry handler to
pass model through, and adds per-task model override resolution
(per-task > top-level > delegation config).
@mailinglistenator
mailinglistenator force-pushed the fix/delegation-dispatch-drops-model-param branch from fc3675e to dbe1c41 Compare May 6, 2026 15:51
guolizi added a commit to guolizi/hermes-agent that referenced this pull request May 28, 2026
…rride

Adds a new 'model' parameter (object with model + provider fields) to
the delegate_task tool, supporting both top-level and per-task overrides.

Priority chain: per-task model > top-level model > delegation config > parent inheritance

Cherry-picked from upstream PR NousResearch#19719.
@machine25tillinfinity

Copy link
Copy Markdown

This PR directly affects our daily workflow. We have model profiles (GLM 5.2, DeepSeek) and fallback chains configured, but delegate_task silently ignores the model parameter — subagents inherit the parent model instead of the intended per-task model.

Impact:

  • Can't route specific delegation calls to different providers
  • delegation.model in config.yaml is also silently ineffective
  • Forces workarounds: manually switch parent model before delegating, or use CLI tools directly

A merge would be very valuable — it's the missing piece for proper multi-agent model orchestration.

@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the careful tracing and the concrete forwarding fix.

This automated hermes-sweeper review is closing this because the PR adds per-invocation and per-task model/provider routing to delegate_task, which is covered by the standing delegation-model-routing policy. Subagents intentionally do not accept model selection from a tool call.

  • Current main documents the contract in tools/delegate_tool.py:3263: child models are pinned through delegation.provider / delegation.model in config.yaml.
  • That config path is live: tools/delegate_tool.py:3019-3118 resolves the configured model/provider credentials, and tools/delegate_tool.py:1196-1306 supplies them to the child AIAgent.
  • The July 6 discussion's claim that delegation.model is ineffective no longer matches current main; the active-config precedence repair landed in 0263f1d12e8b4671b53c405dd9b29d58fcc67677.
  • Per-call model support was deliberately removed in fb0f579b165da4ad43f2407ef2c87fd85fdae67b and later clarified in a6f08ff0c8bcb0d97fa333f1c018cba67f21b4a3.

For a fixed child model/provider, please use the supported delegation.provider and delegation.model config values.


Closed as not-planned per standing maintainer policy (delegation-model-routing). This is a design-direction decision, not a code-quality judgment — see the Contribution Rubric in AGENTS.md for what the project is looking for. If you believe this policy was misapplied to your change, comment here and a maintainer will take a look.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:not-planned Sweeper: closed per standing maintainer policy (design direction) label Jul 12, 2026
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 sweeper:not-planned Sweeper: closed per standing maintainer policy (design direction) tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants