Skip to content

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

Closed
Hotragn wants to merge 1 commit into
anomalyco:devfrom
Hotragn:compact-number-rollover
Closed

Hotragn wants to merge 1 commit into
anomalyco:devfrom
Hotragn:compact-number-rollover

Conversation

@Hotragn

@Hotragn Hotragn commented Sep 5, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #33947

Type of change

  • Bug fix

What does this PR do?

Replaces #39407, which was closed by the automated cleanup rather than by a fix. Rebased on current dev; Locale.number() is unchanged there, so the bug is still live.

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 below 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?

test/util/locale.test.ts: 999,949 still formats as 999.9K, 999,950 and 999,999 now format as 1.0M, and the existing plain/K/M cases are covered so the fix can't regress them. 4/4 pass, bun typecheck clean.

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

Locale.number() formats the thousands value with toFixed(1), so counts
from 999,950 to 999,999 rounded to 1000.0 and rendered as "1000.0K". The
>= 1000000 branch could not promote them because the count itself is
still below a million. It shows up in the TUI context indicator on ~1M
context models as "1000.0K (100%)".

Roll over at 999,950 instead, the point where one-decimal rounding first
reaches 1000.0K, so those counts render as "1.0M".

Closes anomalyco#33947
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

Compact number formatter shows "1000.0K" instead of "1.0M" near 1M

1 participant