fix: Persist third-party model chat sessions locally to prevent history loss#295757
Open
bxf1001g wants to merge 2 commits intomicrosoft:mainfrom
Open
fix: Persist third-party model chat sessions locally to prevent history loss#295757bxf1001g wants to merge 2 commits intomicrosoft:mainfrom
bxf1001g wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Copilot Chat session history loss for third-party (“external”) model sessions by persisting their full conversation data locally and showing them in the SESSIONS history panel after restart.
Changes:
- Add local persistence for external chat sessions via a generated UUID-based storage key.
- Include locally-persisted external sessions in history retrieval and in trimming logic.
- Update lifecycle persistence paths to store full data (not metadata-only) for non-local sessions that have requests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/model/chatSessionStore.ts | Adds external-session local persistence, index metadata fields, and updates trimming to account for locally-persisted externals. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Persists external sessions with requests during model disposal/saveState and includes locally-persisted external sessions in history listing. |
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
Outdated
Show resolved
Hide resolved
Author
|
@microsoft-github-policy-service agree company="Axonyx Quantum Pvt Ltd" |
External sessions (e.g., Claude via Session Target) were only saving metadata to the index, causing conversation history to be lost on restart. This change persists full session data locally using a generated UUID as the storage key, and includes these sessions in the history panel. Fixes microsoft/vscode-copilot-release#14129 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0e08283 to
f8b8785
Compare
Author
|
@microsoft-github-policy-service agree [company="Axonyx Quantum Pvt Ltd"] |
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.
Fixes #300942
When using third-party model agents (e.g., Claude) via Copilot Chat's "Session Target" selector, chat sessions are
lost after VS Code closes or restarts. The session data is saved to disk during the active session, but is never
reloaded into the SESSIONS history panel.
Root Cause
External sessions (those with non-vscodeLocalChatSession:// URIs) are treated as metadata-only:
actual conversation data
The result: conversation data exists in .jsonl on disk while the session is active, but after shutdown, only the
metadata index entry (marked isExternal: true) survives — and it gets filtered out on next load.
Fix
This PR adds local persistence for external sessions so they survive across restarts:
chatSessionStore.ts:
have been fully saved locally
(since external session IDs are full URIs with characters invalid for filenames)
their data files
chatServiceImpl.ts:
storeSessionsMetadataOnly())
localStorageId to construct a restorable session resource URI
Testing
Repro Steps (before fix)