Skip to content

fix: status bar shows 26K instead of 260K for token counts with trailing zeros#3024

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-7d7ac769
Mar 25, 2026
Merged

fix: status bar shows 26K instead of 260K for token counts with trailing zeros#3024
teknium1 merged 1 commit intomainfrom
hermes/hermes-7d7ac769

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

format_token_count_compact() used unconditional rstrip("0") to clean decimal trailing zeros (e.g. "1.50"→"1.5"), but this also stripped meaningful trailing zeros from whole numbers ("260"→"26", "100"→"1").

Guard the strip behind a "." in text check so only decimal zeros are removed.

Cherry-picked from PR #2763 by @kshitijk4poor.

Verified

  260,000 → 260K  (was 26K)
  100,000 → 100K  (was 1K)
  500,000 → 500K  (was 5K)
   12,450 → 12.4K (decimal strip still works)
    1,500 → 1.5K  (decimal strip still works)
…ing zeros

format_token_count_compact() used unconditional rstrip("0") to clean up
decimal trailing zeros (e.g. "1.50" → "1.5"), but this also stripped
meaningful trailing zeros from whole numbers ("260" → "26", "100" → "1").
Guard the strip behind a decimal-point check.
@teknium1 teknium1 merged commit 0dcd6ab into main Mar 25, 2026
InB4DevOps pushed a commit to InB4DevOps/hermes-agent that referenced this pull request Mar 25, 2026
…ing zeros (NousResearch#3024)

format_token_count_compact() used unconditional rstrip("0") to clean up
decimal trailing zeros (e.g. "1.50" → "1.5"), but this also stripped
meaningful trailing zeros from whole numbers ("260" → "26", "100" → "1").
Guard the strip behind a decimal-point check.

Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
…ing zeros (NousResearch#3024)

format_token_count_compact() used unconditional rstrip("0") to clean up
decimal trailing zeros (e.g. "1.50" → "1.5"), but this also stripped
meaningful trailing zeros from whole numbers ("260" → "26", "100" → "1").
Guard the strip behind a decimal-point check.

Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
StreamOfRon pushed a commit to StreamOfRon/hermes-agent that referenced this pull request Mar 29, 2026
…ing zeros (NousResearch#3024)

format_token_count_compact() used unconditional rstrip("0") to clean up
decimal trailing zeros (e.g. "1.50" → "1.5"), but this also stripped
meaningful trailing zeros from whole numbers ("260" → "26", "100" → "1").
Guard the strip behind a decimal-point check.

Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants