Skip to content

fix(statusline): truncate a response's token counts to whole tokens before summing - #626

Merged
Mearman merged 1 commit into
mainfrom
fix/statusline-session-token-truncation
Oct 27, 2026
Merged

Mearman merged 1 commit into
mainfrom
fix/statusline-session-token-truncation

Conversation

@Mearman

@Mearman Mearman commented Oct 27, 2026

Copy link
Copy Markdown
Member

The session tokens row summed a transcript's counts as written, so a transcript reporting fractional counts drew a different total from claude-hud, which truncates each record's counts to whole tokens before summing them (#614). With two responses reporting 0.5 and 0.25 input tokens and 20 output tokens, claude-hud draws Tokens 20 (in: 0, out: 20) and the built-in row drew Tokens 21 (in: 1, out: 20).

The fold now truncates the same way, and a kept fold state holding a fraction, which an earlier fold wrote, is refused and rebuilt rather than trusted, so the cache version stays as it is. The display.showSessionTokens parity row and its map note record the rule. Claude Code writes whole counts, so only a hand-written transcript reaches this.

Fixes #614

…efore summing

The session tokens row summed counts as written, so a transcript reporting fractional counts
drew a different total from claude-hud, which truncates each record's counts to whole tokens
before summing. The fold now truncates the same way, and a kept fold state holding a fraction,
which an earlier fold wrote, is refused and rebuilt. The parity row records the rule.

Fixes #614
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ⚠️ Failed 2026-10-27T20:41:47.620063Z
We couldn’t complete this review. Comment @codex security review to try again.
81bdcb3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@Mearman
Mearman merged commit 637fe15 into main Oct 27, 2026
32 checks passed
@Mearman
Mearman deleted the fix/statusline-session-token-truncation branch October 27, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

statusline: session tokens with fractional counts differ from claude-hud

1 participant