feat(cost): persist billed compaction usage on summaries - #45
Conversation
Capture provider TokenUsage from the compaction stream, price it with the models.dev catalog, and store it on the summary message so stats and the session footer include compaction cost without inflating context tokens.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying crabcode with
|
| Latest commit: |
3095acc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://67819024.crabcode.pages.dev |
| Branch Preview URL: | https://feat-compaction-usage-cost.crabcode.pages.dev |
Persisting usage parts was overwriting tokens_used with billed prompt buckets, so reloaded summaries inflated the model window. Store the summary text estimate instead and count context from content.
PR Reviewfeat/compaction-usage-cost → main Merge confidence: 5/5Was 3/5. The persist/reload inflation path is fixed ( GitHub comment bodyCompaction streams now keep provider Follow-up No schema migration needed. What changed2 commits, 6 files:
Intent: billed compaction cost in stats/footer without treating those tokens as model context — including after DB reload. RegressionsNone remaining from the original 3/5 finding. Fixed in
Non-blocking:
MigrationsNo. Reuses existing
Merge checklist
Confidence bumps
Optional smoke of footer/restart would not raise the score further. |
Capture provider TokenUsage from the compaction stream, price it with the models.dev catalog, and store it on the summary message so stats and the session footer include compaction cost without inflating context tokens.