Skip to content

fix(delegation): read provider/model from delegation config, not parent agent - #46978

Closed
harmssam wants to merge 2 commits into
NousResearch:mainfrom
harmssam:feat/delegation-model-label
Closed

harmssam wants to merge 2 commits into
NousResearch:mainfrom
harmssam:feat/delegation-model-label

Conversation

@harmssam

@harmssam harmssam commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Reads delegation.provider and delegation.model from config.yaml and prepends a [provider/model] tag to delegate_task progress lines across three display surfaces:

  • CLI tool preview (get_cute_tool_message) → ┊ 🔀 delegate [xai-oauth/grok-build-0.1] 1x: clean addresses
  • CLI spinner label🔀 [xai-oauth/grok-build-0.1] delegating 1 task · (/agents to monitor)
  • Gateway progress messages (verbose and non-verbose modes)

Returns empty string when no delegation override is configured, so users inheriting the parent model see no change.

Ref: #12794 (observability component)

What does this PR do?

Threads the delegation config provider/model through every display surface, so users see which LLM model their sub-agent actually runs on directly in the progress output — no config digging needed, no session ID cross-referencing.

Key design decisions:

  1. Config-driven, not runtime capture. Reads delegation.provider and delegation.model directly from config.yaml, not from getattr(agent, "provider", None). The original implementation read from the parent agent, which caused it to show [opencode-go/deepseek-v4-flash] even when the subagent was correctly running on [xai-oauth/grok-build-0.1].

  2. Fallback chain: gateway → tool_executor kwargs → delegation config. Each layer tries the next if empty, so the tag degrades gracefully when no delegation override is set.

  3. Result dict also captures child.provider alongside child.model (added in tools/delegate_tool.py) so the post-run cute tool message shows the actual runtime model the subagent finished on (which may differ from config if runtime fallback activated).

Changes Made

File Delta What
tools/delegate_tool.py +5/-0 Add provider kwargs to child progress callback identity, capture child.provider in result dict
agent/display.py +30/-3 Add _get_delegation_model_label() helper, wire into get_cute_tool_message for delegate_task result display
agent/tool_executor.py +15/-5 Sequential path: read from delegation config for spinner label. Both paths pass provider/model through callback kwargs
gateway/run.py +20/-5 Read from delegation config instead of callback kwargs (which carried parent agent values)

How to Test

  1. Set delegation.provider and delegation.model in config.yaml (e.g. xai-oauth / grok-build-0.1)
  2. Run hermes and call delegate_task with any goal
  3. Verify [xai-oauth/grok-build-0.1] tag appears in:
    • CLI spinner during execution
    • Progress message on Telegram/Discord/Slack
    • Post-run tool preview line
  4. Remove delegation config keys, restart, verify tag disappears entirely
  5. Set delegation to a model that differs from the parent agent — confirm the tag shows the delegation model, NOT the parent model

Fixes bug introduced in 37fa51f (original read parent agent provider/model instead of delegation config).

…ogress messages

The delegate_task progress message now includes a [provider/model] tag
(e.g. `[xai-oauth/grok-build-0.1]`) so users know which LLM model the
sub-agent runs on, directly from the running agent — no config needed.

Changes:
- agent/display.py: add _get_delegation_model_label() helper
- agent/tool_executor.py: pass provider/model through callback kwargs
  from both concurrent and sequential tool execution paths
- gateway/run.py: read provider/model from callback kwargs instead
  of shared agent_holder (which had a race condition)
- tools/delegate_tool.py: capture child.provider in result dict
The delegate_task progress label was reading the PARENT agent's runtime
provider and model (via getattr(agent, 'provider', None)) instead of
the subagent's configured delegation values. This caused the progress
message to show [opencode-go/deepseek-v4-flash] even when the subagent
was correctly running on [xai-oauth/grok-build-0.1].

Fix both call sites:
- agent/tool_executor.py: spinner label reads from delegation config
- gateway/run.py: Telegram progress message reads from delegation config
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/gateway Gateway runner, session dispatch, delivery tool/delegate Subagent delegation labels Jun 16, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Fixes delegation config to read provider/model from delegation config instead of parent agent. Corrects config propagation in nested delegation (4 files, ~14KB diff).

Looks Good

  • Correct fix for config field resolution in delegation
  • No security or performance concerns

Reviewed by Hermes Agent (cron batch, 2026-06-16)

@teknium1

teknium1 commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

We do not want this

@teknium1 teknium1 closed this Jul 5, 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 comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have 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