Repository navigation
Show the reported usage total when some usage went unreported - #1908
Merged
Merged
Conversation
…totals Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U1JSurmR8K71uTv8K3rT4w
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U1JSurmR8K71uTv8K3rT4w
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
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 |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U1JSurmR8K71uTv8K3rT4w
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Vain · project thread
Why the change
On a Host upgraded from before usage completeness tracking, one old row with an unreported total turned the whole week's total and that day's bar into "Unknown", even though the Bots had millions of reported tokens (found in the #1899 simulator QA: Ada 4M and Bea 374.6K, headline and all bars "Unknown").
Refs #1896, #1899.
Special things to note
overviewUsageonly;profileUsageand the other usage readers are unchanged. Each bucket is now the sum of what was reported, and isnullonly when nothing in it was reported (so a provider that never reports cache keeps cachenull, as before). A row with an unreported total counts as the larger of its reported total and its reported parts, a lower bound. Newpartial: booleanon the totals, each day and each Bot row says some usage in it went unreported. Web shows the total asN+with the existing partial note (copy updated). The Web parser accepts rows withoutpartial, so an older Host still parses. No new bridge method;deepseekbot overview-usagereturns the same JSON, documented indocs/bot-cli.md. Revert is a plain revert.counts reported usage beside an unreported total and marks the sum as partialinserts an upgraded-style row (unknown_total = 1, total 0, reported input/output) next to a reported turn and checks totals, the day, the Bot rows andpartial; the existing "missing provider usage stays unknown" test still passes. New Web test checks155+and the partial note, and that a non-booleanpartialis rejected.pnpm lint,pnpm format:check,pnpm typecheckpass;vitest run packages/core packages/client: 509 files pass, 1 fails (client-observer.test.ts, "Cannot bundle node:sqlite"), which fails the same way on main in this environment.scripts/dev-instance.mjs --build) with threeusage_dailyrows written into its database (Ada 4M reported, Bea 374.6K reported, an upgraded-style row with 360K reported parts and an unreported total). On main the Web Overview reads "Overall usage: Unknown tokens" and the bar for that day is missing; on this branch it reads "4,734,600+ tokens" and the bar is there.partialto show the same+.Change outline
packages/core/src/usage/overview.ts: per bucketNULLonly when nothing was reported; total usesMAX(total_tokens, reported parts)for rows with an unreported total; addspartial.packages/client:loadOverviewUsageaccepts an optional booleanpartial; Overview total rendersN+and shows the partial note whentotals.partial.docs/bot-cli.md,docs/architecture/botharness-architecture.md.Before (main) and after, Web Overview, last 7 days:
🤖 Generated with Claude Code
https://claude.ai/code/session_01U1JSurmR8K71uTv8K3rT4w
Generated by Claude Code