diff --git a/packages/amazonq/src/lsp/chat/messages.ts b/packages/amazonq/src/lsp/chat/messages.ts index 37acb43e7b9..9578858b708 100644 --- a/packages/amazonq/src/lsp/chat/messages.ts +++ b/packages/amazonq/src/lsp/chat/messages.ts @@ -532,10 +532,6 @@ async function handlePartialResult( tabId: tabId, }) } - - for (const ref of decryptedMessage.codeReference ?? []) { - ReferenceLogViewProvider.instance.addReferenceLog(referenceLogText(ref)) - } } /** @@ -556,6 +552,8 @@ async function handleCompleteResult( params: decryptedMessage, tabId: tabId, }) + + // only add the reference log once the request is complete, otherwise we will get duplicate log items for (const ref of decryptedMessage.codeReference ?? []) { ReferenceLogViewProvider.instance.addReferenceLog(referenceLogText(ref)) }