Skip to content

🐛 fix(usage): Count persisted Pi cache warming - #568

Merged
ladislas merged 1 commit into
mainfrom
ladislas/bugfix/566-cache_warming_usage
Nov 25, 2026
Merged

ladislas merged 1 commit into
mainfrom
ladislas/bugfix/566-cache_warming_usage

Conversation

@ladislas

Copy link
Copy Markdown
Owner

Closes #566

Pi 1.6.0 writes cache warming as standalone v3 usage entries. Count them once across the stored session tree in the footer and attribute them to the recorded provider/model in session breakdown, without adding message turns or context samples. Reuse existing cost provenance and subscription pricing logic; leave ledger precedence, dependencies, and pricing policy unchanged.

Verification on Pi 1.6.0 / Node v24.20.0, based on post-#567 main (e5628e8):

  • Reproduced $0.015 instead of $0.030 in both consumers using native persisted records, then verified both totals, multiple warms, branch coverage, summaries, and model attribution.
  • Covered warm-only and mixed context statistics, billed-zero subscription estimates, unknown/missing provenance, and existing legacy/ledger fixtures. The v4 reader was left unchanged; Pi 1.6.0 emits v3.
  • npm run check:pi-compatibility (typecheck and 613 tests), mise run lint, and git diff --check passed. No live-provider calls.

Include standalone usage in footer totals and attribute it to the recorded model in session reports. Keep it out of conversation context samples and preserve ledger precedence and cost provenance.

Verified with Pi 1.6.0 on Node v24.20.0: compatibility gate (613 tests), mise run lint, and git diff --check.

Closes #566
@ladislas
ladislas merged commit 6fb25ce into main Nov 25, 2026
2 checks passed
@ladislas
ladislas deleted the ladislas/bugfix/566-cache_warming_usage branch November 25, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix cache-warming usage accounting in footer and session breakdown

1 participant