From c146b0fd217616adc77177cfd9818aac172fa389 Mon Sep 17 00:00:00 2001 From: chengoramazon <143654391+chengoramazon@users.noreply.github.com> Date: Tue, 6 May 2025 19:06:35 -0400 Subject: [PATCH 1/2] fix(amazonq): unable to find Amazon Q feature dev auto build setting (#5673) --- .../bugfix-7920ece4-99d6-4828-931e-29b66994dc10.json | 4 ++++ .../amazonqFeatureDev/controller/FeatureDevController.kt | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/next-release/bugfix-7920ece4-99d6-4828-931e-29b66994dc10.json diff --git a/.changes/next-release/bugfix-7920ece4-99d6-4828-931e-29b66994dc10.json b/.changes/next-release/bugfix-7920ece4-99d6-4828-931e-29b66994dc10.json new file mode 100644 index 00000000000..b42daecd908 --- /dev/null +++ b/.changes/next-release/bugfix-7920ece4-99d6-4828-931e-29b66994dc10.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "/dev: Fix missing Amazon Q feature dev auto build setting." +} \ No newline at end of file diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/controller/FeatureDevController.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/controller/FeatureDevController.kt index 30b345c92ef..4870a206809 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/controller/FeatureDevController.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/controller/FeatureDevController.kt @@ -544,7 +544,8 @@ class FeatureDevController( } private suspend fun handleDevCommandUserSetting(tabId: String, value: Boolean) { - CodeWhispererSettings.getInstance().toggleAutoBuildFeature(context.project.basePath, value) + val session = getSessionInfo(tabId) + CodeWhispererSettings.getInstance().toggleAutoBuildFeature(session.context.workspaceRoot.path, value) messenger.sendAnswer( tabId = tabId, message = message("amazonqFeatureDev.chat_message.setting_updated"), From 51d038e0bbb8939335654296b181b908d3a23a1a Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Tue, 6 May 2025 19:52:03 -0700 Subject: [PATCH 2/2] refactor(amazonq): reduce extra call of listAvailableCustomization (#5677) Customization will only have "1" parent profile, so theoretically we don't need another call of listAvailableCustomization to check if the new profile has access to given profile or not. Instead, we could simply switch to default. --- .../customization/CodeWhispererModelConfigurator.kt | 4 +--- .../codewhisperer/CodeWhispererModelConfiguratorTest.kt | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt b/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt index 8a94288b937..b47e90b6557 100644 --- a/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt +++ b/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt @@ -90,9 +90,7 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe QRegionProfileSelectedListener.TOPIC, object : QRegionProfileSelectedListener { override fun onProfileSelected(project: Project, profile: QRegionProfile?) { - pluginAwareExecuteOnPooledThread { - CodeWhispererModelConfigurator.getInstance().listCustomizations(project, passive = true) - } + switchCustomization(project, null) } } ) diff --git a/plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererModelConfiguratorTest.kt b/plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererModelConfiguratorTest.kt index d6900a556cb..c9d019693c9 100644 --- a/plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererModelConfiguratorTest.kt +++ b/plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererModelConfiguratorTest.kt @@ -615,7 +615,7 @@ class CodeWhispererModelConfiguratorTest { } @Test - fun `profile switch should keep using existing customization if new list still contains that arn`() { + fun `should switch to default customization on profile changed`() { val ssoConn = spy(LegacyManagedBearerSsoConnection(region = "us-east-1", startUrl = "url 1", scopes = Q_SCOPES)) ToolkitConnectionManager.getInstance(projectRule.project).switchConnection(ssoConn) val oldCustomization = CodeWhispererCustomization("oldArn", "oldName", "oldDescription") @@ -632,7 +632,7 @@ class CodeWhispererModelConfiguratorTest { .syncPublisher(QRegionProfileSelectedListener.TOPIC) .onProfileSelected(projectRule.project, null) - assertThat(sut.activeCustomization(projectRule.project)).isEqualTo(oldCustomization) + assertThat(sut.activeCustomization(projectRule.project)).isEqualTo(null) } @Test