Skip to content

Commit 2c2bdce

Browse files
authored
fix(amazonq): adjust feature-config customization ARN-override logic #6674
1. change poll interval from 30mins to 180 mins 2. Only call listAvailableCustomizations for new customization override for update 3. Use a new field customizationArnOverrideV2 for a clean override plan
1 parent 4e56897 commit 2c2bdce

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/core/src/codewhisperer/util/customizationUtil.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const setSelectedCustomization = async (customization: Customization, isO
128128
return
129129
}
130130
if (isOverride) {
131-
const previousOverride = globals.globalState.tryGet<string>('aws.amazonq.customization.override', String)
131+
const previousOverride = globals.globalState.tryGet<string>('aws.amazonq.customization.overrideV2', String)
132132
if (customization.arn === previousOverride) {
133133
return
134134
}
@@ -143,7 +143,7 @@ export const setSelectedCustomization = async (customization: Customization, isO
143143

144144
await globals.globalState.update('CODEWHISPERER_SELECTED_CUSTOMIZATION', selectedCustomizationObj)
145145
if (isOverride) {
146-
await globals.globalState.update('aws.amazonq.customization.override', customization.arn)
146+
await globals.globalState.update('aws.amazonq.customization.overrideV2', customization.arn)
147147
}
148148
vsCodeState.isFreeTierLimitReached = false
149149
await Commands.tryExecute('aws.amazonq.refreshStatusBar')

packages/core/src/shared/featureConfig.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class FeatureContext {
3333
) {}
3434
}
3535

36-
const featureConfigPollIntervalInMs = 30 * 60 * 1000 // 30 mins
36+
const featureConfigPollIntervalInMs = 180 * 60 * 1000 // 180 mins
3737

3838
export const Features = {
3939
customizationArnOverride: 'customizationArnOverride',
@@ -144,7 +144,8 @@ export class FeatureConfigProvider {
144144

145145
const customizationArnOverride = this.featureConfigs.get(Features.customizationArnOverride)?.value
146146
?.stringValue
147-
if (customizationArnOverride !== undefined) {
147+
const previousOverride = globals.globalState.tryGet<string>('aws.amazonq.customization.overrideV2', String)
148+
if (customizationArnOverride !== undefined && customizationArnOverride !== previousOverride) {
148149
// Double check if server-side wrongly returns a customizationArn to BID users
149150
if (isBuilderIdConnection(AuthUtil.instance.conn)) {
150151
this.featureConfigs.delete(Features.customizationArnOverride)

packages/core/src/shared/globalState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export type globalKey =
4545
| 'aws.toolkit.amazonq.dismissed'
4646
| 'aws.toolkit.amazonqInstall.dismissed'
4747
| 'aws.amazonq.workspaceIndexToggleOn'
48-
| 'aws.amazonq.customization.override'
48+
| 'aws.amazonq.customization.overrideV2'
4949
// Deprecated/legacy names. New keys should start with "aws.".
5050
| '#sessionCreationDates' // Legacy name from `ssoAccessTokenProvider.ts`.
5151
| 'CODECATALYST_RECONNECT'

0 commit comments

Comments
 (0)