refactor(xtab): extract _performFetch from _streamEditsImpl
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
* ghost: debt: migrate to CompletionsFetchService and remove dead code
* ghost: propagate copilotAnnotations in convertStreamToApiChoices
The v2 stream processor (convertStreamToApiChoices) was not setting
copilotAnnotations on the returned APIChoice objects, despite tracking
them in the CompletionAccumulator. This caused annotations (e.g., code
citations) to be lost.
Add accumulator.annotations.current to the createAPIChoice helper.
* ghost: fix tests to mock ICompletionsFetchService for v2
After migrating to CompletionsFetchService, LiveOpenAIFetcher no longer
calls ICompletionsFetcherService (via postRequest). Tests that mocked
the old low-level fetcher with StaticFetcher were silently bypassed.
Add StaticCompletionsFetchService adapter that bridges StaticFetcher
responses into ICompletionsFetchService by parsing SSE bodies through
jsonlStreamToCompletions. Wire it up in ghostText.test.ts and
inlineCompletion.test.ts setupCompletion helpers.
Without this, `this._controller.items.get(uri)` returns undefined... but the metadata is stored on the item so that is needed to resolve.
FYI @mjbvz as an interesting quirk of the API.
- Add isClientBYOKEnabled() method to CopilotToken class
- Update isBYOKEnabled to allow users with client_byok=1 token flag
- Add github.copilot.clientByokEnabled context key for VS Code core model picker
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* nes: replace implicit _icon state with explicit outcome state machine (#308719)
Replace the implicit \`_icon\` field with an explicit \`_outcome: LogContextOutcome\`
discriminated union in InlineEditRequestLogContext.
- Define LogContextOutcome type with 8 states: pending, succeeded,
noSuggestions, cached, cachedFromGhostText, skipped, cancelled, errored
- Derive icon from outcome via switch in _resolveIcon()
- Keep _isCompleted orthogonal (lifecycle flag, not an outcome)
- Add _setOutcome() with debug warning on invalid re-transitions
- Refactor setIsCachedResult to use direct field copy (avoids
triggering outcome transitions during bulk data inheritance)
- Add double-completion warning in markCompleted()
- No caller changes required — public method signatures unchanged
* nes: unify live and static log entry paths (#308720, #308722)
Remove the static \`add()\` path from InlineEditLogger — all log entries
now use the live pattern with callbacks for icon/content resolution.
- Remove InlineEditLogger.add() and _liveRequestIds tracking
- Ghost text provider now uses addLive() + markCompleted() in finally
block, ensuring lifecycle is always closed
- Remove redundant add() call in NES inlineCompletionProvider (the live
entry was already registered via addLive())
This eliminates the static snapshot path that was the source of frozen
spinner bugs, and ensures ghost text entries have proper lifecycle
management matching the NES pattern.
* nes: fix stale icon caching in ChatPromptItem tree nodes (#308721)
Store the main entry reference in ChatPromptItem and always resolve
the icon unconditionally from it, preventing stale icon snapshots.
- Add _mainEntryRef field to ChatPromptItem
- setMainEntry() always sets iconPath (even to undefined when icon
resolves to undefined), clearing any previous stale value
- withFilteredChildren() re-resolves from the entry ref via
setMainEntry() instead of copying a potentially stale iconPath
This makes stale icons structurally impossible — the icon is always
derived from the live entry state on each tree refresh.
* nes: map cancelled outcome to skipped icon instead of loading
Cancelled requests should show a terminal icon, not a spinner.
Map 'cancelled' to Icon.skipped alongside 'skipped' to avoid
frozen-spinner appearance in the log tree.
* refactor: remove getSessionIdForWorkspaceFolder method and update clearWorkspaceChanges to handle both session IDs and folder URIs
* Address comments
Refactor applyPackageJsonPatch to remove isPreRelease parameter and derive it from VSCODE_QUALITY environment variable; add getDateBasedPatch function for versioning
Co-authored-by: Copilot <copilot@github.com>
Adds worktree deletion on archive and recreation on unarchive for both
the legacy provider API and the new controller API.
- Expose onDidChangeChatSessionItemState on the return value of
registerChatSessionItemProvider via Object.assign
- Wire up archive/unarchive handling at the V1 registration site in
chatSessions.ts using the exposed event
- Refresh session items after worktree recreation so changes and stats
are recomputed in the UI
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>