Session hidden from /resume when first user messages are all IDE metadata
Bug Description
Sessions become invisible in /resume and the past conversations dropdown when the first ~16KB of the JSONL session file contains only IDE metadata messages (<ide_selection>, <ide_opened_file>, empty messages) with no "real" user prompt.
Root Cause
The session discovery code (Xwz/Dwz in the bundled CLI) reads only the first 16KB (pT6=16384 bytes) of a session JSONL file to extract the firstPrompt. It skips messages matching:
<ide_selection>...</ide_selection><ide_opened_file>...</ide_opened_file><local-command-stdout>- Empty text content
tool_resultmessagesisMetamessages
If all user messages within that 16KB window are skipped, firstPrompt comes back empty. Then in jwz, the filter:
if (!Y.firstPrompt && !Y.customTitle) return null;
...silently drops the session from the listing entirely.
Reproduction
- Open a VS Code session with Claude Code
- Have many IDE selection/opened-file events before typing your first real message (e.g. selecting code, switching files ~25+ times)
- Have a long conversation
- Close the tab
- Try
/resume— the session does not appear
In my case, the first real user message was message #28, well past the 16KB read window. The session (21MB, containing extensive conversation) was completely hidden.
Workaround
Appending a customTitle record to the JSONL file makes the session visible again, since customTitle is read from the last 16KB of the file:
{"type": "system", "subtype": "custom_title", "customTitle": "My session title", "sessionId": "...", "timestamp": "..."}
Using /rename within a session also sets customTitle and prevents this issue.
Suggested Fix
Options:
- Increase the read buffer or do a streaming scan for the first real prompt
- Don't filter out sessions with no
firstPrompt— show them with a fallback title (e.g., the date/time) - Write
firstPrompteagerly to a lightweight index when the first real user message arrives, rather than extracting it lazily from the raw JSONL
Option 2 seems safest — a session should never silently disappear from the listing.
Environment
- Claude Code version: 2.1.39
- Platform: macOS (Darwin 24.6.0, Apple Silicon)
- IDE: VS Code extension
🤖 Generated with Claude Code
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗