Repository navigation
Description
Summary
On the v2 branch, GitHub Copilot is catalog/SDK-only: there is no Copilot login method, and none of the required per-request headers / token handling that V1 injects. Copilot requests will not work correctly (and cannot authenticate via the Copilot OAuth flow).
Part of the systemic V2 provider-login gap (see #34765).
Evidence
packages/core/src/plugin/provider/github-copilot.tsonly does a catalog tweak (hidegpt-5-chat-latest) and picksresponsesvschatviashouldUseResponses. Noctx.integration.transform, no login method, no request-header injection, no Copilot token exchange.- Only
openaiandopencoderegister OAuth methods inpackages/core/src/plugin/provider/.
How V1 does it (reference)
packages/opencode/src/plugin/github-copilot/copilot.ts:
- Registers a GitHub OAuth device-code login; exchanges the GitHub token for a Copilot token.
- Endpoint selection:
https://api.githubcopilot.com(orhttps://copilot-api.<enterprise-domain>for enterprise). loadercustomfetchthat, for OAuth credentials, on every request:- inspects the body to classify vision/agent requests,
- sets
Authorization: Bearer <copilot-token>,User-Agent: opencode/<version>,Openai-Intent: conversation-edits,x-initiator: agent|user, andCopilot-Vision-Request: truewhen images are present, - strips inbound
x-api-key/authorization.
- A
chat.headershook also setsX-GitHub-Api-Version,X-Interaction-Type, andanthropic-betafor Claude-via-Copilot models.
These headers are required by the Copilot backend; without them requests are rejected or mis-attributed.
What V2 needs
- Register the Copilot login method (GitHub OAuth device flow + Copilot token exchange/refresh) in
github-copilot.ts. - Request-time header injection:
Authorization(Copilot token),Editor-Version/User-Agent,X-GitHub-Api-Version,Openai-Intent,x-initiator, and conditionalCopilot-Vision-Request; strip inboundx-api-key/authorization. - Correct base URL (
api.githubcopilot.com/ enterprise variant).
Some of this (vision/agent classification from the request body) is genuinely dynamic and needs the fetch/Auth.custom escape hatch, but the static headers and endpoint should go through the shared credential-aware request hook proposed in #34765 so both the AI SDK and native @opencode-ai/llm paths are covered.
Environment
- Branch:
v2 - Status: verified against source; not runtime-reproduced.
Activity
opencode-agent commentedon Jul 2, 2026
Tracker update from V2 TODO LIST audit (2026-07-02):
This is part of the broader V2 provider-login / credential-aware request-routing gap. Please coordinate with:
The likely durable fix should live at the native provider package / provider-resolution seam so OAuth credential metadata and per-provider request headers/base URLs work across the native
@opencode-ai/llmpath, instead of re-porting one-off V1fetchmonkey-patches.opencode-agent commentedon Jul 8, 2026
Audit update (2026-07-08): #34843 only fixed ChatGPT/OpenAI OAuth routing (#34765); it did not add GitHub Copilot login or per-request auth/header handling. This issue remains open and is not resolved by that cross-reference.
opencode-agent commentedon Jul 22, 2026
Addressed by #36336 and completed by #38184. V2 now provides GitHub and GitHub Enterprise device OAuth, credential-aware Copilot request authentication and required headers, remote model syncing, endpoint selection, and account-specific API endpoint discovery. That covers the login, per-request header/token handling, and base-URL requirements described here. Closing as resolved on the v2 branch.