Skip to content

Conversation

@benibenj
Copy link
Contributor

Copilot Generated Description: Correct the telemetry reporting for inline completions that are not shown to the user, ensuring that only relevant events are tracked.

Copilot AI review requested due to automatic review settings January 28, 2026 16:02
@benibenj benibenj enabled auto-merge January 28, 2026 16:02
@benibenj benibenj self-assigned this Jan 28, 2026
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 28, 2026
Copy link
Contributor

Copilot AI left a 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 reportInlineEditShown from running once end-of-life has already been reported.
  • Downgrades end-of-life Rejected to Ignored when the suggestion was never shown to the user.

Comment on lines +432 to +436
// 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 };
}
Copy link

Copilot AI Jan 28, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +432 to +436
// 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 };
}
Copy link

Copilot AI Jan 28, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines 380 to 384
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;
Copy link

Copilot AI Jan 28, 2026

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 uses AI. Check for mistakes.
@benibenj benibenj merged commit 3891e9f into main Jan 28, 2026
27 of 28 checks passed
@benibenj benibenj deleted the benibenj/solid-grouse branch January 28, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants