Skip to content

Commit 177b813

Browse files
committed
Merge remote-tracking branch 'origin/main' into rli/243
2 parents 5c5c18e + dc67222 commit 177b813

File tree

71 files changed

+1245
-610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1245
-610
lines changed

.changes/3.32.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"date" : "2024-10-10",
3+
"version" : "3.32",
4+
"entries" : [ {
5+
"type" : "feature",
6+
"description" : "Loosen inline completion support limitations for YAML/JSON"
7+
}, {
8+
"type" : "bugfix",
9+
"description" : "Fix error occuring when Amazon Q attempts to show UI hints on manually triggerred inline suggestion (#4929)"
10+
}, {
11+
"type" : "bugfix",
12+
"description" : "Amazon Q (/dev): provide error messaging when no code changes are required for the prompt"
13+
}, {
14+
"type" : "bugfix",
15+
"description" : "Fix 'Slow operations are prohibited on EDT.' when Amazon Q is determining if a file supports inline suggestions (#4823)"
16+
}, {
17+
"type" : "bugfix",
18+
"description" : "Amazon Q Feature Dev: Add error messages when the upload URL expires"
19+
}, {
20+
"type" : "bugfix",
21+
"description" : "Fix toolkit connection dropdown getting hidden when panel width is small."
22+
}, {
23+
"type" : "bugfix",
24+
"description" : "Fix inability to sign out in reauth view in Q chat panel"
25+
}, {
26+
"type" : "bugfix",
27+
"description" : "Raise max `@workspace` indexing size to 4GB"
28+
}, {
29+
"type" : "bugfix",
30+
"description" : "Automatically pause and resume `@workspace` indexing when OS CPU load is high"
31+
} ]
32+
}

.changes/next-release/bugfix-c7239939-2067-469a-809e-594d2c95594b.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# _3.32_ (2024-10-10)
2+
- **(Feature)** Loosen inline completion support limitations for YAML/JSON
3+
- **(Bug Fix)** Fix error occuring when Amazon Q attempts to show UI hints on manually triggerred inline suggestion ([#4929](https://github.com/aws/aws-toolkit-jetbrains/issues/4929))
4+
- **(Bug Fix)** Amazon Q (/dev): provide error messaging when no code changes are required for the prompt
5+
- **(Bug Fix)** Fix 'Slow operations are prohibited on EDT.' when Amazon Q is determining if a file supports inline suggestions ([#4823](https://github.com/aws/aws-toolkit-jetbrains/issues/4823))
6+
- **(Bug Fix)** Amazon Q Feature Dev: Add error messages when the upload URL expires
7+
- **(Bug Fix)** Fix toolkit connection dropdown getting hidden when panel width is small.
8+
- **(Bug Fix)** Fix inability to sign out in reauth view in Q chat panel
9+
- **(Bug Fix)** Raise max `@workspace` indexing size to 4GB
10+
- **(Bug Fix)** Automatically pause and resume `@workspace` indexing when OS CPU load is high
11+
112
# _3.31_ (2024-10-03)
213
- **(Feature)** Amazon Q Developer: Updated legal disclaimer text
314
- **(Feature)** Amazon Q Code Transformation: allow users to skip tests

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Toolkit Version
5-
toolkitVersion=3.32-SNAPSHOT
5+
toolkitVersion=3.33-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/QLoginWebview.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package software.aws.toolkits.jetbrains.services.amazonq
66
import com.intellij.openapi.Disposable
77
import com.intellij.openapi.actionSystem.AnActionEvent
88
import com.intellij.openapi.actionSystem.DataContext
9+
import com.intellij.openapi.application.runInEdt
910
import com.intellij.openapi.components.Service
1011
import com.intellij.openapi.components.service
1112
import com.intellij.openapi.project.Project
@@ -175,13 +176,15 @@ class QWebviewBrowser(val project: Project, private val parentDisposable: Dispos
175176
ToolkitConnectionManager.getInstance(project)
176177
.activeConnectionForFeature(QConnection.getInstance()) as? AwsBearerTokenConnection
177178
)?.let { connection ->
178-
SsoLogoutAction(connection).actionPerformed(
179-
AnActionEvent.createFromDataContext(
180-
"qBrowser",
181-
null,
182-
DataContext.EMPTY_CONTEXT
179+
runInEdt {
180+
SsoLogoutAction(connection).actionPerformed(
181+
AnActionEvent.createFromDataContext(
182+
"qBrowser",
183+
null,
184+
DataContext.EMPTY_CONTEXT
185+
)
183186
)
184-
)
187+
}
185188
}
186189
}
187190

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/auth/AuthController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class AuthController {
8888
AuthFollowUpType.FullAuth,
8989
-> runInEdt {
9090
UiTelemetry.click(project, "amazonq_chatAuthenticate")
91-
requestCredentialsForQ(project, connectionInitiatedFromQChatPanel = true)
91+
requestCredentialsForQ(project, connectionInitiatedFromQChatPanel = true, isReauth = false)
9292
}
9393

9494
AuthFollowUpType.ReAuth,

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/explorerActions/SignInToQAction.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SignInToQAction : SignInToQActionBase(message("q.sign.in")) {
2424
UiTelemetry.click(project, "auth_start_Q")
2525

2626
if (!isQWebviewsAvailable()) {
27-
requestCredentialsForQ(project)
27+
requestCredentialsForQ(project, isReauth = false)
2828
} else {
2929
ToolWindowManager.getInstance(project).getToolWindow(AmazonQToolWindowFactory.WINDOW_ID)?.show()
3030
}
@@ -42,7 +42,7 @@ abstract class SignInToQActionBase(actionName: String) : DumbAwareAction(actionN
4242
reauthConnectionIfNeeded(project, it, isReAuth = true)
4343
} ?: run {
4444
runInEdt {
45-
if (requestCredentialsForQ(project)) {
45+
if (requestCredentialsForQ(project, isReauth = false)) {
4646
if (!openMeetQPage(project)) {
4747
return@runInEdt
4848
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/FeatureDevConstants.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,16 @@ enum class ModifySourceFolderErrorReason(
2525

2626
override fun toString(): String = reasonText
2727
}
28+
29+
enum class FeatureDevOperation(private val operationName: String) {
30+
StartTaskAssistCodeGeneration("StartTaskAssistCodeGenerator"),
31+
CreateConversation("CreateConversation"),
32+
CreateUploadUrl("CreateUploadUrl"),
33+
GenerateCode("GenerateCode"),
34+
GetTaskAssistCodeGeneration("GetTaskAssistCodeGenerator"),
35+
ExportTaskAssistArchiveResult("ExportTaskAssistArchiveResult"),
36+
UploadToS3("UploadToS3"),
37+
;
38+
39+
override fun toString(): String = operationName
40+
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/FeatureDevExceptions.kt

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,69 @@ package software.aws.toolkits.jetbrains.services.amazonqFeatureDev
66
import software.aws.toolkits.jetbrains.services.amazonq.RepoSizeError
77
import software.aws.toolkits.resources.message
88

9-
open class FeatureDevException(override val message: String?, override val cause: Throwable? = null) : RuntimeException()
9+
/**
10+
* FeatureDevException models failures from feature dev operations.
11+
*
12+
* - Each failure is annotated based on className, operation, and a short desc. Use the `reason()` and `reasonDesc()` members for instrumentation.
13+
* - To throw an exception without modeling, throw FeatureDevException directly.
14+
*/
15+
open class FeatureDevException(override val message: String?, val operation: String, val desc: String?, override val cause: Throwable? = null) :
16+
RuntimeException() {
17+
fun reason(): String = this.javaClass.simpleName
1018

11-
class ContentLengthError(override val message: String, override val cause: Throwable?) : RepoSizeError, RuntimeException()
19+
fun reasonDesc(): String =
20+
when (desc) {
21+
desc -> "$operation | Description: $desc"
22+
else -> operation
23+
}
24+
}
1225

13-
class ZipFileError(override val message: String, override val cause: Throwable?) : RuntimeException()
26+
class NoChangeRequiredException(operation: String, desc: String?, cause: Throwable? = null) :
27+
FeatureDevException(message("amazonqFeatureDev.exception.no_change_required_exception"), operation, desc, cause)
1428

15-
class CodeIterationLimitError(override val message: String, override val cause: Throwable?) : RuntimeException()
29+
class EmptyPatchException(operation: String, desc: String?, cause: Throwable? = null) :
30+
FeatureDevException(message("amazonqFeatureDev.exception.guardrails"), operation, desc, cause)
1631

17-
class MonthlyConversationLimitError(override val message: String, override val cause: Throwable?) : RuntimeException()
32+
class ContentLengthException(
33+
override val message: String = message("amazonqFeatureDev.content_length.error_text"),
34+
operation: String,
35+
desc: String?,
36+
cause: Throwable? = null,
37+
) :
38+
RepoSizeError, FeatureDevException(message, operation, desc, cause)
1839

19-
internal fun featureDevServiceError(message: String?): Nothing =
20-
throw FeatureDevException(message)
40+
class ZipFileCorruptedException(operation: String, desc: String?, cause: Throwable? = null) :
41+
FeatureDevException("The zip file is corrupted", operation, desc, cause)
2142

22-
internal fun codeGenerationFailedError(): Nothing =
23-
throw FeatureDevException(message("amazonqFeatureDev.code_generation.failed_generation"))
43+
class UploadURLExpired(operation: String, desc: String?, cause: Throwable? = null) :
44+
FeatureDevException(message("amazonqFeatureDev.exception.upload_url_expiry"), operation, desc, cause)
2445

25-
internal fun uploadCodeError(): Nothing =
26-
throw FeatureDevException(message("amazonqFeatureDev.exception.upload_code"))
46+
class CodeIterationLimitException(operation: String, desc: String?, cause: Throwable? = null) :
47+
FeatureDevException(message("amazonqFeatureDev.code_generation.iteration_limit.error_text"), operation, desc, cause)
2748

28-
internal fun conversationIdNotFound(): Nothing =
29-
throw FeatureDevException(message("amazonqFeatureDev.exception.conversation_not_found"))
49+
class MonthlyConversationLimitError(message: String, operation: String, desc: String?, cause: Throwable? = null) :
50+
FeatureDevException(message, operation, desc, cause)
3051

31-
internal fun apiError(message: String?, cause: Throwable?): Nothing =
32-
throw FeatureDevException(message, cause)
52+
class GuardrailsException(operation: String, desc: String?, cause: Throwable? = null) :
53+
FeatureDevException(message("amazonqFeatureDev.exception.guardrails"), operation, desc, cause)
3354

34-
internal fun exportParseError(): Nothing =
35-
throw FeatureDevException(message("amazonqFeatureDev.exception.export_parsing_error"))
55+
class PromptRefusalException(operation: String, desc: String?, cause: Throwable? = null) :
56+
FeatureDevException(message("amazonqFeatureDev.exception.prompt_refusal"), operation, desc, cause)
57+
58+
class ThrottlingException(operation: String, desc: String?, cause: Throwable? = null) :
59+
FeatureDevException(message("amazonqFeatureDev.exception.throttling"), operation, desc, cause)
60+
61+
class ExportParseException(operation: String, desc: String?, cause: Throwable? = null) :
62+
FeatureDevException(message("amazonqFeatureDev.exception.export_parsing_error"), operation, desc, cause)
63+
64+
class CodeGenerationException(operation: String, desc: String?, cause: Throwable? = null) :
65+
FeatureDevException(message("amazonqFeatureDev.code_generation.failed_generation"), operation, desc, cause)
66+
67+
class UploadCodeException(operation: String, desc: String?, cause: Throwable? = null) :
68+
FeatureDevException(message("amazonqFeatureDev.exception.upload_code"), operation, desc, cause)
69+
70+
class ConversationIdNotFoundException(operation: String, desc: String?, cause: Throwable? = null) :
71+
FeatureDevException(message("amazonqFeatureDev.exception.conversation_not_found"), operation, desc, cause)
3672

3773
val denyListedErrors = arrayOf("Deserialization error", "Inaccessible host", "UnknownHost")
3874
fun createUserFacingErrorMessage(message: String?): String? =

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/controller/FeatureDevController.kt

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ import software.aws.toolkits.jetbrains.services.amazonq.RepoSizeError
2929
import software.aws.toolkits.jetbrains.services.amazonq.apps.AmazonQAppInitContext
3030
import software.aws.toolkits.jetbrains.services.amazonq.auth.AuthController
3131
import software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindowFactory
32-
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.CodeIterationLimitError
32+
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.CodeIterationLimitException
3333
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.DEFAULT_RETRY_LIMIT
3434
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.FEATURE_NAME
3535
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.FeatureDevException
3636
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.InboundAppMessagesHandler
3737
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.ModifySourceFolderErrorReason
3838
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.MonthlyConversationLimitError
39-
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.ZipFileError
39+
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.NoChangeRequiredException
40+
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.UploadURLExpired
41+
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.ZipFileCorruptedException
4042
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.createUserFacingErrorMessage
4143
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.denyListedErrors
4244
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.FeatureDevMessageType
@@ -350,7 +352,7 @@ class FeatureDevController(
350352
}
351353
}
352354

353-
private suspend fun newTask(tabId: String) {
355+
private suspend fun newTask(tabId: String, isException: Boolean? = false) {
354356
val session = getSessionInfo(tabId)
355357
val sessionLatency = System.currentTimeMillis() - session.sessionStartTime
356358
AmazonqTelemetry.endChat(
@@ -361,9 +363,15 @@ class FeatureDevController(
361363
chatSessionStorage.deleteSession(tabId)
362364

363365
newTabOpened(tabId)
364-
365-
messenger.sendAnswer(tabId = tabId, messageType = FeatureDevMessageType.Answer, message = message("amazonqFeatureDev.chat_message.ask_for_new_task"))
366+
if (isException != null && !isException) {
367+
messenger.sendAnswer(
368+
tabId = tabId,
369+
messageType = FeatureDevMessageType.Answer,
370+
message = message("amazonqFeatureDev.chat_message.ask_for_new_task")
371+
)
372+
}
366373
messenger.sendUpdatePlaceholder(tabId = tabId, newPlaceholder = message("amazonqFeatureDev.placeholder.new_plan"))
374+
messenger.sendChatInputEnabledMessage(tabId = tabId, enabled = true)
367375
}
368376

369377
private suspend fun closeSession(tabId: String) {
@@ -432,7 +440,17 @@ class FeatureDevController(
432440
),
433441
)
434442
}
435-
is ZipFileError -> {
443+
is NoChangeRequiredException -> {
444+
val isException = true
445+
messenger.sendAnswer(
446+
tabId = tabId,
447+
message = err.message,
448+
messageType = FeatureDevMessageType.Answer,
449+
canBeVoted = true
450+
)
451+
return this.newTask(message, isException)
452+
}
453+
is ZipFileCorruptedException -> {
436454
messenger.sendError(
437455
tabId = tabId,
438456
errMessage = err.message,
@@ -444,15 +462,13 @@ class FeatureDevController(
444462
messenger.sendMonthlyLimitError(tabId = tabId)
445463
messenger.sendChatInputEnabledMessage(tabId, enabled = false)
446464
}
447-
is FeatureDevException -> {
448-
messenger.sendError(
449-
tabId = tabId,
450-
errMessage = err.message,
451-
retries = retriesRemaining(session),
452-
conversationId = session?.conversationIdUnsafe
453-
)
454-
}
455-
is CodeIterationLimitError -> {
465+
is UploadURLExpired -> messenger.sendAnswer(
466+
tabId = tabId,
467+
message = err.message,
468+
messageType = FeatureDevMessageType.Answer,
469+
canBeVoted = true
470+
)
471+
is CodeIterationLimitException -> {
456472
messenger.sendError(
457473
tabId = tabId,
458474
errMessage = err.message,
@@ -471,26 +487,37 @@ class FeatureDevController(
471487
),
472488
)
473489
}
474-
475490
else -> {
476-
var msg = createUserFacingErrorMessage("$FEATURE_NAME request failed: ${err.message ?: err.cause?.message}")
477-
val isDenyListedError = denyListedErrors.any { msg?.contains(it) ?: false }
478-
val defaultMessage: String = when (session?.sessionState?.phase) {
479-
SessionStatePhase.CODEGEN -> {
480-
if (isDenyListedError || retriesRemaining(session) > 0) {
481-
message("amazonqFeatureDev.code_generation.error_message")
482-
} else {
483-
message("amazonqFeatureDev.code_generation.no_retries.error_message")
491+
when (err) {
492+
is FeatureDevException -> {
493+
messenger.sendError(
494+
tabId = tabId,
495+
errMessage = err.message,
496+
retries = retriesRemaining(session),
497+
conversationId = session?.conversationIdUnsafe
498+
)
499+
}
500+
else -> {
501+
val msg = createUserFacingErrorMessage("$FEATURE_NAME request failed: ${err.message ?: err.cause?.message}")
502+
val isDenyListedError = denyListedErrors.any { msg?.contains(it) ?: false }
503+
val defaultMessage: String = when (session?.sessionState?.phase) {
504+
SessionStatePhase.CODEGEN -> {
505+
if (isDenyListedError || retriesRemaining(session) > 0) {
506+
message("amazonqFeatureDev.code_generation.error_message")
507+
} else {
508+
message("amazonqFeatureDev.code_generation.no_retries.error_message")
509+
}
510+
}
511+
else -> message("amazonqFeatureDev.error_text")
484512
}
513+
messenger.sendError(
514+
tabId = tabId,
515+
errMessage = defaultMessage,
516+
retries = retriesRemaining(session),
517+
conversationId = session?.conversationIdUnsafe
518+
)
485519
}
486-
else -> message("amazonqFeatureDev.error_text")
487520
}
488-
messenger.sendError(
489-
tabId = tabId,
490-
errMessage = defaultMessage,
491-
retries = retriesRemaining(session),
492-
conversationId = session?.conversationIdUnsafe
493-
)
494521
}
495522
}
496523
}

0 commit comments

Comments
 (0)