fix(tools): pass target_model to resolve_runtime_provider in delegation (#15319)

When delegation.model differs from the parent model (e.g., delegating
to claude-opus-4-6 on an opencode-zen provider while the parent uses
a chat_completions model), resolve_runtime_provider needs the target
model to select the correct api_mode.  Without it, the delegate
inherits the parent's api_mode and gets 404 errors.

Supersedes #15320.
This commit is contained in:
Tranquil-Flow 2026-04-25 09:19:24 +10:00
parent 00c3d848d8
commit acfe927294
2 changed files with 22 additions and 3 deletions

View file

@ -2164,7 +2164,7 @@ def _resolve_delegation_credentials(cfg: dict, parent_agent) -> dict:
try:
from hermes_cli.runtime_provider import resolve_runtime_provider
runtime = resolve_runtime_provider(requested=configured_provider)
runtime = resolve_runtime_provider(requested=configured_provider, target_model=configured_model)
except Exception as exc:
raise ValueError(
f"Cannot resolve delegation provider '{configured_provider}': {exc}. "