fix(delegation): forward model param in _dispatch_delegate_task#19719
Open
mailinglistenator wants to merge 2 commits into
Open
fix(delegation): forward model param in _dispatch_delegate_task#19719mailinglistenator wants to merge 2 commits into
mailinglistenator wants to merge 2 commits into
Conversation
_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).
fc3675e to
dbe1c41
Compare
23 tasks
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.
This was referenced May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
_dispatch_delegate_task()drops themodelparameter when forwarding the LLM's tool call todelegate_task(). The schema advertisesmodelas 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.modelconfig) sees the child spawn as the parent's model instead.Root Cause
The
DELEGATE_TASK_SCHEMAincludes:The LLM correctly includes
model={"model": "deepseek-v4-flash"}in its tool call args. But_dispatch_delegate_task()forwardsgoal,context,toolsets,tasks,max_iterations,acp_command,acp_args,role,parent_agent— everything exceptmodel.The rest of the pipeline is correct (config →
_resolve_delegation_credentials→_build_child_agent→AIAgent.__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
deepseek-v4-prodelegation.model: deepseek-v4-flashdelegate_task(goal="Report your model"):deepseek-v4-pro(inherits parent)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.