Summary
When delegation.provider is set to opencode-go, delegate_task spawns subagents with the wrong api_mode and base_url, causing HTTP 404 on every API call.
Root Cause
In tools/delegate_tool.py, _resolve_delegation_credentials() calls:
runtime = resolve_runtime_provider(requested=configured_provider)
without passing target_model=configured_model.
For opencode-go, resolve_runtime_provider() behaves differently depending on whether target_model is provided:
|
Without target_model |
With target_model=deepseek-v4-flash |
api_mode |
anthropic_messages |
chat_completions |
base_url |
https://opencode.ai/zen/go (no /v1) |
https://opencode.ai/zen/go/v1 |
The subagent therefore hits an Anthropic-compatible endpoint that does not exist on the OpenCode Go surface, receiving a 404 HTML response.
Steps to Reproduce
- Set
delegation.provider: opencode-go and delegation.model: deepseek-v4-flash in config.yaml.
- Run any
delegate_task call.
- Subagents fail with
HTTP 404 — Not Found | opencode.
Expected Behavior
Subagents should use the same correct endpoint as the main agent (chat_completions on https://opencode.ai/zen/go/v1).
Proposed Fix
Pass target_model to resolve_runtime_provider() in _resolve_delegation_credentials:
runtime = resolve_runtime_provider(requested=configured_provider, target_model=configured_model)
This mirrors the logic used elsewhere (e.g. model_switch.py) and ensures the provider resolves the correct API surface for the chosen model.
Environment
- Hermes Agent version: 0.11.0 (2026.4.23)
- Provider:
opencode-go
- Model:
deepseek-v4-flash (also affects minimax-m2.7, etc.)
Additional Context
The same bug likely affects opencode-zen because it also uses opencode_model_api_mode() inside resolve_runtime_provider(), which requires target_model to route correctly between codex_responses, anthropic_messages, and chat_completions.
Summary
When
delegation.provideris set toopencode-go,delegate_taskspawns subagents with the wrongapi_modeandbase_url, causing HTTP 404 on every API call.Root Cause
In
tools/delegate_tool.py,_resolve_delegation_credentials()calls:without passing
target_model=configured_model.For
opencode-go,resolve_runtime_provider()behaves differently depending on whethertarget_modelis provided:target_modeltarget_model=deepseek-v4-flashapi_modeanthropic_messageschat_completionsbase_urlhttps://opencode.ai/zen/go(no/v1)https://opencode.ai/zen/go/v1The subagent therefore hits an Anthropic-compatible endpoint that does not exist on the OpenCode Go surface, receiving a 404 HTML response.
Steps to Reproduce
delegation.provider: opencode-goanddelegation.model: deepseek-v4-flashinconfig.yaml.delegate_taskcall.HTTP 404 — Not Found | opencode.Expected Behavior
Subagents should use the same correct endpoint as the main agent (
chat_completionsonhttps://opencode.ai/zen/go/v1).Proposed Fix
Pass
target_modeltoresolve_runtime_provider()in_resolve_delegation_credentials:This mirrors the logic used elsewhere (e.g.
model_switch.py) and ensures the provider resolves the correct API surface for the chosen model.Environment
opencode-godeepseek-v4-flash(also affectsminimax-m2.7, etc.)Additional Context
The same bug likely affects
opencode-zenbecause it also usesopencode_model_api_mode()insideresolve_runtime_provider(), which requirestarget_modelto route correctly betweencodex_responses,anthropic_messages, andchat_completions.