Skip to content

Commit 2ff5518

Browse files
authored
config(chat): try opt in implicit @workspace context once for treatment group #6217
## Problem Most users might have disabled workspace context due to previous sub-process performance issue, therefore #6098 experiment has too few datapoints. ## Solution As we've been actively working on fixes to improve the amazon q helper sub-process performance, the team decided to try turn on (only once) workspace context for a small fraction of all users (20%) to collect few more datapoints.
1 parent 2200b15 commit 2ff5518

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

packages/core/package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@
295295
"AWS.codewhisperer.customization.notification.new_customizations.learn_more": "Learn More",
296296
"AWS.amazonq.title": "Amazon Q",
297297
"AWS.amazonq.chat": "Chat",
298+
"AWS.amazonq.chat.workspacecontext.enable.message": "Amazon Q: Workspace index is now enabled. You can disable it from Amazon Q settings.",
298299
"AWS.amazonq.security": "Code Issues",
299300
"AWS.amazonq.login": "Login",
300301
"AWS.amazonq.learnMore": "Learn More About Amazon Q",
@@ -404,6 +405,7 @@
404405
"AWS.amazonq.doc.pillText.reject": "Reject",
405406
"AWS.amazonq.doc.pillText.makeChanges": "Make changes",
406407
"AWS.amazonq.inline.invokeChat": "Inline chat",
408+
"AWS.amazonq.opensettings:": "Open settings",
407409
"AWS.toolkit.lambda.walkthrough.quickpickTitle": "Application Builder Walkthrough",
408410
"AWS.toolkit.lambda.walkthrough.title": "Get started building your application",
409411
"AWS.toolkit.lambda.walkthrough.description": "Your quick guide to build an application visually, iterate locally, and deploy to the cloud!",

packages/core/src/shared/featureConfig.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
ListFeatureEvaluationsResponse,
1111
} from '../codewhisperer/client/codewhispereruserclient'
1212
import * as vscode from 'vscode'
13+
import * as nls from 'vscode-nls'
1314
import { codeWhispererClient as client } from '../codewhisperer/client/codewhisperer'
1415
import { AuthUtil } from '../codewhisperer/util/authUtil'
1516
import { getLogger } from './logger'
@@ -19,7 +20,9 @@ import globals from './extensionGlobals'
1920
import { getClientId, getOperatingSystem } from './telemetry/util'
2021
import { extensionVersion } from './vscode/env'
2122
import { telemetry } from './telemetry'
22-
import { Auth } from '../auth'
23+
import { Commands } from './vscode/commands2'
24+
25+
const localize = nls.loadMessageBundle()
2326

2427
export class FeatureContext {
2528
constructor(
@@ -35,6 +38,7 @@ export const Features = {
3538
customizationArnOverride: 'customizationArnOverride',
3639
dataCollectionFeature: 'IDEProjectContextDataCollection',
3740
projectContextFeature: 'ProjectContextV2',
41+
workspaceContextFeature: 'WorkspaceContext',
3842
test: 'testFeature',
3943
} as const
4044

@@ -83,6 +87,21 @@ export class FeatureConfigProvider {
8387
}
8488
}
8589

90+
getWorkspaceContextGroup(): 'control' | 'treatment' {
91+
const variation = this.featureConfigs.get(Features.projectContextFeature)?.variation
92+
93+
switch (variation) {
94+
case 'CONTROL':
95+
return 'control'
96+
97+
case 'TREATMENT':
98+
return 'treatment'
99+
100+
default:
101+
return 'control'
102+
}
103+
}
104+
86105
public async listFeatureEvaluations(): Promise<ListFeatureEvaluationsResponse> {
87106
const request: ListFeatureEvaluationsRequest = {
88107
userContext: {
@@ -154,12 +173,26 @@ export class FeatureConfigProvider {
154173
await vscode.commands.executeCommand('aws.amazonq.refreshStatusBar')
155174
}
156175
}
157-
if (Auth.instance.isInternalAmazonUser()) {
176+
if (this.getWorkspaceContextGroup() === 'treatment') {
158177
// Enable local workspace index by default only once, for Amzn users.
159178
const isSet = globals.globalState.get<boolean>('aws.amazonq.workspaceIndexToggleOn') || false
160179
if (!isSet) {
161180
await CodeWhispererSettings.instance.enableLocalIndex()
162181
globals.globalState.tryUpdate('aws.amazonq.workspaceIndexToggleOn', true)
182+
183+
await vscode.window
184+
.showInformationMessage(
185+
localize(
186+
'AWS.amazonq.chat.workspacecontext.enable.message',
187+
'Amazon Q: Workspace index is now enabled. You can disable it from Amazon Q settings.'
188+
),
189+
localize('AWS.amazonq.opensettings', 'Open settings')
190+
)
191+
.then((r) => {
192+
if (r === 'Open settings') {
193+
void Commands.tryExecute('aws.amazonq.configure').then()
194+
}
195+
})
163196
}
164197
}
165198
} catch (e) {

0 commit comments

Comments
 (0)