Skip to content

fix(tui): roll over compact counts to M at 999,950 - #48969

Open
Hotragn wants to merge 1 commit into
anomalyco:v2from
Hotragn:compact-number-v2
Open

Hotragn wants to merge 1 commit into
anomalyco:v2from
Hotragn:compact-number-v2

Conversation

@Hotragn

@Hotragn Hotragn commented Sep 14, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #33947

Type of change

  • Bug fix

What does this PR do?

Locale.number() formats the thousands value with toFixed(1), so any count from 999,950 to 999,999 rounds to 1000.0 and renders as 1000.0K. The >= 1000000 branch never gets a chance to promote it, because the count itself is still under a million. It shows up in the TUI context indicator on ~1M token context models, e.g. 1000.0K (100%).

Rolling over at 999,950 — the point where one-decimal rounding first reaches 1000.0K — makes those values render as 1.0M. Nothing below that boundary changes.

How did you verify your code works?

Added a case to packages/tui/test/util/locale.test.ts: 999,949 still formats as 999.9K, 999,950 and 999,999 now format as 1.0M, plus the plain/K/M cases so the fix can't regress them. 3/3 pass in that file.

No screenshot — reproducing it in the UI needs a session grown to ~999,950 tokens, so the boundary is covered by the unit test instead.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

⚠️ Duplicate found:

PR #47523: fix(tui): roll over compact counts to M at 999,950

This is the exact same fix addressing the same issue—rolling over compact number formatting to display "M" at the 999,950 threshold instead of showing "1000.0K". Since PR #47523 already exists with identical scope and solution, PR #48969 appears to be a duplicate.

@Hotragn

Hotragn commented Sep 14, 2026

Copy link
Copy Markdown
Author

Same as above — the body links Closes #33947 (open); the needs:issue label appears to have landed before the description was saved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant