Skip to content

Commit

Permalink
chat setup - log when workspace trust is not given (#237518)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Jan 8, 2025
1 parent dca80ea commit 4fca8e5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/vs/workbench/contrib/chat/browser/chatSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ type InstallChatClassification = {
signUpErrorCode: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The error code in case of an error signing up.' };
};
type InstallChatEvent = {
installResult: 'installed' | 'cancelled' | 'failedInstall' | 'failedNotSignedIn' | 'failedSignUp';
installResult: 'installed' | 'cancelled' | 'failedInstall' | 'failedNotSignedIn' | 'failedSignUp' | 'failedNotTrusted';
signedIn: boolean;
signUpErrorCode: number | undefined;
};
Expand Down Expand Up @@ -779,6 +779,7 @@ class ChatSetupController extends Disposable {
this.setStep(ChatSetupStep.SigningIn);
const result = await this.signIn();
if (!result.session) {
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', signedIn: false, signUpErrorCode: undefined });
return; // user cancelled
}

Expand All @@ -789,6 +790,7 @@ class ChatSetupController extends Disposable {
if (!session) {
session = (await this.authenticationService.getSessions(defaultChat.providerId)).at(0);
if (!session) {
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', signedIn: false, signUpErrorCode: undefined });
return; // unexpected
}
}
Expand All @@ -797,6 +799,7 @@ class ChatSetupController extends Disposable {
message: localize('copilotWorkspaceTrust', "Copilot is currently only supported in trusted workspaces.")
});
if (!trusted) {
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: 'failedNotTrusted', signedIn: true, signUpErrorCode: undefined });
return;
}

Expand Down Expand Up @@ -833,10 +836,6 @@ class ChatSetupController extends Disposable {
this.logService.error(`[chat setup] signIn: error ${error}`);
}

if (!session) {
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', signedIn: false, signUpErrorCode: undefined });
}

return { session, entitlement };
}

Expand Down

0 comments on commit 4fca8e5

Please sign in to comment.