You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(shared): token counts drop trailing zeros, so 1,500 reads 1.5K - #44158
Token counts on the Usage page, in the model usage dialog and in the mobile composer's compaction notice showed a trailing zero, for example 1.50K for 1,500 tokens and 2.30M for 2.3M. formatTokens rounds to two decimals under 10 and one under 100, but the cleanup regex only removed decimals that were all zeros (.00), so a single trailing zero stayed.
trim now goes through Number, which drops any trailing zeros: String(Number(value.toFixed(digits))). Whole and three-digit values (12K, 100K) are unchanged. Added a test that fails on main (Expected "1.5K", received "1.50K") and passes with the fix.
Surfaces: formatTokens lives in packages/shared and is used by web/desktop (Usage page, model usage dialog) and mobile (Usage screen, composer), so all of them pick up the fix. Provider-agnostic.
Model: Claude Opus 5.5, via Claude Code in T3 Code.
pingdotgg/t3code#35634: It changes the same formatTokens rounding and trimming path to advance suffixes when a rounded value reaches 1000.
Suggested reviewers:saphid, only21mil
Merge Risk: Minimal · up to a1a45
Compact token counts will show 1.5K instead of 1.50K across the Usage surfaces. The change is small and low risk to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual change: token counts no longer keep a trailing zero, with the 1,500 to 1.5K example. It matches the raw summary, which says trim now goes through Number and drops trailing z…
Description check
The description follows the template's main sections in substance. It has a clear problem statement with a concrete example, and it explains the change through the Number-based trim. Verification give…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the actual change: token counts no longer keep a trailing zero, with the 1,500 to 1.5K example. It matches the raw summary, which says trim now goes through Number and drops trailing zeros. The fix(shared) prefix follows conventional commit style and names the affected package.
Full details: Description check
Explanation
The description follows the template's main sections in substance. It has a clear problem statement with a concrete example, and it explains the change through the Number-based trim. Verification gives a specific failing-then-passing test with the observed message. The Scope section is not filled in: it does not link an issue or explain why no issue is needed, and it does not say whether a maintainer requested the PR. The template's model attribution line is present. Overall the description is mostly complete, with one required section partly missing.
Resolution
Optional: in the Scope section, link the issue that shows the bug, or state why a small obvious fix needs no issue. Also state whether a maintainer requested the PR.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 768b1f9 and a1a45bb.
Files selected for processing: 1
packages/shared/src/usageFormat.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
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
size:XS0-9 changed lines (additions + deletions).takeover:needs-juliusTakeover done; route gate says Julius decidesvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
Token counts on the Usage page, in the model usage dialog and in the mobile composer's compaction notice showed a trailing zero, for example 1.50K for 1,500 tokens and 2.30M for 2.3M.
formatTokensrounds to two decimals under 10 and one under 100, but the cleanup regex only removed decimals that were all zeros (.00), so a single trailing zero stayed.trimnow goes throughNumber, which drops any trailing zeros:String(Number(value.toFixed(digits))). Whole and three-digit values (12K,100K) are unchanged. Added a test that fails on main (Expected "1.5K", received "1.50K") and passes with the fix.Surfaces:
formatTokenslives inpackages/sharedand is used by web/desktop (Usage page, model usage dialog) and mobile (Usage screen, composer), so all of them pick up the fix. Provider-agnostic.Model: Claude Opus 5.5, via Claude Code in T3 Code.
🤖 Generated with Claude Code