Skip to content

fix(core): route Copilot Gemini fallback to chat completions - #54208

Merged
rekram1-node merged 1 commit into
v2from
copilot-gemini-chat
Oct 9, 2026
Merged

rekram1-node merged 1 commit into
v2from
copilot-gemini-chat

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

When the Copilot /models request fails, the plugin picks an endpoint from the model ID. #51024 sent gemini-* to /responses, but Copilot's current Gemini models only accept /chat/completions:

model /chat/completions /responses
gemini-3.7-flash 200 400 unsupported_api_for_model
gemini-3.8-flash 200 400 unsupported_api_for_model

/models also advertises only /chat/completions for both. This drops the gemini- prefix from the Responses fallback so Gemini uses chat completions. Grok and MAI Code remain on /responses (verified live: chat returns unsupported_api_for_model). The path with loaded /models metadata is unchanged.

Verification:

  • bun test test/plugin/provider-github-copilot.test.ts and bun typecheck in packages/core.
  • Live 4-step tool-calling loop on gemini-3.8-flash over Copilot /chat/completions through core's chat model: no errors.

Added by the opencode bot (AI-generated).

Fixes #53961

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@rekram1-node
rekram1-node merged commit 1a9e29a into v2 Oct 9, 2026
11 checks passed
@rekram1-node
rekram1-node deleted the copilot-gemini-chat branch October 9, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant