Skip to content

Commit ba18d86

Browse files
authored
fix(chat): Fixing bug in read files and in accepting permissions (aws#7055)
## Problem - Message should be provided as part of header body but right now its passed as body directly. ![image](https://github.com/user-attachments/assets/d5e6fbf9-a642-48f1-b18c-46c110364704) - In existing IDE experience, If user asks a second question in the same chat tab, IDE overrides the first workflow read files with second workflow read files because `session.setMessageIdToUpdate` is unchanged(not defined to undefined after completion of first request.) ## Solution - Fixed in this as passing as part of header body. ![image](https://github.com/user-attachments/assets/49e6d328-1869-4d83-85ba-ecc3066f608f) - Cleaning the `session.setMessageIdToUpdate` value so for second request IDE won't update the first request read fileTree. ![image](https://github.com/user-attachments/assets/1574aae9-c353-4793-a682-61388ed36faa) --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 28168cb commit ba18d86

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,20 +1286,24 @@ export class ChatController {
12861286
this.processException(e, message.tabID)
12871287
}
12881288
}
1289+
private sessionCleanUp(session: ChatSession) {
1290+
// Create a fresh token for this new conversation
1291+
session.createNewTokenSource()
1292+
session.setAgenticLoopInProgress(true)
1293+
session.clearListOfReadFiles()
1294+
session.clearListOfReadFolders()
1295+
session.setShowDiffOnFileWrite(false)
1296+
session.setMessageIdToUpdate(undefined)
1297+
session.setMessageIdToUpdateListDirectory(undefined)
1298+
}
12891299

12901300
private async processPromptMessageAsNewThread(message: PromptMessage) {
12911301
const session = this.sessionStorage.getSession(message.tabID)
12921302
// If there's an existing conversation, ensure we dispose the previous token
12931303
if (session.agenticLoopInProgress) {
12941304
session.disposeTokenSource()
12951305
}
1296-
1297-
// Create a fresh token for this new conversation
1298-
session.createNewTokenSource()
1299-
session.setAgenticLoopInProgress(true)
1300-
session.clearListOfReadFiles()
1301-
session.clearListOfReadFolders()
1302-
session.setShowDiffOnFileWrite(false)
1306+
this.sessionCleanUp(session)
13031307
this.editorContextExtractor
13041308
.extractContextForTrigger('ChatMessage')
13051309
.then(async (context) => {

packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,9 @@ export class Messenger {
844844
]
845845
header = {
846846
buttons,
847+
body: message,
847848
}
849+
message = ''
848850
}
849851
}
850852

0 commit comments

Comments
 (0)