fix(copilot): use target_model not config default for api_mode resolution - #60431
Closed
CharlesMcquade wants to merge 1 commit into
Closed
fix(copilot): use target_model not config default for api_mode resolution#60431CharlesMcquade wants to merge 1 commit into
CharlesMcquade wants to merge 1 commit into
Conversation
…tion
When the WebUI selects a copilot model (e.g. gpt-5.5) via the dropdown,
resolve_runtime_provider receives it as target_model. However,
_copilot_runtime_api_mode was reading model_cfg.get('default') — the
persisted config.yaml default (e.g. deepseek-v4) — instead of the
actual target model. This caused GPT-5.x models to be routed to
/chat/completions instead of the /responses endpoint, resulting in
HTTP 400: 'model "gpt-5.5" is not accessible via the /chat/completions
endpoint'.
The fallback path (try_activate_fallback in chat_completion_helpers.py)
was unaffected because it uses _provider_model_requires_responses_api()
with the correct model name, which is why gpt-5.5 worked as a fallback
but failed as a primary model selected from the WebUI.
Fix: pass target_model through _copilot_runtime_api_mode at both call
sites (pool entry path and non-pool path) and prefer it over
model_cfg.get('default') when determining the API mode.
Collaborator
Duplicate of #60294 -- both fix |
Contributor
Author
|
Closing as duplicate of #60294 |
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.
Problem
When selecting GPT-5.5 via Copilot as the primary model from the WebUI dropdown, every API call fails with:
GPT-5.x models on Copilot require the
/responsesendpoint (codex_responsesAPI mode), but the request is sent to/chat/completionsinstead.Root Cause
_copilot_runtime_api_mode()inruntime_provider.pyreadsmodel_cfg.get("default")— the persisted config.yaml default model (e.g.deepseek-ai/DeepSeek-V4-Flash) — instead of the actual target model (gpt-5.5) when deciding which API endpoint to use.The WebUI correctly passes
target_modeltoresolve_runtime_provider(), but_copilot_runtime_api_mode()does not accept or use it. Since the config default is not a GPT-5 model,_should_use_copilot_responses_api()returnsFalse, and the API mode resolves tochat_completions.The fallback path (
try_activate_fallbackinchat_completion_helpers.py) is unaffected because it uses_provider_model_requires_responses_api()with the correct model name — which is why GPT-5.5 works as a fallback but fails as a primary model selected from the WebUI.Fix
Pass
target_modelthrough_copilot_runtime_api_mode()at both call sites (pool entry path at line 446 and non-pool path at line 2003) and prefer it overmodel_cfg.get("default")when determining the API mode.Reproduction
deepseek-ai/DeepSeek-V4-Flashoncustom:wandb)@copilot:gpt-5.5from the model dropdownTesting
test_copilot_acp_clientunrelated to this change —HERMES_REAL_HOMEenv var issue)target_model="gpt-5.5"and config defaultdeepseek-ai/DeepSeek-V4-Flash, the API mode now correctly resolves tocodex_responses