fix: use content timestamps for lastInteraction, not max(timestamp, mtime)#655
Merged
fix: use content timestamps for lastInteraction, not max(timestamp, mtime)#655
Conversation
…time) Fixes #649: 'Today' section was showing previous day's sessions because VS Code writes session files slightly after midnight, making mtime 'today' even though the last interaction was 'yesterday'. - getSessionFileDetails: use content timestamp directly (3 places) - getSessionFileDetailsFromCache: don't override with mtime - calculateUsageAnalysisStats: use lastActivity from lastInteraction - Bump CACHE_VERSION to 40 to invalidate stale caches Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #649
Problem
The "Today" section was showing sessions from the previous day. VS Code writes session files slightly after midnight when finalizing a session, making the file's
mtimefall on "today" even though the last actual chat interaction was "yesterday."The old code used
max(contentTimestamp, mtime)forlastInteraction, so any session touched by VS Code at 00:00:01 would be classified as "today."Fix
lastInteractionmust come exclusively from content timestamps.mtimeis only used as a last-resort fallback when no content timestamp exists at all.Changes
getSessionFileDetails— 3 branches (delta JSONL, non-delta JSONL, regular JSON): use content timestamp directly instead ofmax(contentTimestamp, mtime)getSessionFileDetailsFromCache— removed the 8-line block that overrode cachedlastInteractionwithmtimewhenmtimewas newercalculateUsageAnalysisStats— switched month/today checks from rawmtimetolastActivityderived fromsessionData.lastInteractionCACHE_VERSIONbumped 39 → 40 to invalidate stale caches on next startupTesting
tsc --noEmitpasses (no TypeScript errors)node esbuild.jsbuilds cleanly