fix(github-copilot): set Copilot-Integration-Id header to vscode-chat#36574
Closed
zhy-1976 wants to merge 1 commit into
Closed
fix(github-copilot): set Copilot-Integration-Id header to vscode-chat#36574zhy-1976 wants to merge 1 commit into
zhy-1976 wants to merge 1 commit into
Conversation
GitHub's Copilot API infers the integration id from the OAuth client id when no Copilot-Integration-Id header is supplied. For opencode's OAuth app, the inferred id maps to "copilot-language-server", which is rejected (403) by newer models such as gpt-5.6-*. Explicitly send Copilot-Integration-Id: vscode-chat so these models work out of the box. Users can override via the OPENCODE_COPILOT_INTEGRATION_ID environment variable.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Collaborator
|
No this breaks our agreement with copilot team you CANNOT change the integration id that is incorrect and wrong. |
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.
Issue for this PR
Closes #36575
Type of change
What does this PR do?
Newer GitHub Copilot models (
gpt-5.6-luna,gpt-5.6-sol,gpt-5.6-terra) return 403 Forbidden from the Copilot chat completions endpoint when used through opencode. Existing models (4.1, 5, 5.5, claude-*, etc.) keep working.Why: when opencode omits the
Copilot-Integration-Idrequest header, GitHub's Copilot API infers the integration id from the OAuth client id. opencode's OAuthCLIENT_ID(Ov23li8tweQw6odWQebz) is registered internally ascopilot-language-server, and that integration is not authorized for the 5.6 model family.Fix: explicitly send
Copilot-Integration-Id: vscode-chaton every Copilot request, with an env override (OPENCODE_COPILOT_INTEGRATION_ID) for advanced users:Two lines changed in
packages/opencode/src/plugin/github-copilot/copilot.ts. No behavior change for models that already worked (they acceptvscode-chattoo).How did you verify your code works?
Reproduced against the live Copilot API with
curlusing the same OAuth-refreshed bearer token, varying only theCopilot-Integration-Idheader:Copilot-Integration-Idgpt-5.6-luna)copilot-language-server)copilot-language-servervscode-chatExisting models (
gpt-4.1,gpt-5,gpt-5.5,claude-*) continue to return 200 withvscode-chatset, matching the behavior with the header omitted.Screenshots / recordings
N/A (no UI change).
Checklist