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.ts only does a catalog tweak (hide gpt-5-chat-latest) and picks responses vs chat via shouldUseResponses. No ctx.integration.transform, no login method, no request-header injection, no Copilot token exchange.
- Only
openai and opencode register OAuth methods in packages/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 (or https://copilot-api.<enterprise-domain> for enterprise).
loader custom fetch that, 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, and Copilot-Vision-Request: true when images are present,
- strips inbound
x-api-key / authorization.
- A
chat.headers hook also sets X-GitHub-Api-Version, X-Interaction-Type, and anthropic-beta for 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 conditional Copilot-Vision-Request; strip inbound x-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.
Summary
On the
v2branch, 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.openaiandopencoderegister OAuth methods inpackages/core/src/plugin/provider/.How V1 does it (reference)
packages/opencode/src/plugin/github-copilot/copilot.ts:https://api.githubcopilot.com(orhttps://copilot-api.<enterprise-domain>for enterprise).loadercustomfetchthat, for OAuth credentials, on every request:Authorization: Bearer <copilot-token>,User-Agent: opencode/<version>,Openai-Intent: conversation-edits,x-initiator: agent|user, andCopilot-Vision-Request: truewhen images are present,x-api-key/authorization.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
github-copilot.ts.Authorization(Copilot token),Editor-Version/User-Agent,X-GitHub-Api-Version,Openai-Intent,x-initiator, and conditionalCopilot-Vision-Request; strip inboundx-api-key/authorization.api.githubcopilot.com/ enterprise variant).Some of this (vision/agent classification from the request body) is genuinely dynamic and needs the
fetch/Auth.customescape 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/llmpaths are covered.Environment
v2