Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/extension/byok/vscode-node/byokContribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { commands, LanguageModelChatInformation, lm } from 'vscode';
import { commands, LanguageModelChatInformation, lm, window } from 'vscode';
import { IAuthenticationService } from '../../../platform/authentication/common/authentication';
import { ConfigKey, IConfigurationService } from '../../../platform/configuration/common/configurationService';
import { ICAPIClientService } from '../../../platform/endpoint/common/capiClient';
Expand Down Expand Up @@ -43,11 +43,20 @@ export class BYOKContrib extends Disposable implements IExtensionContribution {
this._register(commands.registerCommand('github.copilot.chat.manageBYOK', async (vendor: string) => {
const provider = this._providers.get(vendor);

if (!provider) {
this._logService.warn(`BYOK: Provider ${vendor} not registered; BYOK may be disabled for this account or environment.`);
void window.showInformationMessage(
`The "${vendor}" BYOK provider isn't available in this environment. ` +
'This can happen if BYOK is not enabled for your account or this GitHub instance.'
);
return;
}
Comment on lines +46 to +53
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The error handling for missing providers is inconsistent between the two commands in this file. The manageBYOK command now shows a user-facing message and uses warn level logging, while the manageBYOKAPIKey command (lines 67-69) only logs an error without showing any user message. Consider showing a similar informational message to users in the manageBYOKAPIKey command for consistency.

Copilot uses AI. Check for mistakes.

// Show quick pick for Azure and CustomOAI providers
if (provider && (vendor === AzureBYOKModelProvider.providerName.toLowerCase() || vendor === CustomOAIBYOKModelProvider.providerName.toLowerCase())) {
if (vendor === AzureBYOKModelProvider.providerName.toLowerCase() || vendor === CustomOAIBYOKModelProvider.providerName.toLowerCase()) {
const configurator = new CustomOAIModelConfigurator(this._configurationService, vendor, provider);
await configurator.configureModelOrUpdateAPIKey();
} else if (provider) {
} else {
// For all other providers, directly go to API key management
await provider.updateAPIKey();
}
Expand Down