Skip to content

Commit b64a7c0

Browse files
authored
/dev: include in progress state agent details in code generation (#4828)
Currently we display a long-running message "Generating code ... " while in code generation still IN_PROGRESS state. There is an often customer feedback based on this experience that its "stuck" or not "progressing". Although the RTS and LLM are processing the request, user expects some feedback on whats is doing or if its actually stuck processing.
1 parent d013977 commit b64a7c0

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "Amazon Q /dev: include in progress state agent in code generation"
4+
}

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CodeGenerationState(
5151
message = message("amazonqFeatureDev.code_generation.generating_code")
5252
)
5353

54-
val codeGenerationResult = generateCode(codeGenerationId = response.codeGenerationId())
54+
val codeGenerationResult = generateCode(codeGenerationId = response.codeGenerationId(), messenger = messenger)
5555
numberOfReferencesGenerated = codeGenerationResult.references.size
5656
numberOfFilesGenerated = codeGenerationResult.newFiles.size
5757
codeGenerationRemainingIterationCount = codeGenerationResult.codeGenerationRemainingIterationCount
@@ -102,7 +102,7 @@ class CodeGenerationState(
102102
}
103103
}
104104

105-
private suspend fun CodeGenerationState.generateCode(codeGenerationId: String): CodeGenerationResult {
105+
private suspend fun CodeGenerationState.generateCode(codeGenerationId: String, messenger: MessagePublisher): CodeGenerationResult {
106106
val pollCount = 180
107107
val requestDelay = 10000L
108108

@@ -129,7 +129,16 @@ private suspend fun CodeGenerationState.generateCode(codeGenerationId: String):
129129
codeGenerationTotalIterationCount = codeGenerationResultState.codeGenerationTotalIterationCount()
130130
)
131131
}
132-
CodeGenerationWorkflowStatus.IN_PROGRESS -> delay(requestDelay)
132+
CodeGenerationWorkflowStatus.IN_PROGRESS -> {
133+
if (codeGenerationResultState.codeGenerationStatusDetail() != null) {
134+
messenger.sendAnswerPart(
135+
tabId = tabID,
136+
message = message("amazonqFeatureDev.code_generation.generating_code") +
137+
"\n\n" + codeGenerationResultState.codeGenerationStatusDetail()
138+
)
139+
}
140+
delay(requestDelay)
141+
}
133142
CodeGenerationWorkflowStatus.FAILED -> {
134143
when (true) {
135144
codeGenerationResultState.codeGenerationStatusDetail()?.contains(

0 commit comments

Comments
 (0)