Show cached usage details in heatmap headers - #18
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2cc9a76b01
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (whole <= 0) { | ||
| return "0%"; |
There was a problem hiding this comment.
Avoid reporting 0% when cached tokens exist without base tokens
The new cache helper can show an incorrect percentage because formatPercent hard-codes "0%" whenever the denominator is <= 0. In practice, Cursor rows can have non-zero cache writes while output is zero (packages/cli/src/lib/cursor.ts uses cache.output from Input (w/ Cache Write) but keeps output separate), so the header will render values like write 123 (0%), which misstates the cached share rather than indicating an undefined ratio.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/src/graph.ts">
<violation number="1" location="packages/cli/src/graph.ts:277">
P2: `formatPercent` returns `"0%"` when the denominator is zero, but the caller can reach this path with a non-zero numerator (e.g. cache writes present while `output` totals to 0). This renders a label like `write 123 (0%)` which misstates the cached share. Return a fallback like `"—"` or omit the percentage when the ratio is undefined.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/src/graph.ts">
<violation number="1" location="packages/cli/src/graph.ts:640">
P2: `cache write` is pinned to row 2 even when row 1 is absent, causing a blank helper line for write-only cache data.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
7570979 to
f02ec2d
Compare


Summary
Show cached usage details in the heatmap header without changing the underlying usage aggregation.
What changed
INPUT TOKENS,OUTPUT TOKENS, andTOTAL TOKENSvalues as the existing totalsINPUT TOKENSwhen presentOUTPUT TOKENSwhen presentWhy
Cached usage is already tracked in the report data, but it was not surfaced in the rendered heatmap. Showing cache reads and writes directly in the header makes the graph more informative while preserving the existing top-line totals.
Before / After example
Examples below are from one local render against real usage data.
Claude CLI (WSL)
Before:
After:
Cursor (Windows)
Before:
After:
Testing
Notes
This PR is intentionally scoped to the cached usage display only.