-
Notifications
You must be signed in to change notification settings - Fork 37.9k
Fix incorrect telemetry for inline completions #291315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… shown to the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adjusts inline completion lifetime telemetry so that “shown” and “rejected” are only reported when the suggestion was actually presented to the user.
Changes:
- Prevents
reportInlineEditShownfrom running once end-of-life has already been reported. - Downgrades end-of-life
RejectedtoIgnoredwhen the suggestion was never shown to the user.
| // A suggestion can only be "rejected" if it was actually shown to the user. | ||
| // If the suggestion was never shown, downgrade to "ignored". | ||
| if (reason.kind === InlineCompletionEndOfLifeReasonKind.Rejected && !this._didShow) { | ||
| reason = { kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: undefined }; | ||
| } |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The { kind: Ignored, userTypingDisagreed: false, supersededBy: undefined } literal is now duplicated (here and in the default reason assignment above). To avoid the two getting out of sync over time, consider factoring this into a small helper/const (e.g. const defaultIgnoredReason = ...) and reusing it in both places.
| // A suggestion can only be "rejected" if it was actually shown to the user. | ||
| // If the suggestion was never shown, downgrade to "ignored". | ||
| if (reason.kind === InlineCompletionEndOfLifeReasonKind.Rejected && !this._didShow) { | ||
| reason = { kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: undefined }; | ||
| } |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change alters end-of-life classification (downgrading Rejected to Ignored when the suggestion was never shown). There are existing inline completions browser tests; please add a focused test that exercises stop('explicitCancel') (or equivalent) before the first reportInlineEditShown and asserts the provider receives Ignored (and that handleRejection is not called) to prevent regressions in telemetry/provider callbacks.
| public async reportInlineEditShown(commandService: ICommandService, updatedInsertText: string, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData, editKind: InlineSuggestionEditKind | undefined, timeWhenShown: number): Promise<void> { | ||
| this.updateShownDuration(viewKind); | ||
|
|
||
| if (this._didShow) { | ||
| if (this._didShow || this._didReportEndOfLife) { | ||
| return; |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateShownDuration(viewKind) runs even when _didReportEndOfLife is already true. This can re-open _showStartTime / _showUncollapsedStartTime after end-of-life (e.g. setTimeout0-scheduled handleInlineSuggestionShown firing late), leaving timers running and potentially skewing internal duration state. Consider returning early when _didReportEndOfLife is true before calling updateShownDuration, while keeping the existing updateShownDuration call for the _didShow fast-path (e.g. if (_didReportEndOfLife) return; updateShownDuration(...); if (_didShow) return;).
See below for a potential fix:
if (this._didReportEndOfLife) {
return;
}
this.updateShownDuration(viewKind);
if (this._didShow) {
Copilot Generated Description:Correct the telemetry reporting for inline completions that are not shown to the user, ensuring that only relevant events are tracked.