fix(core): reject GitHub Copilot login without chat entitlement - #46959
Open
rekram1-node wants to merge 1 commit into
Open
fix(core): reject GitHub Copilot login without chat entitlement#46959rekram1-node wants to merge 1 commit into
rekram1-node wants to merge 1 commit into
Conversation
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.
Fixes #46891
Problem
GitHub device OAuth succeeds for any GitHub account, including ones with no Copilot subscription or organization seat. The plugin persisted the credential regardless, so Integrations showed GitHub Copilot as connected while
/modelsreturned an empty list and there was no explanation.Change
The plugin already calls
GET /copilot_internal/userafter the device flow, but only readendpoints.api. This is the same endpoint VS Code uses as its Copilot entitlement gate (chat_enabledindefaultAccount.ts/chatEntitlementService.ts).chat_enabledandcan_signup_for_limitedfrom that response.chat_enabled: false, fail the OAuth attempt instead of persisting the credential. The failure message is surfaced through the existing attempt error path:can_signup_for_limited: true): tells the user to sign up and reconnect.Existing connections made before this change are not affected; disconnecting and reconnecting hits the new check.
Testing
copilotEntitlementErrorcovering both denial messages and the tolerant path.bun test test/plugin/provider-github-copilot.test.tsandbun typecheckpass inpackages/core.