fix(delegation): honor configured API mode - #64470
Conversation
Apply delegation.api_mode from config before provider defaults so provider-based subagents can use chat_completions when the selected model does not support responses API. Assisted-by: Hermes:gpt-5.5
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Fix to make delegation honor configured API mode. Small (38 additions, 1 deletion). No security concerns.
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the provider-based delegation gap; current main does ignore delegation.api_mode after resolving provider credentials (tools/delegate_tool.py:3161).
Problems
tools/delegate_tool.py:3148overwrites every resolved provider mode. That bypasses provider-specific transport rules: xAI is explicitly forced tocodex_responsesinhermes_cli/runtime_provider.py:1490-1491, so a delegation config ofchat_completionscould route an xAI child onto the wrong wire protocol.
Suggested changes
- Apply the delegation override through provider-aware runtime resolution, preserving providers whose transport is fixed by their resolver branch. Add a regression test for a fixed-mode provider alongside the Copilot override case.
This is an automated hermes-sweeper review.
| # providers expose model-specific exceptions where the runtime default is | ||
| # too broad; e.g. Copilot's claude-sonnet-4.6 is chat-completions only and | ||
| # rejects the Responses API. | ||
| if configured_api_mode in {"chat_completions", "codex_responses", "anthropic_messages"}: |
There was a problem hiding this comment.
This unconditional override also affects providers whose runtime intentionally fixes the transport. For example, resolve_runtime_provider() forces xAI to codex_responses; allowing delegation.api_mode=chat_completions here would construct an incompatible child. Please make this provider-aware and add a fixed-mode regression case.
Summary
Test plan
python -m pytest tests/tools/test_delegate.py -q -o 'addopts='ruff check tools/delegate_tool.py tests/tools/test_delegate.pySplit from and supersedes the delegation portion of #50894.