Skip to content

Commit 55cf8d1

Browse files
authored
fix: do not include references in request history (#1066)
## Related commit in agentic chat branch aws/aws-toolkit-vscode@6f0dc14 ## Problem - We currently include codeReferences as part of the history field in the request which can sometimes cause validation issues - We are currently only retrieving the last 10 messages in the history. This will break the history validation ## Solution - Do not include references in request history - Retrieve entire history then call fixHistory when sending request
1 parent e9e63b5 commit 55cf8d1

File tree

5 files changed

+3
-7
lines changed

5 files changed

+3
-7
lines changed

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ describe('AgenticChatController', () => {
368368
)
369369

370370
// Verify that history was requested from the db
371-
sinon.assert.calledWith(getMessagesStub, mockTabId, 10)
371+
sinon.assert.calledWith(getMessagesStub, mockTabId)
372372

373373
assert.ok(generateAssistantResponseStub.calledOnce)
374374

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export class AgenticChatController implements ChatHandlers {
345345
this.#customizationArn,
346346
chatResultStream,
347347
profileArn,
348-
this.#chatHistoryDb.getMessages(params.tabId, 10),
348+
this.#chatHistoryDb.getMessages(params.tabId),
349349
this.#getTools(session),
350350
additionalContext
351351
)

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ describe('ChatDb Utilities', () => {
5252
assistantResponseMessage: {
5353
messageId: 'msg-1',
5454
content: 'Response',
55-
references: [
56-
{ url: 'test.js', recommendationContentSpan: { start: 10, end: 15 }, information: '' },
57-
],
5855
toolUses: [],
5956
},
6057
})

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export function messageToStreamingMessage(msg: Message): StreamingMessage {
7979
assistantResponseMessage: {
8080
messageId: msg.messageId,
8181
content: msg.body,
82-
references: msg.codeReference || [],
8382
toolUses: msg.toolUses || [],
8483
},
8584
}

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fsWrite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class FsWrite {
155155
and otherwise create a new file\n * The `append` command will add content to the end of an existing file, \
156156
automatically adding a newline if the file does not end with one. \
157157
The file must exist.\n Notes for using the `strReplace` command:\n * \
158-
IMPORTANT: For the `fsWrite` tool, only use the `strReplace` command for simple, isolated single-line replacements. \
158+
IMPORTANT: Only use the `strReplace` command for simple, isolated single-line replacements. \
159159
If you are editing multiple lines, always prefer the `create` command and replace the entire file content instead.\n * \
160160
The `oldStr` parameter should match EXACTLY one or more consecutive lines from the original file. Be mindful of whitespaces!\n * \
161161
If the `oldStr` parameter is not unique in the file, the replacement will not be performed. \

0 commit comments

Comments
 (0)