fix(web): respect usage metric in time breakdown#23835

open1
main
GitHub fork: fix/hourly-usage-metric
opened2d agobyGGalicius
View on GitHubTwo-way sync enabledPR last imported 2d ago

Problem

On Usage, select Past 24h, choose Hour under Breakdown, and switch from Cost to Tokens. The summary and chart change, but the provider columns and Total still show dollar costs. The same hardcoded cells affect the daily breakdown.

Change

Use the selected metric for provider and total values in the time breakdown. Show Cost in the trailing column in Tokens mode, and Tokens in Cost mode. Keep the selected grouping and row order.

Scope and approval

This is a small, focused fix for an obvious bug under the CONTRIBUTING.md exception. It connects the existing metric selector to the existing hourly and daily table. It adds no new capability, setting, or default. Web and desktop share this table; no server, contract, or mobile behavior changes.

Verification

  • vp run check:changed passed format, lint, knip, typecheck for two packages, and the focused tests. usageBreakdown.test.ts passed all 4 tests, including hourly and daily values, zero-cost usage with tokens, missing providers, and the secondary column.
  • In the isolated Windows web preview, selected Hour and switched Cost to Tokens to Cost. At 9 PM, Codex changed from $1.65 to 5.12M, Claude Code from $2.86 to 9.01M, and Total from $4.51 to 14.1M. The final column changed from Tokens to Cost. Hour stayed selected. Switching back restored the cost values.
  • The reporter reviewed the Windows x64 build and confirmed it looked good. Three independent code reviewers reported no findings. Mobile was not exercised because its separate UI is unchanged.

Before screenshots are from the original report. After screenshots are from the local preview with a later snapshot of usage data, so the overall totals differ. The Browser panel captures have soft text; the observed table values are recorded above.

Before

Cost mode before

Tokens mode before still shows provider costs

After

Cost mode after

Tokens mode after shows provider tokens and trailing cost

Implemented with GPT-6.1 Sol through the Codex harness in T3 Code.

Checks

All checks passed

Added 1 commit

  • fix(web): respect usage metric in time breakdown6a08907
Synced from GitHub

Approvability

Verdict: Approved at 6a08907

Macroscope's review found this PR approvable — This is a small, self-contained web bug fix that makes the existing Cost/Tokens selector control provider and total values in daily and hourly breakdowns. It adds focused coverage without changing APIs, defaults, data processing, or deployment behavior.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between ef92441313da327139df75daa8f723c0f42348f6 and 6a08907243e1247d109439195bf031af6cd4131a.

📒 Files selected for processing: 3
  • apps/web/src/components/usage/UsagePage.tsx
  • apps/web/src/components/usage/usageBreakdown.test.ts
  • apps/web/src/components/usage/usageBreakdown.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The usage time-breakdown table now displays cost or token values according to the selected metric. Its secondary column shows the other metric, and missing provider totals format as zero.

Changes: Usage time breakdown

Layer / File(s)Summary
Metric configuration and tests
apps/web/src/components/usage/usageBreakdown.ts, apps/web/src/components/usage/usageBreakdown.test.ts
timeBreakdownMetric selects primary and secondary values and their formatters for cost or tokens. Tests cover daily and hourly totals, including missing provider totals.
Usage table integration
apps/web/src/components/usage/UsagePage.tsx
The time-breakdown table uses the selected metric configuration for its secondary column label, provider values, and period totals.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: t3dotgg, 0pilatos0

Merge Risk: ⚪ Minimal · up to 6a089

The table appears ready to merge after normal checks; no actionable risk was identified.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main fix: making the usage time breakdown respect the selected metric.
Description checkPassedThe description includes all required sections, explains the bug and fix, documents the scope exception, and provides focused automated and manual verification with before-and-after screenshots.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.