Repository navigation
fix(copilot): report session credits missing from modelMetrics - #1824
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | dbbdd79 | Commit Preview URL Branch Preview URL |
Oct 09 2026, 10:30 PM |
|
One more case I found while reviewing: per-model credits are only collected up to |
Per-model credits were only collected up to `--until`, so a breakdown that a later shutdown catches up on counted as a credit gap whenever the catch-up fell after `--until`. A day's cost then depended on the report range. Collect them from every shutdown and keep `--until` for which rows are emitted, so a date-bounded report matches the unbounded one on the days they share.
Copilot credit gaps are reported as zero-token rows with a cost, so dropping every zero-token summary hid them from unified daily and monthly reports while focused reports and session still showed them.
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
Fixes #1823.
Copilot sessions whose
modelMetricsbreakdown does not cover every credit billed in the session-widetotalNanoAiulost that usage. The Copilot adapter now compares the session total against the per-model totals across shutdowns and trailingsession.usage_checkpointevents, and reports credits that stay unexplained at every later snapshot as cost-onlyunknownrows (0 tokens, $0.01 per credit). A breakdown that a later shutdown catches up on is not counted twice.--untilonly limits which rows are emitted, so a date-bounded report matches the unbounded one (ported from @erwindamsma's branch).ccusage daily/monthlymatchccusage copilot daily/monthly.calculatemode theunknownrows cost $0, following the usual precomputed-cost semantics.Co-authored-by: Erwin Damsma [email protected]