Skip to content

Commit 210c322

Browse files
dhasani23David Hasani
andauthored
fix(amazonq): ensure chat does not freeze on /transform with invalid project (#4456)
* fix(amazonq): ensure chat does not freeze on /transform with invalid projects * fix detekt issue * move depends to codetransform-specific xml --------- Co-authored-by: David Hasani <[email protected]>
1 parent 94add88 commit 210c322

File tree

6 files changed

+11
-2
lines changed

6 files changed

+11
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q Code Transformation: ensure chat does not freeze with /transform on an invalid project"
4+
}

plugins/amazonq/codetransform/jetbrains-community/resources/META-INF/plugin-codetransform.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<!-- SPDX-License-Identifier: Apache-2.0 -->
33
<idea-plugin>
44
<depends optional="true" config-file="ext-codetransform-java.xml">com.intellij.modules.java</depends>
5+
<depends optional="true">org.jetbrains.plugins.gradle</depends>
56
</idea-plugin>

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ fun buildTransformResultChatContent(result: CodeModernizerJobCompletedResult): C
233233
is CodeModernizerJobCompletedResult.JobPartiallySucceeded -> {
234234
message("codemodernizer.chat.message.result.partially_success")
235235
}
236+
is CodeModernizerJobCompletedResult.JobFailed -> {
237+
message("codemodernizer.chat.message.result.fail_with_known_reason", result.failureReason.orEmpty())
238+
}
236239
else -> {
237240
message("codemodernizer.chat.message.result.fail")
238241
}

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/MavenRunnerUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private fun runMavenCopyDependencies(
117117
} catch (t: Throwable) {
118118
val error = "Maven Copy: Unexpected error when executing bundled Maven copy dependencies"
119119
copyTransformRunnable.setExitCode(Integer.MIN_VALUE) // to stop looking for the exitCode
120-
logger.error(t) { error }
120+
logger.info(t) { error }
121121
buildlogBuilder.appendLine("IntelliJ bundled Maven copy dependencies failed: ${t.message}")
122122
telemetry.mvnBuildFailed(CodeTransformMavenBuildCommand.IDEBundledMaven, error)
123123
}

plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class QuickActionHandler {
9292
this.mynahUI.updateStore(affectedTabId, this.tabDataGenerator.getTabData('codetransform', true))
9393
this.mynahUI.updateStore(affectedTabId, {
9494
promptInputDisabledState: true,
95-
promptInputPlaceholder: 'Chat disabled during Code Transformation.',
95+
promptInputPlaceholder: 'Open a new tab to chat with Q.',
9696
loadingChat: true,
9797
})
9898

plugins/toolkit/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ codemodernizer.chat.message.local_build_begin=I'm building your module. This can
560560
codemodernizer.chat.message.local_build_failed=Sorry, I could not run the Maven clean install command to build your module.
561561
codemodernizer.chat.message.local_build_success=I was able to build your project and will start transforming your code soon.
562562
codemodernizer.chat.message.result.fail=Sorry, I could not complete the transformation. Try starting the transformation again.
563+
codemodernizer.chat.message.result.fail_with_known_reason=Sorry, I could not complete the transformation. {0}
563564
codemodernizer.chat.message.result.partially_success=I upgraded part of your code to Java 17. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation.
564565
codemodernizer.chat.message.result.success=I successfully upgraded your code to Java 17. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated.
565566
codemodernizer.chat.message.result.zip_too_large=Sorry, your project size exceeds the Amazon Q Code Transformation upload limit of 1GB.

0 commit comments

Comments
 (0)