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 efcc4011625..de3c11d6616 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 @@ -617,7 +617,7 @@ class CodeWhispererModelConfiguratorTest { @Ignore @Test - fun `should switch to default customization on profile changed`() { + fun `profile switch should keep using existing customization if new list still contains that arn`() { 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") @@ -634,7 +634,7 @@ class CodeWhispererModelConfiguratorTest { .syncPublisher(QRegionProfileSelectedListener.TOPIC) .onProfileSelected(projectRule.project, null) - assertThat(sut.activeCustomization(projectRule.project)).isEqualTo(null) + assertThat(sut.activeCustomization(projectRule.project)).isEqualTo(oldCustomization) } @Ignore diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt index bfc6108c7aa..e968aaab481 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt @@ -90,7 +90,9 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe QRegionProfileSelectedListener.TOPIC, object : QRegionProfileSelectedListener { override fun onProfileSelected(project: Project, profile: QRegionProfile?) { - switchCustomization(project, null) + pluginAwareExecuteOnPooledThread { + CodeWhispererModelConfigurator.getInstance().listCustomizations(project, passive = true) + } } } )