fix(web): sort usage models by token count - #8108
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 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 |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped UI bug fix that aligns the existing model table with the selected token metric. It preserves cost, daily, and hourly behavior and adds focused regression coverage without affecting schemas or production infrastructure. You can add or adjust custom eligibility rules. Learn more. |
## What's Changed * fix(web): align usage page skeleton layout by @tris203 in pingdotgg/t3code#8111 * fix(web): make terminal links appear clickable only when clickable by @flamboh in pingdotgg/t3code#7488 * fix(web): make Windows file links clickable in chat by @t3dotgg in pingdotgg/t3code#8081 * fix(web): sort usage models by token count by @RakshithBhat03 in pingdotgg/t3code#8108 * fix: open agent file links in the file viewer by @StiensWout in pingdotgg/t3code#8098 ## New Contributors * @flamboh made their first contribution in pingdotgg/t3code#7488 **Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260824.1179...v0.0.34-nightly.20260825.1180 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260825.1180
Selecting Tokens on the Usage page changed the summary and chart, but the model breakdown remained ordered by cost. That made the table disagree with the selected metric.
The model breakdown now sorts by total token usage when Tokens is active. Equal token totals fall back to cost for deterministic ordering. Cost ordering is unchanged, and the day and hour breakdowns remain chronological.
Tests: 15 focused usage tests, web typecheck, targeted lint and formatting.
Built by GPT-5.6 Sol in T3 Code through the Codex harness.
Note
Low Risk
UI-only table sort on the Usage page; no data, auth, or merge-pipeline changes.
Overview
The Usage model breakdown now follows the selected metric. With Tokens active, models are sorted by
totalTokens(cost as a tiebreaker). Cost view still uses the existing cost order from merge, and hour/day tables stay chronological.Tests cover cost vs token model order and confirm hourly rows stay newest-first when the token metric is on.
Reviewed by Cursor Bugbot for commit 0b87076. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Sort usage models by descending token count when Tokens metric is selected
useMemo-derivedbreakdownModelsin UsagePage.tsx that sortsmerged.modelsby descendingtotalTokens(with descendingcostUsdas tie-breaker) when the breakdown ismodeland the metric istokens.breakdownModelsinstead ofmerged.models.model+tokenscombination; all other breakdown/metric pairs preserve the originalmerged.modelsorder.Macroscope summarized 0b87076.