[BUG] VSCode session picker hides sessions with no ai-title line (lost after restart)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
- Claude Code — VSCode native extension
- Windows 11
Summary
A session's transcript (~/.claude/projects/<slug>/<id>.jsonl) is saved correctly, but the
session disappears from the extension's "Local" session picker after a VSCode restart.
The picker's list/sort is keyed on a {"type":"ai-title",...} line that an async background
job appends into the transcript after the session goes idle. If VSCode is closed/restarted
before that job runs, the transcript never gets an ai-title line and the session is dropped
from the picker — even though it is recent and fully intact on disk.
Evidence
In a project bucket of 43 sessions, every session shown in the picker had an ai-title line;
every session missing from the picker had none — including one ranked #3 by last activity
(more recent than several visible sessions). 15 of 43 lacked ai-title and were exactly the
set missing from the list. All 15 transcripts were valid JSON, uncorrupted, resumable by id.
| last activity | ai-title? | in picker? |
|---|---|---|
| 07-09 21:12 | yes | shown |
| 07-09 20:40 | no | MISSING |
| 07-09 18:52 | yes | shown |
| 07-08 15:23 | yes | shown |
Steps to reproduce
- Start a session, exchange a few messages.
- Close/restart VSCode within a few seconds of the last response (before the async title job
persists an ai-title line).
- Reopen VSCode → session absent from the Local picker.
- Confirm the transcript still exists on disk and
claude --resume <id>works.
Root cause
Picker visibility/sort depends on an optional, async, best-effort artifact (ai-title)
instead of on the transcript's own presence + first message. The title write races shutdown.
Impact
Users believe sessions are permanently lost. Discourages restarting VSCode. Data is actually
safe but there is no in-UI way to discover/resume an untitled session.
Expected
Picker should list every session that has a transcript, falling back to the first user message
(or filename) when ai-title is absent. Title generation must never gate visibility.
Ideally write a synchronous fallback title at session start / first response.
Workaround
A Stop/SessionEnd hook that appends a fallback ai-title when a transcript has none
eliminates the race and makes all sessions listable.
What Should Happen?
Picker should list every session that has a transcript, falling back to the first user message
(or filename) when ai-title is absent. Title generation must never gate visibility.
Ideally write a synchronous fallback title at session start / first response.
Error Messages/Logs
Steps to Reproduce
Start a session, exchange a few messages.
Close/restart VSCode within a few seconds of the last response (before the async title job
persists an ai-title line).
Reopen VSCode → session absent from the Local picker.
Confirm the transcript still exists on disk and claude --resume <id> works.
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.107 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_