Skip to content

Allow all SKUs to use BYOK #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

pierceboggan
Copy link
Contributor

@pierceboggan pierceboggan commented Jul 14, 2025

This PR removes a license check that was in place for "bring your own key" which previously restricted use to Copilot Free and Individual SKUs.

This also shows a warning the first time you add a BYOK model in VS Code.

@@ -130,8 +130,41 @@ export function resolveModelInfo(modelId: string, providerName: string, knownMod
};
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for comments if they were not there before. I know some devs prefer code with 0 comments.

}

// For business and enterprise users, require Editor Preview Features to be enabled
if (copilotToken.copilotPlan === 'business' || copilotToken.copilotPlan === 'enterprise') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to hard code 'business', 'enterprise'. There is probably some enum somewhere you can use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't think there is an enum - this value is currently defined as a string literal union:

get copilotPlan(): 'free' | 'individual' | 'individual_pro' | 'business' | 'enterprise' {


// For business and enterprise users, require Editor Preview Features to be enabled
if (copilotToken.copilotPlan === 'business' || copilotToken.copilotPlan === 'enterprise') {
return copilotToken.isEditorPreviewFeaturesEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 enterprises have preview features enabled.
So I would not go down this route. For now I would just enable for insiders, and if GH wants a policy to disable once they deliver we can return that boolean. And I hope that is ENABLED by default.

@isidorn
Copy link
Contributor

isidorn commented Jul 15, 2025

Thanks for this PR. I left some comments.
I think the bigger part of the work is actually notifying the user and making it obvious that the BYOK models are not covered with guarantess we have for Copilot models. I do not know if that is a dialog, notification, or just makeing it super clear in the docs.

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not opposed to the JSDoc comment but if you do end up removing it, just inline some of the details.

return true;
}

// Allow for individual users without preview features gating (backward compatibility)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Allow for individual users without preview features gating (backward compatibility)
// Allow for individual users without preview feature-gating (backward compatibility)

*
* @param copilotToken The user's Copilot token (without the actual token value)
* @param capiClientService Service to check if running on GitHub Enterprise
* @returns true if BYOK should be enabled for this user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @returns true if BYOK should be enabled for this user
* @returns whether BYOK should be enabled for this user

}

// For business and enterprise users, require Editor Preview Features to be enabled
if (copilotToken.copilotPlan === 'business' || copilotToken.copilotPlan === 'enterprise') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't think there is an enum - this value is currently defined as a string literal union:

get copilotPlan(): 'free' | 'individual' | 'individual_pro' | 'business' | 'enterprise' {

@osortega osortega modified the milestones: July 2025, August 2025 Aug 1, 2025
@pierceboggan pierceboggan changed the title Allow all SKUs to use BYOK and enforce Editor Preview features policy Allow all SKUs to use BYOK Aug 5, 2025
@pierceboggan
Copy link
Contributor Author

@isidorn OK, give it another look. Just cleaned up the logic more. :)

// One‑time disclaimer: make it clear that BYOK models are external and not covered by Copilot guarantees.
if (!this._byokDisclaimerShown) {
this._byokDisclaimerShown = true; // ensure we only show once per session
const detail = 'Models you configure here are provided by external services that you choose. Your prompts and code may be sent to those services and are subject to their terms. GitHub Copilot\'s data handling, compliance, and quality guarantees do NOT apply to BYOK models.';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need to improve this string to be Localized. I am not 100% sure how to do it from this extension, but ask agent mode.

if (!this._byokDisclaimerShown) {
this._byokDisclaimerShown = true; // ensure we only show once per session
const detail = 'Models you configure here are provided by external services that you choose. Your prompts and code may be sent to those services and are subject to their terms. GitHub Copilot\'s data handling, compliance, and quality guarantees do NOT apply to BYOK models.';
const learnMore = 'Learn More';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for all these other strings. I think all user facing strings need a special syntax to be localized.

@@ -126,6 +127,25 @@ export class BYOKContrib extends Disposable implements IExtensionContribution {
}

private async registerModelCommand() {
// One‑time disclaimer: make it clear that BYOK models are external and not covered by Copilot guarantees.
if (!this._byokDisclaimerShown) {
this._byokDisclaimerShown = true; // ensure we only show once per session
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How often is the registerModelCommand called?

If it is called only once the user adds a BYOK model - then I think this would work.

@isidorn
Copy link
Contributor

isidorn commented Aug 7, 2025

Left some comments.

Did you get a chance to test this out? If yes, can you share a screenshot / gif so I see the flow to potentially provide more feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants