@@ -126,7 +126,7 @@ abstract class CodeGenBase {
126126 public phase : SessionStatePhase = DevPhase . CODEGEN
127127 public readonly conversationId : string
128128 public readonly uploadId : string
129- public readonly currentCodeGenerationId ?: string
129+ public currentCodeGenerationId ?: string
130130
131131 constructor (
132132 protected config : SessionStateConfig ,
@@ -274,6 +274,7 @@ export class CodeGenState extends CodeGenBase implements SessionState {
274274
275275 action . tokenSource ?. token . onCancellationRequested ( ( ) => {
276276 this . isCancellationRequested = true
277+ if ( action . tokenSource ) this . tokenSource = action . tokenSource
277278 action . tokenSource ?. dispose ( )
278279 action . tokenSource = undefined
279280 } )
@@ -285,9 +286,12 @@ export class CodeGenState extends CodeGenBase implements SessionState {
285286 this . config . conversationId ,
286287 this . config . uploadId ,
287288 action . msg ,
288- this . config . currentCodeGenerationId
289+ this . currentCodeGenerationId
289290 )
290291
292+ this . currentCodeGenerationId = codeGenerationId
293+ this . config . currentCodeGenerationId = codeGenerationId
294+
291295 if ( ! this . isCancellationRequested ) {
292296 action . messenger . sendAnswer ( {
293297 message : i18n ( 'AWS.amazonq.featureDev.pillText.generatingCode' ) ,
@@ -325,7 +329,8 @@ export class CodeGenState extends CodeGenBase implements SessionState {
325329 this . currentIteration + 1 ,
326330 this . codeGenerationRemainingIterationCount ,
327331 this . codeGenerationTotalIterationCount ,
328- this . tokenSource
332+ this . tokenSource ,
333+ this . currentCodeGenerationId
329334 )
330335 return {
331336 nextState,
@@ -428,7 +433,6 @@ export class MockCodeGenState implements SessionState {
428433export class PrepareCodeGenState implements SessionState {
429434 public readonly phase = DevPhase . CODEGEN
430435 public uploadId : string
431- public currentCodeGenerationId ?: string
432436 public conversationId : string
433437 public tokenSource : vscode . CancellationTokenSource
434438 constructor (
@@ -440,11 +444,12 @@ export class PrepareCodeGenState implements SessionState {
440444 private currentIteration : number ,
441445 public codeGenerationRemainingIterationCount ?: number ,
442446 public codeGenerationTotalIterationCount ?: number ,
443- public superTokenSource ?: vscode . CancellationTokenSource
447+ public superTokenSource ?: vscode . CancellationTokenSource ,
448+ public currentCodeGenerationId ?: string
444449 ) {
445450 this . tokenSource = superTokenSource || new vscode . CancellationTokenSource ( )
446451 this . uploadId = config . uploadId
447- this . currentCodeGenerationId = config . currentCodeGenerationId
452+ this . currentCodeGenerationId = currentCodeGenerationId
448453 this . conversationId = config . conversationId
449454 }
450455
@@ -496,7 +501,7 @@ export class PrepareCodeGenState implements SessionState {
496501 this . uploadId = uploadId
497502 }
498503 const nextState = new CodeGenState (
499- { ...this . config , uploadId : this . uploadId , currentCodeGenerationId : this . config . currentCodeGenerationId } ,
504+ { ...this . config , uploadId : this . uploadId , currentCodeGenerationId : this . currentCodeGenerationId } ,
500505 this . filePaths ,
501506 this . deletedFiles ,
502507 this . references ,
0 commit comments