Stats cache lastComputedDate not advancing; new model IDs missing from modelUsage rollup

Resolved 💬 5 comments Opened May 23, 2026 by Emin-Emini Closed Jun 24, 2026

Environment

  • Claude Code: 2.1.139
  • Node: v24.6.0
  • macOS: 26.2 (build 25C56)
  • Auth: claude.ai (subscription)

Summary

~/.claude/stats-cache.json stopped advancing on 2026-02-17. Three months of subsequent activity is absent from the cache, even though heavy usage continued every day. As a side effect, models released since Feb 2026 (e.g. claude-opus-4-7, claude-haiku-4-5-20251001) are completely missing from the modelUsage rollup, even though raw .jsonl session files clearly record them.

This may be related to / the root cause of #61683 (multi-day session bucketing): if recompute fails on long-running multi-day sessions, lastComputedDate never gets written forward.

Evidence from my install

{
  "version": 2,
  "lastComputedDate": "2026-02-17",
  "totalSessions": 34,
  "totalMessages": 22142,
  "modelUsage": {
    "claude-opus-4-5-20251101": { ... },
    "claude-sonnet-4-5-20250929": { ... },
    "claude-opus-4-6": { ... }
  }
}

Meanwhile, scanning ~/.claude/projects/**/*.jsonl directly:

| Month | Distinct sessions touched | Total messages observed |
|---|---:|---:|
| 2026-05 (so far) | 200+ | ~30,000+ |
| Models seen | claude-opus-4-7, claude-haiku-4-5-20251001 (also <synthetic>) | — |

None of this post-Feb-17 activity is in the cache, and the new model IDs never appear in modelUsage.

Repro

  1. Use Claude Code regularly across at least one model upgrade (Feb 2026 was the cutoff in my case).
  2. Inspect ~/.claude/stats-cache.jsonlastComputedDate stays stuck at the last good date, and modelUsage keys never gain the new model IDs.
  3. /stats shows progressively staler / less complete daily counts.

Suggested investigation

  • Check the recompute path for an early-return / unhandled-error when encountering session files whose first-message date predates lastComputedDate but whose last-message date is after it (i.e. multi-day sessions, see #61683).
  • Ensure unknown / new model IDs in session usage blocks are added to modelUsage rather than silently skipped.
  • Consider a hard cap: if lastComputedDate is more than N days behind today, force a full rebuild rather than incremental.

Side effect of this bug

Subscription users (claude.ai auth) lose visibility into their actual model usage breakdown since the cache freeze. Even though costUSD is intentionally 0 for subscription accounts, the token counts per model are still the only insight users have into "what model am I actually running through" — and that signal is silently broken.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗