VS Code extension: startup indexing rewrites session mtimes, scrambling history sort order
Environment
- Claude Code VS Code extension on Windows 11
- Project: local git repo
Bug
The session history list in the VS Code extension is sorted by the transcript file's modification time, but on extension startup the history indexer appends a last-prompt preview record to old session transcripts under ~/.claude/projects/<project>/*.jsonl. That write bumps the mtime of stale sessions, so after a restart, old untouched conversations jump to the top of the history list and the genuinely most-recent conversation sinks far down.
Repro
- Have several old sessions plus one active session in a project.
- Restart the VS Code extension.
- Observe (filesystem): multiple old
*.jsonltranscripts get the exact same new mtime (the restart moment), each with a{"type":"last-prompt", ...}line appended. - Observe (UI): the history list now shows those stale sessions above the most recently active one, which is buried far down the list.
In my case the active session was mid-run (subagents in flight) when I restarted; afterwards it appeared near the bottom of the history and looked like the conversation had disappeared.
Expected
History ordering should reflect real conversation activity — either sort by the timestamp of the last user/assistant message inside the transcript, or store the indexer's metadata outside the transcript files so indexing doesn't perturb mtimes.
🤖 Filed with Claude Code
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗