Sessions disappear from history when first message is a slash command
Bug Description
Sessions become invisible in the VS Code extension sidebar when the first user action in the session is a slash command (like /model, /compact, or a custom skill command).
Steps to Reproduce
- Open Claude Code in a VS Code fork (tested in Antigravity/Windsurf with extension v2.1.49)
- Start a new session
- Run
/model sonnet(or any slash command) as the first action - Have a substantive multi-message conversation
- Close or navigate away from the session
- Open the session history — the session is missing from the list
Expected Behavior
All sessions with content should appear in the session list, even if the display title has to fall back to "Untitled session" or a timestamp.
Actual Behavior
The session is completely invisible in the sidebar. The .jsonl file exists on disk and contains the full conversation, but the UI doesn't show it.
Root Cause (from reverse-engineering extension.js)
fetchSessions() reads each .jsonl file's head (first line) and tail (last N bytes) to derive a display title:
- Checks tail for
customTitle(from/rename) - Checks tail for
summary(auto-generated) - Extracts first user prompt from head (first JSONL line)
If all three return null, the session is filtered out via if(!D) return null.
When the first action is a slash command, the first JSONL line has "type": "system" with empty/command content instead of "type": "user" with a real prompt. The head-parser can't extract a display string, and if no customTitle or summary exists in the tail, the session gets dropped.
Impact
In my project, 108 out of 301 session files (~36%) were missing from the session list. Many of these were substantive multi-hour sessions that started with a slash command.
Suggested Fix
In fetchSessions(), instead of returning null when no display title can be derived, fall back to a default like:
- The session's modification date
- "Untitled session"
- Parse deeper into the file for the first actual user message (not just the first line)
Environment
- Claude Code extension v2.1.49
- macOS (Darwin 25.2.0, arm64)
- Tested in Antigravity and Windsurf VS Code forks
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗