VS Code: Sessions with custom-title in middle of file disappear from sessions panel

Resolved 💬 2 comments Opened Mar 26, 2026 by grey-node Closed Apr 25, 2026

Bug Description

When a session is renamed multiple times during a long conversation, the custom-title entries get written to the middle of the .jsonl session file. The VS Code extension reads only the head and tail of the file to extract titles (m8(x.tail,"customTitle") / m8(x.head,"customTitle")), so sessions where the most recent custom-title entry is not near the head or tail become invisible in the Sessions panel.

Steps to Reproduce

  1. Start a new session and have a conversation (e.g. 50+ messages)
  2. Rename the session in the Sessions panel (this writes a custom-title entry to the file)
  3. Continue the conversation for another 50+ messages (assistant responses push the custom-title entry away from the tail)
  4. Restart VS Code
  5. The session disappears from the Sessions panel

Expected Behavior

The session should always appear in the Sessions panel with its most recent custom title, regardless of where the custom-title entry is located in the file.

Workaround

Append a custom-title JSON entry to the end of the session file:

echo '{"type":"custom-title","sessionId":"<SESSION_ID>","customTitle":"<TITLE>"}' >> ~/.claude/projects/<PROJECT>/<SESSION_ID>.jsonl

After restarting VS Code, the session reappears in the panel.

Related Issue

When renaming a session in the Sessions panel:

  • The panel title updates immediately
  • But the tab title does not update (stays as the old name)
  • The agentSessions.model.cache in state.vscdb also does not update
  • If you send a new message in the tab, the panel title reverts to the tab title

This suggests the rename is written to the session file but the in-memory state (tab, state.vscdb cache) is not synchronized.

Environment

  • VS Code Extension: anthropic.claude-code v2.1.84
  • OS: Windows 11 Pro
  • Working directory: subst drive (P:\)

Investigation Details

Confirmed by examining extension.js (minified):

// Title resolution priority: customTitle > aiTitle > lastPrompt
// But only head and tail of file are checked:
m8(x.tail,"customTitle") ?? m8(x.head,"customTitle") ?? m8(x.tail,"aiTitle") ?? m8(x.head,"aiTitle")

Session file with 2545 lines had custom-title entries at lines 559-1532, but the tail (last lines) contained only assistant responses. After appending a custom-title entry to the tail, the session immediately appeared in the panel on restart.

View original on GitHub ↗

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