diff --git a/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json b/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json new file mode 100644 index 00000000000..cb51d72e994 --- /dev/null +++ b/.changes/next-release/bugfix-a7fedb6e-13ab-4d6a-a9ea-293b3f533bad.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Fix issue where user can become stuck because Amazon Q Chat does not show authentication prompt" +} \ No newline at end of file diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt index f9279eb61be..a61fa43855b 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt @@ -99,7 +99,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware { override fun onProfileSelected(myProject: Project, profile: QRegionProfile?) { if (project.isDisposed) return AmazonQToolWindow.getInstance(project).disposeAndRecreate() - qPanel.setContent(AmazonQToolWindow.getInstance(project).component) + prepareChatContent(project, qPanel) } } ) diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt index 5d052877477..2ef300ff331 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QRegionProfileManager.kt @@ -82,8 +82,9 @@ class QRegionProfileManager : PersistentStateComponent, Disposabl // succeeded in listing profiles, but none match selected // profiles should be null if access denied or connection is not IdC if (profiles == null || profiles.none { it.arn == selected.arn }) { - invalidateProfile(selected.arn) + // Note that order matters, should switch to null first then invalidateProfile switchProfile(project, null, intent = QProfileSwitchIntent.Reload) + invalidateProfile(selected.arn) Telemetry.amazonq.profileState.use { span -> span.source(QProfileSwitchIntent.Reload.value) .amazonQProfileRegion(selected.region) @@ -164,7 +165,7 @@ class QRegionProfileManager : PersistentStateComponent, Disposabl } private fun invalidateProfile(arn: String) { - val updated = connectionIdToActiveProfile.filterValues { it.arn != arn } + val updated = connectionIdToActiveProfile.filterValues { it != null && it.arn != arn } connectionIdToActiveProfile.clear() connectionIdToActiveProfile.putAll(updated) }