Repository navigation
fix(core): route Copilot Gemini fallback to chat completions - #54208
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
The change looks right. When the live /models metadata is missing, gemini-* now falls back to /chat/completions, which matches the endpoints the description says Copilot advertises and accepts. Grok, MAI Code and gpt-5+ stay on /responses, and routing from advertised endpoint metadata still takes precedence.
I ran the Copilot plugin tests (29 pass) and the packages/core type check (clean). I couldn't test the live endpoint behaviour without Copilot credentials.
Public API: unchanged.
This matches the failure in #53961 (model gemini-3.8-flash does not support Responses API when the fallback heuristic picks Responses for Gemini).
Fixes #53961
4 of 6 tasks
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.
When the Copilot
/modelsrequest fails, the plugin picks an endpoint from the model ID. #51024 sentgemini-*to/responses, but Copilot's current Gemini models only accept/chat/completions:/chat/completions/responsesgemini-3.7-flashunsupported_api_for_modelgemini-3.8-flashunsupported_api_for_model/modelsalso advertises only/chat/completionsfor both. This drops thegemini-prefix from the Responses fallback so Gemini uses chat completions. Grok and MAI Code remain on/responses(verified live: chat returnsunsupported_api_for_model). The path with loaded/modelsmetadata is unchanged.Verification:
bun test test/plugin/provider-github-copilot.test.tsandbun typecheckinpackages/core.gemini-3.8-flashover Copilot/chat/completionsthrough core's chat model: no errors.Added by the opencode bot (AI-generated).
Fixes #53961