The Sessions tab listed every session whose last line fell in the range, and
counted only those stats found at work there. A session whose file goes on
being written after its last call (a setting, a fork's seed) was listed but
not counted, so the note beside the list said more than the KPI above it.
statsAt now returns keys (agent:id) for the sessions it counted, in the
list's order. app.js filters the list by them in every range and falls back
to the old last-line guess only when keys are missing.
The PR also made days with prompts or replies count as at work, so a
session that spoke but spent nothing (one user line, a Cursor chat) is not
dropped. Main's 1cd814004 (#1743) already has the same block, so the PR's
copy was left out.
Run on origin/main with the change:
- go test -tags nogui ./internal/sessions: ok.
- gofmt -l is clean; go vet passes on darwin, linux -tags nogui and windows.
- GUI: sessions-*, usage-sessions-agents-fit, gui-ja and gui-de, chromium
and webkit, en/zh/ja/de: 236/236.
Broken by hand:
- With app.js reverted, 8 sessions-in-range / spoke-not-spent cases fail.
- With the keys loop removed, TestStatsCountsSessionsThatSpentNothing,
TestStatsCountsCursorChats and TestStatsHoursAndSessions fail.
Not tried: a real history with sessions whose last line is a setting.