Skip to content

NES: use git-merge icon for reused in-flight requests#311099

Merged
ulugbekna merged 1 commit intomainfrom
ulugbekna/nes-reuse-request-icon
Apr 17, 2026
Merged

NES: use git-merge icon for reused in-flight requests#311099
ulugbekna merged 1 commit intomainfrom
ulugbekna/nes-reuse-request-icon

Conversation

@ulugbekna
Copy link
Copy Markdown
Contributor

Previously both cache hits and reused in-flight requests (async pending
or speculative) showed the database icon in the NES debug log. This
made it hard to tell whether a result was served from cache or joined
an existing stream.

Add a new `reusedInFlight` outcome with a git-merge icon ($(git-merge))
to visually distinguish 'joined an in-flight request' from 'loaded from
cache'. The database icon is preserved for true cache hits via
`setIsCachedResult`; reused in-flight requests now go through the new
`setIsReusedInFlightResult` method.

Previously both cache hits and reused in-flight requests (async pending
or speculative) showed the database icon in the NES debug log. This
made it hard to tell whether a result was served from cache or joined
an existing stream.

Add a new \`reusedInFlight\` outcome with a git-merge icon ($(git-merge))
to visually distinguish 'joined an in-flight request' from 'loaded from
cache'. The database icon is preserved for true cache hits via
\`setIsCachedResult\`; reused in-flight requests now go through the new
\`setIsReusedInFlightResult\` method.
Copilot AI review requested due to automatic review settings April 17, 2026 21:25
@ulugbekna ulugbekna enabled auto-merge (squash) April 17, 2026 21:25
Copy link
Copy Markdown
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

This PR improves the NES (Next Edit Suggestions) debug log by visually distinguishing “joined an existing in-flight request” from a true cache hit, using a new reusedInFlight outcome rendered with the $(git-merge) icon.

Changes:

  • Add a gitMerge icon to the inline-edits icon set.
  • Introduce reusedInFlight as a new log outcome, including legend text and icon mapping.
  • Update the in-flight join path to mark joined requests as reusedInFlight instead of cached.
Show a summary per file
File Description
extensions/copilot/src/platform/inlineEdits/common/utils/utils.ts Adds Icon.gitMerge (ThemeIcon + SVG) for use in debug log rendering.
extensions/copilot/src/platform/inlineEdits/common/inlineEditLogContext.ts Adds reusedInFlight outcome, legend entry, icon resolution, and a new setter to mark reused-in-flight results.
extensions/copilot/src/extension/inlineEdits/node/nextEditProvider.ts Switches the “join existing request” path to use setIsReusedInFlightResult(...).

Copilot's findings

Comments suppressed due to low confidence (2)

extensions/copilot/src/platform/inlineEdits/common/inlineEditLogContext.ts:323

  • setIsReusedInFlightResult assigns this._logContextOfCachedEdit = .... That makes reused-in-flight requests show up as “cached” in toLogDocument()/toMinimalLog() (e.g. (cached #...), **From cache:** YES) and also sets toJSON().isCachedResult to true. This undermines the goal of distinguishing cache hits vs in-flight reuse; consider tracking reuse separately (e.g. a dedicated field / enum) and updating the derived strings/JSON flags accordingly.
	setIsReusedInFlightResult(logContextOfReusedRequest: InlineEditRequestLogContext): void {
		this._logContextOfCachedEdit = logContextOfReusedRequest;

extensions/copilot/src/platform/inlineEdits/common/inlineEditLogContext.ts:329

  • setIsReusedInFlightResult largely duplicates the direct-field-copy logic from setIsCachedResult. To prevent the two paths from drifting (and to keep future changes consistent), it would be better to extract the shared “inherit fields from other context” logic into a private helper that both methods call, with only the outcome/source-kind differing.
		this.recordingBookmark = logContextOfReusedRequest.recordingBookmark;
		this._nextEditRequest = logContextOfReusedRequest._nextEditRequest ?? this._nextEditRequest;
		this._resultEdit = logContextOfReusedRequest._resultEdit ?? this._resultEdit;
		this._diagnosticsResultEdit = logContextOfReusedRequest._diagnosticsResultEdit ?? this._diagnosticsResultEdit;
		this._endpointInfo = logContextOfReusedRequest._endpointInfo ?? this._endpointInfo;
		this._headerRequestId = logContextOfReusedRequest._headerRequestId ?? this._headerRequestId;
  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment on lines 36 to +40
* - `cancelled`: request was cancelled via CancellationToken (shown as skipped)
* - `errored`: an error occurred
* - `previouslyRejected`: result matches a suggestion that was previously rejected
*/
type LogContextOutcome = 'pending' | 'succeeded' | 'noSuggestions' | 'cached' | 'cachedFromGhostText' | 'skipped' | 'cancelled' | 'errored' | 'previouslyRejected';
type LogContextOutcome = 'pending' | 'succeeded' | 'noSuggestions' | 'cached' | 'cachedFromGhostText' | 'reusedInFlight' | 'skipped' | 'cancelled' | 'errored' | 'previouslyRejected';
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LogContextOutcome JSDoc list above doesn’t mention the new reusedInFlight outcome, so the documentation is now incomplete/misleading. Please add a bullet describing reusedInFlight (and how it differs from cached).

This issue also appears in the following locations of the same file:

  • line 321
  • line 324

Copilot uses AI. Check for mistakes.
Comment on lines 670 to 674

telemetryBuilder.setRequest(nextEditRequest);
logContext.setRequestInput(nextEditRequest);
logContext.setIsCachedResult(nextEditRequest.logContext);
logContext.setIsReusedInFlightResult(nextEditRequest.logContext);

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces a new user-visible debug outcome for “reused in-flight” requests, but there doesn’t appear to be test coverage ensuring the joined-request path sets reusedInFlight (and not cached). Consider adding a test (likely in the existing speculative/async reuse provider specs) that exercises _joinNextEditRequest and asserts the resulting log context outcome/icon/source flags.

Copilot uses AI. Check for mistakes.
@ulugbekna ulugbekna merged commit f83e7c2 into main Apr 17, 2026
30 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/nes-reuse-request-icon branch April 17, 2026 22:23
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 17, 2026
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.

3 participants