fix(moa): propagate api_mode from slot runtime to call_llm (#54379) - #54384
Closed
liuhao1024 wants to merge 9 commits into
Closed
fix(moa): propagate api_mode from slot runtime to call_llm (#54379)#54384liuhao1024 wants to merge 9 commits into
liuhao1024 wants to merge 9 commits into
Conversation
Slot_runtime resolved the provider's real API surface (including api_mode) but only forwarded base_url and api_key to call_llm, dropping api_mode. This caused Copilot GPT-5.x reference slots to hit /chat/completions instead of the Responses API, returning 400 unsupported_api_for_model. - _slot_runtime: forward api_mode from resolve_runtime_provider - call_llm: accept explicit api_mode param, override task config - 4 regression tests for propagation, omission, and signature
Contributor
|
Merged via #55579. Your commit was cherry-picked onto current main with your authorship preserved in git log (d76ca3a). The fix also covers the anthropic_messages-on-unrecognized-host case from #55268, and #55579 adds a companion fix pinning chat_completions on live MoA preset switches (#54259/#54669). Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
MoA (Mixture-of-Agents) reference-model calls drop the resolved
api_modewhen constructing the call kwargs for a slot. Acopilotreference slot running a GPT-5.x model (which Copilot only serves on the Responses API) gets called on/chat/completionsand 400s withunsupported_api_for_model.This is a two-layer fix:
_slot_runtimenow propagatesapi_modealongsidebase_url/api_keyfromresolve_runtime_provider.call_llmnow accepts an explicitapi_modeparameter that takes precedence over the task-config-derived value, so the slot's resolved API surface is honored.Related Issue
Fixes #54379
Type of Change
Changes Made
agent/moa_loop.py—_slot_runtime: forwardapi_modefromresolve_runtime_providerinto the output dict (2 lines added)agent/auxiliary_client.py—call_llm: acceptapi_modekeyword argument and override the resolved value before passing to_get_cached_client(5 lines added: 1 param, 2 docstring, 2 logic)tests/agent/test_moa_slot_api_mode.py— 4 regression tests covering api_mode propagation, omission when absent, omission when empty, and call_llm signatureHow to Test
pytest tests/agent/test_moa_slot_api_mode.py -v— all 4 tests should passpytest tests/gateway/test_moa_one_shot_restore.py -v— no regressionsunsupported_api_for_modelChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A