[VS Code] Renamed session titles occasionally revert on startup

Resolved 💬 3 comments Opened Apr 11, 2026 by orange675 Closed Apr 14, 2026

Description

Renamed session titles in the Claude Code VS Code extension
occasionally revert to their original auto-generated title
after restarting VS Code. The issue is intermittent — it
does not happen every time, but frequently enough to be
annoying.

Environment

  • Claude Code extension version: 2.1.101
  • VS Code on Windows 10 Pro
  • OS: Windows 10.0.19045

Reproduction

  1. Open Claude Code in VS Code
  2. Rename a session from the sidebar
  3. Close VS Code
  4. Reopen VS Code
  5. Observe: with some probability, the session label reverts

to the original AI-generated title

Investigation

I dug into the storage layer and found a likely root cause.

Two data sources for session titles

  1. ~/.claude/projects/<project>/sessions-index.json

— stores firstPrompt, used as the default title.
There is no customTitle or label field.

  1. <VSCode>/workspaceStorage/<hash>/state.vscdb, key

agentSessions.model.cache
— stores the label field that the extension actually
renders in the sidebar. When I rename a session, the new
name gets written here.

The likely bug

Because sessions-index.json has no field for custom titles,
the VS Code extension stores the renamed title only in
agentSessions.model.cache. On startup, the extension seems
to merge or sync data from both sources, and in some cases
the label in the cache gets overwritten by a freshly
derived title from sessions-index.json (likely based on
firstPrompt or a regenerated summary).

This creates a race between:

  • Loading the persisted custom label from the SQLite cache
  • Regenerating the label from firstPrompt

Whichever finishes last wins, which produces the intermittent
behavior.

Suggested fix

Use a single source of truth for custom titles:

  1. Add a customTitle (or userLabel) field to

sessions-index.json

  1. Write to this field only when the user explicitly renames
  2. On load, the VS Code extension should prefer customTitle

and fall back to firstPrompt only when it is absent

This eliminates the race condition and makes renamed titles
durable across restarts.

Additional note

I also noticed that some non-ASCII labels in
agentSessions.model.cache appear as mojibake, which might
be a related encoding issue (non-UTF-8 read as UTF-8), but
this may be a separate bug worth tracking.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗