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
- Configure delegation in
~/.hermes/config.yaml:
delegation:
model: deepseek-v4-flash
provider: deepseek
base_url: https://api.deepseek.com/v1
api_key: sk-<redacted>
- Run a simple delegate_task test:
delegate_task(goal="Tell me your model name", toolsets=[])
- 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
Bug Description
When configuring
delegation.modelanddelegation.providerinconfig.yaml, subagents spawned viadelegate_taskignore the override and always use the parent agent's model and provider.Steps to Reproduce
~/.hermes/config.yaml:model: glm-5.1(parent model) instead ofdeepseek-v4-flash.Expected Behavior
Subagent should use
deepseek-v4-flashviaapi.deepseek.com/v1as 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 withbase_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"}_build_child_agent()asoverride_provider,override_base_url,override_api_key_build_child_agent()computeseffective_model = creds["model"](correct:"deepseek-v4-flash")AIAgent.__init__()receives the correctmodel,base_url,api_key,providerparametersWhat goes wrong
The agent log shows the subagent ended up on
provider=copilot-acp model=glm-5.1:The parent agent runs on
zai/glm-5.1(NOT copilot-acp), yet the child somehow getsprovider=copilot-acp. The ACP transport inheritance in_build_child_agent(lines 1032-1053) should be cleared whenoverride_provideris 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
zaitransport), the subagent still returns"model": "glm-5.1"— suggesting the delegation credentials may be resolved but then overwritten somewhere inAIAgent.__init__()or the fallback chain.Additional note
When
base_urlandapi_keywere empty strings ('') in config (the default),_resolve_delegation_credentialstakes theif configured_base_url:branch as falsy, falls through toif not configured_provider:which also falls through, and returns allNonevalues — meaning the child inherits everything from the parent. The${ENV_VAR}syntax was not expanded in the delegation section even though_expand_env_varsexists in the config loader. This may be a separate issue.Environment
Config (sanitized)