Skip to content

Conversation

@ulugbekna
Copy link
Contributor

No description provided.

@ulugbekna ulugbekna self-assigned this Jan 1, 2026
@ulugbekna ulugbekna force-pushed the ulugbekna/supplant-completions-fetcher-3 branch 8 times, most recently from da853ea to fd25c2a Compare January 13, 2026 17:42
@ulugbekna ulugbekna force-pushed the ulugbekna/supplant-completions-fetcher-3 branch 3 times, most recently from ab0f1c5 to 0abbb75 Compare January 15, 2026 09:45
@ulugbekna ulugbekna changed the title ghost: refactor: adopt service injection more ghost: use CompletionsFetchService Jan 15, 2026
@ulugbekna ulugbekna force-pushed the ulugbekna/supplant-completions-fetcher-3 branch from 0abbb75 to c861abc Compare January 15, 2026 10:10
@ulugbekna ulugbekna marked this pull request as ready for review January 15, 2026 10:11
Copilot AI review requested due to automatic review settings January 15, 2026 10:11
@ulugbekna ulugbekna enabled auto-merge January 15, 2026 10:11
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 15, 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

This pull request refactors the ghost text completion system to use the CompletionsFetchService abstraction layer. This change aims to consolidate the network fetching logic and improve code maintainability by removing duplicate streaming/filtering logic.

Changes:

  • Introduces a new fetchAndStreamCompletions2 method in the fetcher service that uses CompletionsFetchService for network requests
  • Moves CopilotAnnotation types to a shared platform location for reuse across different parts of the codebase
  • Removes the QuotaExceeded error type in favor of handling it through UnsuccessfulResponse with proper status codes
  • Simplifies function signatures by removing unused parameters (e.g., triggerCategory, triggerKind)

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/platform/completions-core/common/openai/copilotAnnotations.ts New shared location for CopilotAnnotation types, moved from extension-specific code
src/platform/nesFetch/node/completionsFetchServiceImpl.ts Updated to return enhanced FetchResponse with requestId and response, removed obsolete headersObjectToKv helper
src/platform/nesFetch/common/responseStream.ts Added destroy() method and constructor parameters for request tracking
src/platform/nesFetch/common/completionsFetchService.ts Removed QuotaExceeded error class, updated UnsuccessfulResponse to include headers and text getter
src/platform/networking/common/fetch.ts Refactored getRequestId to accept IHeaders instead of Response for better reusability
src/extension/completions-core/vscode-node/lib/src/openai/fetch.ts Added fetchAndStreamCompletions2 implementation with CompletionsFetchService integration and retry logic
src/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.ts Refactored to use class-based CompletionsFromNetwork and added experiment flag for new fetch service
src/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.ts Simplified telemetryShown by removing redundant insertionCategory parameter
src/extension/completions-core/vscode-node/lib/src/ghostText/last.ts Removed unused triggerCategory and triggerKind parameters from acceptance handlers
src/platform/configuration/common/configurationService.ts Added GhostTextUseCompletionsFetchService experiment configuration flag
test/base/*.ts Updated test mocks to match new FetchResponse interface with additional fields
Comments suppressed due to low confidence (1)

src/platform/nesFetch/common/responseStream.ts:77

  • Missing await. The value 'body' is always a promise.
		if (body && 'destroy' in body && typeof body.destroy === 'function') {

@ulugbekna ulugbekna marked this pull request as draft January 15, 2026 10:16
auto-merge was automatically disabled January 15, 2026 10:16

Pull request was converted to draft

@ulugbekna ulugbekna force-pushed the ulugbekna/supplant-completions-fetcher-3 branch from c861abc to 3a117ee Compare January 15, 2026 10:57
@ulugbekna ulugbekna marked this pull request as ready for review January 15, 2026 11:11
@ulugbekna ulugbekna enabled auto-merge January 15, 2026 11:11
@ulugbekna ulugbekna added this pull request to the merge queue Jan 15, 2026
Merged via the queue into main with commit f2544cd Jan 15, 2026
16 of 19 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/supplant-completions-fetcher-3 branch January 15, 2026 12:52
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