[Bug] Local sessions list reorders unexpectedly due to filesystem mtime instead of actual message timestamps

Resolved 💬 1 comment Opened Jun 20, 2026 by TatuUlmanen Closed Jun 20, 2026

Bug Description
The VS Code extension sorts the Local sessions list by lastModified, which is sourced from filesystem mtime rather than the last user-message timestamp stored inside the .jsonl. Any write that isn't user activity bumps mtime and reorders the session dropdown list.

The parser already reads a real in-file timestamp, but only from the first record, stored as createdAt and never used for sorting. The file tail (n) is already in memory (scanned with findLast for tag records), so the last user record's timestamp is readily available.

Suggested fix: Derive lastModified from the last record's timestamp in the tail, falling back to mtime only when no in-file timestamp exists. Content timestamps are then immune to title-append/backup/sync mtime bumps and the session dropdown list remains what the user expects.

Repro:

  1. Have a number of old sessions.
  2. Trigger the ai-title re-summarize pass (happens on activation/upgrade), or manually rename sessions.
  3. Extension appends {"type":"ai-title",...} / {"type":"custom-title",...} records → file mtime bumps.
  4. Old, untouched conversations jump to the top; a bulk sweep collapses many sessions to the same minute, scrambling order.

Environment Info

  • Platform: linux
  • Terminal: vscode
  • Version: 2.1.183
  • Feedback ID: 5a164bf4-6830-4635-b50e-41476bc2278f

View original on GitHub ↗

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