Skip to content

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

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

fix(delegation): forward model param in _dispatch_delegate_task#19719
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 loop, run_agent.py, prompt builder 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder 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.

3 participants