Repository navigation
Fix: Session title rename not persisting after reload - #323323
Open
Takashi Tamura (tamuratak) wants to merge 3 commits into
Open
Takashi Tamura (tamuratak) wants to merge 3 commits into
Takashi Tamura (tamuratak) wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes local chat session title renames not persisting across reload and not updating immediately in the sessions sidebar by reconciling index-vs-file state in the chat session store and ensuring the sessions provider reacts to setCustomTitle changes emitted via onDidChange.
Changes:
- Update
ChatSessionStore.readSessionto reconcilecustomTitleloaded from disk with the in-memory index title. - Update
LocalSession.trackModelto also listen tomodel.onDidChangeforsetCustomTitleevents so the sessions framework updates immediately. - Wire up
chatService.onDidCreateModelso newly created chat models are tracked/synced into the sessions provider.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/model/chatSessionStore.ts | Reconciles session data read from disk with the index title to avoid losing renames on reload. |
| src/vs/sessions/contrib/providers/localChatSessions/browser/localChatSessionsProvider.ts | Ensures session metadata stays in sync by reacting to setCustomTitle and model creation events. |
|
Able to replicate same issue. It updates and then reverts to original auto-generated title in couple minutes. |
This branch has not been deployed
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.
Fix: Session title rename not persisting after reload
Renaming a chat session title (e.g. via the sidebar) does not survive a window reload, and the renamed title is not reflected immediately in the UI. Close #283514, #318442, #322566
Root cause
setSessionTitlein ChatSessionStore updates only the in-memory index, not the session data file. The file is written later bystoreSessions. If the window is reloaded beforestoreSessionsruns,readSessionreads the old title from the file, and the rename is lost.Additionally,
setCustomTitleon the chat model firesmodel.onDidChange(not an observable signal), so the sessions framework in LocalChatSessionsProvider never hears about it, so the renamed title is not reflected in the sidebar.Changes
chatSessionStore.ts — After reading session data from disk, compare the file's
customTitlewith the index title. If they differ, prefer the index title. This closes the gap between the index (updated immediately on rename) and the file (updated lazily bystoreSessions).localChatSessionsProvider.ts — Two changes:
trackModelnow subscribes tomodel.onDidChangeforsetCustomTitleevents in addition to the existingautorun, so title changes are picked up without delay.chatService.onDidCreateModelto wire up title/status tracking when a model is created (e.g. when the user opens a session), ensuring renames propagate to the sessions framework.Testing
Written with GitHub Copilot + MiMo-V2.5-Pro
CC: Osvaldo Ortega (@osortega)