Skip to content

delegation model override ignored — subagents always inherit parent provider/model #26482

@SusuAgent

Description

@SusuAgent

Bug Description

When configuring delegation.model and delegation.provider in config.yaml, subagents spawned via delegate_task ignore the override and always use the parent agent's model and provider.

Steps to Reproduce

  1. Configure delegation in ~/.hermes/config.yaml:
delegation:
  model: deepseek-v4-flash
  provider: deepseek
  base_url: https://api.deepseek.com/v1
  api_key: sk-<redacted>
  1. Run a simple delegate_task test:
delegate_task(goal="Tell me your model name", toolsets=[])
  1. Observe the result: model: glm-5.1 (parent model) instead of deepseek-v4-flash.

Expected Behavior

Subagent should use deepseek-v4-flash via api.deepseek.com/v1 as configured in the delegation section.

Actual Behavior

Subagent always inherits the parent's model (glm-5.1) and provider (zai).

Investigation

I traced through the code and found:

What works correctly

  • _load_config() returns the correct delegation config with base_url, api_key, model, provider
  • _resolve_delegation_credentials() correctly returns:
    {"model": "deepseek-v4-flash", "provider": "custom", "base_url": "https://api.deepseek.com/v1", "api_key": "sk-...", "api_mode": "chat_completions"}
  • These values are passed to _build_child_agent() as override_provider, override_base_url, override_api_key
  • _build_child_agent() computes effective_model = creds["model"] (correct: "deepseek-v4-flash")
  • AIAgent.__init__() receives the correct model, base_url, api_key, provider parameters

What goes wrong

The agent log shows the subagent ended up on provider=copilot-acp model=glm-5.1:

ERROR [subagent-0] API call failed after 3 retries. Could not start Copilot ACP command 'copilot'. | provider=copilot-acp model=glm-5.1

The parent agent runs on zai/glm-5.1 (NOT copilot-acp), yet the child somehow gets provider=copilot-acp. The ACP transport inheritance in _build_child_agent (lines 1032-1053) should be cleared when override_provider is set (line 1045-1047), but the result suggests it is not being cleared properly.

Even after the most recent test (where the parent is on plain zai transport), the subagent still returns "model": "glm-5.1" — suggesting the delegation credentials may be resolved but then overwritten somewhere in AIAgent.__init__() or the fallback chain.

Additional note

When base_url and api_key were empty strings ('') in config (the default), _resolve_delegation_credentials takes the if configured_base_url: branch as falsy, falls through to if not configured_provider: which also falls through, and returns all None values — meaning the child inherits everything from the parent. The ${ENV_VAR} syntax was not expanded in the delegation section even though _expand_env_vars exists in the config loader. This may be a separate issue.

Environment

  • OS: macOS 26.3.1
  • Hermes Agent: latest (installed via curl script)
  • Parent model: zai/glm-5.1
  • Configured delegation model: deepseek/deepseek-v4-flash
  • DeepSeek API verified reachable via curl (returns valid completions)

Config (sanitized)

model:
  default: zai/glm-5.1
  provider: zai
  base_url: https://open.bigmodel.cn/api/coding/paas/v4

delegation:
  model: deepseek-v4-flash
  provider: deepseek
  base_url: https://api.deepseek.com/v1
  api_key: sk-<redacted>
  inherit_mcp_toolsets: true
  max_iterations: 50
  child_timeout_seconds: 600
  max_concurrent_children: 3
  max_spawn_depth: 1
  orchestrator_enabled: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent loop, run_agent.py, prompt buildersweeper:implemented-on-mainSweeper: behavior already present on current maintool/delegateSubagent delegationtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions