nes: xtab: refactor: extract _performFetch from _streamEditsImpl#308778
Merged
nes: xtab: refactor: extract _performFetch from _streamEditsImpl#308778
Conversation
Separate the HTTP fetch lifecycle (FetchStreamSource setup, makeChatRequest2, initial error handling, line stream construction with cursor-tag removal and latency logging) into a dedicated _performFetch method. This makes the fetch infrastructure self-contained and returns a clean AsyncIterable<string> line stream + getFetchFailure callback for downstream format handlers, matching the pattern already used by XtabCustomDiffPatchResponseHandler. _streamEditsImpl is now a coordinator: it calls _performFetch, then dispatches to format handlers, then post-processes edit-window results. Part of #308744
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors XtabProvider’s NES streaming flow by extracting the HTTP fetch/stream setup from _streamEditsImpl into a dedicated _performFetch helper, so downstream response format handlers operate on a clean AsyncIterable<string> line stream and fetch-failure callback.
Changes:
- Introduced a
FetchResultresult union to represent either a line stream, a model-not-found retry signal, or a fetch error. - Added
_performFetch(...)to encapsulatemakeChatRequest2lifecycle, stream wiring, cursor-tag removal, and latency logging. - Simplified
_streamEditsImplinto a two-phase coordinator: fetch → dispatch to response-format handlers → post-process edits.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/xtab/node/xtabProvider.ts | Extracts fetch lifecycle into _performFetch and updates _streamEditsImpl to consume a standardized fetch result/line stream. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
rzhao271
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Separate the HTTP fetch lifecycle (FetchStreamSource setup, makeChatRequest2, initial error handling, line stream construction with cursor-tag removal and latency logging) into a dedicated _performFetch method.
This makes the fetch infrastructure self-contained and returns a clean AsyncIterable line stream + getFetchFailure callback for downstream format handlers, matching the pattern already used by XtabCustomDiffPatchResponseHandler.
_streamEditsImpl is now a coordinator: it calls _performFetch, then dispatches to format handlers, then post-processes edit-window results.
Part of #308744