Skip to content

Commit 98f6b77

Browse files
authored
fix(codewhisperer): only send user decision when invocation succeeded (#3167)
## Problem We are currently sending empty user_decision events when invocation failed(connection expired, etc.) ## Solution Only send empty user decision when the invocation was successful
1 parent daf7a23 commit 98f6b77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/codewhisperer/service/recommendationHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export class RecommendationHandler {
266266
codewhispererTriggerType: triggerType,
267267
codewhispererAutomatedTriggerType: autoTriggerType,
268268
codewhispererCompletionType:
269-
invocationResult == 'Succeeded' ? TelemetryHelper.instance.completionType : undefined,
269+
invocationResult === 'Succeeded' ? TelemetryHelper.instance.completionType : undefined,
270270
result: invocationResult,
271271
duration: latency ? latency : 0,
272272
codewhispererLineNumber: this.startPos.line ? this.startPos.line : 0,
@@ -278,7 +278,7 @@ export class RecommendationHandler {
278278
credentialStartUrl: TelemetryHelper.instance.startUrl,
279279
})
280280
}
281-
if (invocationResult == 'Succeeded') {
281+
if (invocationResult === 'Succeeded') {
282282
CodeWhispererCodeCoverageTracker.getTracker(languageContext.language)?.incrementServiceInvocationCount()
283283
}
284284
}
@@ -301,7 +301,7 @@ export class RecommendationHandler {
301301
this._onDidReceiveRecommendation.fire()
302302
}
303303
// send Empty userDecision event if user receives no recommendations in this session at all.
304-
if (this.recommendations.length === 0 && nextToken === '') {
304+
if (invocationResult === 'Succeeded' && this.recommendations.length === 0 && nextToken === '') {
305305
TelemetryHelper.instance.recordUserDecisionTelemetryForEmptyList(
306306
requestId,
307307
sessionId,

0 commit comments

Comments
 (0)