[PR #10963] feat: add copilot gemini reasoning #13620

Closed
opened 2026-02-16 18:18:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10963

State: closed
Merged: No


Issue

Now that GPT-5 models go to /responses and Anthropic models go to /v1/messages, Gemini is the last lobotomized copilot model left. This is a low(ish) footprint approach to let Gemini think.

Changes

Handles copilot's reasoning + reasoning_opaque replay. Most of this lives in a new CopilotChatLanguageModel, which handles transformation, storage, etc.
Re-uses some stuff from the /responses path where possible.
Also had to add a step to sanitize MCP tools, so extracted the relevant transform function for reuse.

Verify

Tested personally many times, both with Gemini sequentially as well as model/provider swaps.
The MCP issue originally came from chrome_devtools during testing, so I also made sure that works now.

Screenshots Screenshot_2026-01-28_03-05-18 Screenshot_2026-01-28_02-59-29

Would fix https://github.com/anomalyco/opencode/issues/6864

Similar to https://github.com/anomalyco/opencode/pull/8900, but smaller diff. I figured it made sense as a different PR because routing Claude to /v1/messages changes things pretty significantly (although this approach also works with Claude).


Edit: also fixes https://github.com/anomalyco/opencode/issues/8417 (this is the "gemini prefers nullable keyword" issue)

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10963 **State:** closed **Merged:** No --- ## Issue Now that GPT-5 models go to /responses and Anthropic models go to /v1/messages, Gemini is the last lobotomized copilot model left. This is a low(ish) footprint approach to let Gemini think. ## Changes Handles copilot's reasoning + `reasoning_opaque` replay. Most of this lives in a new `CopilotChatLanguageModel`, which handles transformation, storage, etc. Re-uses some stuff from the /responses path where possible. Also had to add a step to sanitize MCP tools, so extracted the relevant transform function for reuse. ## Verify Tested personally many times, both with Gemini sequentially as well as model/provider swaps. The MCP issue originally came from chrome_devtools during testing, so I also made sure that works now. <details> <summary> Screenshots </summary> <img width="1754" height="1122" alt="Screenshot_2026-01-28_03-05-18" src="https://github.com/user-attachments/assets/cef9ced2-b5ea-4a9f-8d73-449d9551c628" /> <img width="2245" height="1053" alt="Screenshot_2026-01-28_02-59-29" src="https://github.com/user-attachments/assets/93e2f33b-be07-4cd9-ab7b-7dc790eb0618" /> </details> --- Would fix https://github.com/anomalyco/opencode/issues/6864 Similar to https://github.com/anomalyco/opencode/pull/8900, but smaller diff. I figured it made sense as a different PR because routing Claude to /v1/messages changes things pretty significantly (although this approach also works with Claude). --- Edit: also fixes https://github.com/anomalyco/opencode/issues/8417 (this is the "gemini prefers nullable keyword" issue)
yindo added the pull-request label 2026-02-16 18:18:27 -05:00
yindo closed this issue 2026-02-16 18:18:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13620