Skip to content

Commit 913d6f7

Browse files
authored
diagnostic logs around enablement (#314138)
1 parent 932dd11 commit 913d6f7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

extensions/copilot/src/extension/byok/vscode-node/byokContribution.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import { LanguageModelChatInformation, LanguageModelChatProvider, lm } from 'vscode';
66
import { IAuthenticationService } from '../../../platform/authentication/common/authentication';
77
import { ICAPIClientService } from '../../../platform/endpoint/common/capiClient';
8+
import { isScenarioAutomation } from '../../../platform/env/common/envService';
89
import { IVSCodeExtensionContext } from '../../../platform/extContext/common/extensionContext';
910
import { ILogService } from '../../../platform/log/common/logService';
1011
import { IFetcherService } from '../../../platform/networking/common/fetcherService';
@@ -76,9 +77,14 @@ export class BYOKContrib extends Disposable implements IExtensionContribution {
7677
for (const [providerName, provider] of this._providers) {
7778
this._byokRegistrations.add(lm.registerLanguageModelChatProvider(providerName, provider));
7879
}
80+
this._logService.info(`BYOK: registered ${this._providers.size} provider(s): ${Array.from(this._providers.keys()).join(', ')}`);
81+
} else if (!this._byokProvidersRegistered) {
82+
const copilotToken = authService.copilotToken;
83+
this._logService.debug(`BYOK: not enabling — copilotToken=${copilotToken ? 'present' : 'absent'}, isScenarioAutomation=${isScenarioAutomation}, isInternal=${copilotToken?.isInternal ?? 'n/a'}, isIndividual=${copilotToken?.isIndividual ?? 'n/a'}`);
7984
}
8085
}
8186
private async fetchKnownModelList(fetcherService: IFetcherService): Promise<Record<string, BYOKKnownModels>> {
87+
this._logService.info('BYOK: fetching known models list');
8288
const data = await (await fetcherService.fetch('https://main.vscode-cdn.net/extensions/copilotChat.json', { method: 'GET', callSite: 'byok-known-models' })).json();
8389
// Use this for testing with changes from a local file. Don't check in
8490
// const data = JSON.parse((await this._fileSystemService.readFile(URI.file('/Users/roblou/code/vscode-engineering/chat/copilotChat.json'))).toString());
@@ -92,4 +98,4 @@ export class BYOKContrib extends Disposable implements IExtensionContribution {
9298
this._logService.info('BYOK: Copilot Chat known models list fetched successfully.');
9399
return knownModels;
94100
}
95-
}
101+
}

0 commit comments

Comments
 (0)