Skip to content

Fix: Session title rename not persisting after reload - #323323

Open
Takashi Tamura (tamuratak) wants to merge 3 commits into
microsoft:mainfrom
tamuratak:chat_session_title_rename_d
Open

Takashi Tamura (tamuratak) wants to merge 3 commits into
microsoft:mainfrom
tamuratak:chat_session_title_rename_d

Conversation

@tamuratak

Copy link
Copy Markdown
Contributor

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

setSessionTitle in ChatSessionStore updates only the in-memory index, not the session data file. The file is written later by storeSessions. If the window is reloaded before storeSessions runs, readSession reads the old title from the file, and the rename is lost.

Additionally, setCustomTitle on the chat model fires model.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 customTitle with 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 by storeSessions).

localChatSessionsProvider.ts — Two changes:

  1. trackModel now subscribes to model.onDidChange for setCustomTitle events in addition to the existing autorun, so title changes are picked up without delay.
  2. Listen to chatService.onDidCreateModel to 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

  1. Open a chat session, send a message.
  2. Rename the session title via the sidebar.
  3. Reload the window — the renamed title should persist.
  4. Rename while the session is closed — the title should update in the sidebar immediately when the session is opened.

Written with GitHub Copilot + MiMo-V2.5-Pro

CC: Osvaldo Ortega (@osortega)

Copilot AI review requested due to automatic review settings June 28, 2026 09:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.readSession to reconcile customTitle loaded from disk with the in-memory index title.
  • Update LocalSession.trackModel to also listen to model.onDidChange for setCustomTitle events so the sessions framework updates immediately.
  • Wire up chatService.onDidCreateModel so 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.

@bastabc

bastabc commented Jul 5, 2026

Copy link
Copy Markdown

Able to replicate same issue. It updates and then reverts to original auto-generated title in couple minutes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to rename local chat sessions

4 participants