Skip to content

Commit ebb0c92

Browse files
authored
feat(dev): include in progress state agent details in code generation (#5489)
## Problem 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. ## Solution This PR provides exposure for the codeGenerationStatusDetail which will be leveraged to return the strings in the following format: LLM actions example returned: "I have reviewed 7 files and applied changes to 3 files in total so far. Most recently, I reviewed 2 files and applied changes to 1 file. " Error scenario while IN_PROGRESS: "The previous attempt failed. I am retrying now. For reference, the previous attempt took approximately 1 minute and involved 3 files."
1 parent 3466dda commit ebb0c92

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
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+
}

packages/core/src/amazonqFeatureDev/session/sessionState.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { AuthUtil } from '../../codewhisperer/util/authUtil'
4343
import { randomUUID } from '../../shared/crypto'
4444
import { collectFiles, getWorkspaceFoldersByPrefixes } from '../../shared/utilities/workspaceUtils'
4545
import { i18n } from '../../shared/i18n-helper'
46+
import { Messenger } from '../controllers/chat/messenger/messenger'
4647

4748
export class ConversationNotStartedState implements Omit<SessionState, 'uploadId'> {
4849
public tokenSource: vscode.CancellationTokenSource
@@ -245,11 +246,13 @@ abstract class CodeGenBase {
245246
}
246247

247248
async generateCode({
249+
messenger,
248250
fs,
249251
codeGenerationId,
250252
telemetry: telemetry,
251253
workspaceFolders,
252254
}: {
255+
messenger: Messenger
253256
fs: VirtualFileSystem
254257
codeGenerationId: string
255258
telemetry: TelemetryHelper
@@ -278,6 +281,7 @@ abstract class CodeGenBase {
278281
await this.config.proxyClient.exportResultArchive(this.conversationId)
279282
const newFileInfo = registerNewFiles(fs, newFileContents, this.uploadId, workspaceFolders)
280283
telemetry.setNumberOfFilesGenerated(newFileInfo.length)
284+
281285
return {
282286
newFiles: newFileInfo,
283287
deletedFiles: getDeletedFileInfos(deletedFiles, workspaceFolders),
@@ -288,6 +292,15 @@ abstract class CodeGenBase {
288292
}
289293
case CodeGenerationStatus.PREDICT_READY:
290294
case CodeGenerationStatus.IN_PROGRESS: {
295+
if (codegenResult.codeGenerationStatusDetail) {
296+
messenger.sendAnswer({
297+
message:
298+
i18n('AWS.amazonq.featureDev.pillText.generatingCode') +
299+
`\n\n${codegenResult.codeGenerationStatusDetail}`,
300+
type: 'answer-part',
301+
tabID: this.tabID,
302+
})
303+
}
291304
await new Promise((f) => globals.clock.setTimeout(f, this.requestDelay))
292305
break
293306
}
@@ -381,11 +394,13 @@ export class CodeGenState extends CodeGenBase implements SessionState {
381394
})
382395

383396
const codeGeneration = await this.generateCode({
397+
messenger: action.messenger,
384398
fs: action.fs,
385399
codeGenerationId,
386400
telemetry: action.telemetry,
387401
workspaceFolders: this.config.workspaceFolders,
388402
})
403+
389404
this.filePaths = codeGeneration.newFiles
390405
this.deletedFiles = codeGeneration.deletedFiles
391406
this.references = codeGeneration.references

0 commit comments

Comments
 (0)