Try cleaning up api around acquiring/loading/creating sessions#296628
Merged
mjbvz merged 2 commits intomicrosoft:mainfrom Feb 20, 2026
Merged
Try cleaning up api around acquiring/loading/creating sessions#296628mjbvz merged 2 commits intomicrosoft:mainfrom
mjbvz merged 2 commits intomicrosoft:mainfrom
Conversation
We have a number of methods that have fairly similar names (get, load, acquire, start). This change tries to align these names a bit more so it's easier to understand which one to use
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @jriekenMatched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns and clarifies the internal IChatService session lifecycle API by renaming/reshaping methods so call sites consistently express whether they are starting a new local session vs acquiring/loading an existing one.
Changes:
- Renames session lifecycle methods (e.g.
startSession→startNewLocalSession,loadSessionForResource/getOrRestoreSession→acquireOrLoadSession,loadSessionFromContent→loadSessionFromData,getActiveSessionReference→acquireExistingSession). - Updates call sites across chat hosts (view pane/editor/quick/terminal/inline chat) and sessions UI to use the new API.
- Adjusts tests/mocks and small model-store typing cleanups to match the new interface.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.ts | Uses new acquire/load + start-new-local session APIs when initializing welcome chat. |
| src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.ts | Starts terminal chat sessions via startNewLocalSession. |
| src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.ts | Starts inline-editor chat sessions via startNewLocalSession. |
| src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.ts | Updates panel-chat helper to start new local sessions. |
| src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts | Updates edit review flows to start new local sessions. |
| src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts | Renames mocked methods to match the updated IChatService API. |
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Updates tests to use the new session lifecycle method names/params. |
| src/vs/workbench/contrib/chat/test/browser/chatEditing/chatEditingService.test.ts | Updates editing tests to use startNewLocalSession. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/localAgentSessionsController.test.ts | Updates test mock method names for session acquisition/loading. |
| src/vs/workbench/contrib/chat/common/model/chatModelStore.ts | Removes redundant IDisposable usage/import (Disposable already covers it). |
| src/vs/workbench/contrib/chat/common/model/chatModel.ts | Updates self-reference acquisition to acquireExistingSession. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Implements the renamed APIs and splits local vs remote load paths. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Updates IChatService interface docs and method names for clarity. |
| src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.ts | Uses acquireOrLoadSession + startNewLocalSession for restore/start flows. |
| src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput.ts | Uses acquireOrLoadSession, startNewLocalSession, and loadSessionFromData in editor resolution. |
| src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.ts | Uses startNewLocalSession for quick chat model initialization. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | Loads sessions for chat-options execution via acquireOrLoadSession. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.ts | Loads hover session models via acquireOrLoadSession. |
| src/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts | Imports now load sessions via loadSessionFromData. |
| src/vs/workbench/contrib/chat/browser/actions/chatForkActions.ts | Fork now uses loadSessionFromData for creating the new forked model. |
| src/vs/workbench/api/browser/mainThreadChatSessions.ts | Updates main thread session handling to use new acquire/load methods. |
| src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts | Uses acquireOrLoadSession when opening remote sessions / applying options. |
| src/vs/sessions/contrib/chat/browser/branchChatSessionAction.ts | Loads branched session data via loadSessionFromData. |
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
Outdated
Show resolved
Hide resolved
…pl.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dmitrivMS
approved these changes
Feb 20, 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.
We have a number of methods that have fairly similar names (get, load, acquire, start). This change tries to align these names a bit more so it's easier to understand which one to use