VS Code extension: startup indexing rewrites session mtimes, scrambling history sort order

Status Open
Maintainer reply None cached
Activity 1 comment · opened Aug 19, 2026

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

  1. Have several old sessions plus one active session in a project.
  2. Restart the VS Code extension.
  3. Observe (filesystem): multiple old *.jsonl transcripts get the exact same new mtime (the restart moment), each with a {"type":"last-prompt", ...} line appended.
  4. 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

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗