From 0dcd6ab2f25e1b3daee989df3f0acb01bda67b9e Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:45:58 -0700 Subject: [PATCH] fix: status bar shows 26K instead of 260K for token counts with trailing zeros (#3024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- agent/usage_pricing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agent/usage_pricing.py b/agent/usage_pricing.py index 81c50026e..cfd0f88c4 100644 --- a/agent/usage_pricing.py +++ b/agent/usage_pricing.py @@ -649,7 +649,8 @@ def format_token_count_compact(value: int) -> str: text = f"{scaled:.1f}" else: text = f"{scaled:.0f}" - text = text.rstrip("0").rstrip(".") + if "." in text: + text = text.rstrip("0").rstrip(".") return f"{sign}{text}{suffix}" return f"{value:,}"