Skip to content

v0.7.4 — peer_context_status undercount fix

Choose a tag to compare

@michalekz michalekz released this 30 Jun 13:18
· 97 commits to main since this release

[0.7.4] — 2026-06-30

Fixed — peer_context_status undercount for fresh / post-clear sessions

peer_context_status significantly undercounted token usage for sessions that had recently gone through cache invalidation (after /clear, autocompact, or session start), in some cases reporting a few percent when the real figure was over 80%.

  • Root cause: v0.7.0–v0.7.3 read cache_read_input_tokens alone. That works for mature cached sessions where cache_read dominates, but in a freshly filling cache most input lands in cache_creation_input_tokens while cache_read is tiny, so the reported percentage collapsed toward zero.
  • Fix: tokensUsed = cache_read + cache_creation + input + output — the total tokens in the context window after the last assistant turn. This matches /context across both fresh and mature sessions.

Tests

  • 263 → 265 (+2 covering the full-formula sum and missing-field handling).