Skip to content

Conversation

seratch
Copy link
Member

@seratch seratch commented Aug 20, 2025

This pull request resolves #2148 and I personally this is better in terms of readability

Before:

15894 (+ 93056 cached)

📊 Token Usage
  • Input: 15894 (+ 93056 cached)
  • Output: 3810
  • Total: 19704

1195 tokens used

codex
Hey! What do you want to tackle in codex-rs? I can explore the repo, run tests, or implement a change—point me at a crate or issue.

▌ Ask Codex to do anything
 ⏎ send   Shift+⏎ newline   Ctrl+C quit   1195 tokens used   96% context left

After:

15,894 (+ 93,056 cached)

📊 Token Usage
  • Input: 15,894 (+ 93,056 cached)
  • Output: 3,810
  • Total: 19,704

1,179 tokens used

codex
Hey! What’s up?
Want me to tackle something in codex-rs—tests, a bug, or a feature?

▌ Improve documentation in @filename
 ⏎ send   Shift+⏎ newline   Ctrl+C quit   1,179 tokens used   99% context left

@seratch seratch added enhancement New feature or request codex-rust-review Perform a detailed review of Rust changes. labels Aug 20, 2025
@github-actions github-actions bot added codex-rust-review-in-progress and removed codex-rust-review Perform a detailed review of Rust changes. labels Aug 21, 2025
Copy link

Summary
Adds human-friendly token count formatting with thousands separators and updates all displays to use it. Touches exec, protocol, and tui to present consistent “tokens used” text with inline format! variables.

Review
Nice, cohesive UX improvement and consistent use of {var} in format!. A couple tiny nits to consider:

  • codex-rs/protocol/src/protocol.rs (new format_token_count + Display): Implementation is clear and localized; switching FinalOutput to preformat counts is good. Snapshot/test outputs will change—please run cargo test -p codex-tui and accept snapshots if expected.
  • codex-rs/tui/src/bottom_pane/chat_composer.rs: Prefer format!(...).into() over Span::from(format!(...)) for consistency with TUI conventions.
  • codex-rs/tui/src/history_cell.rs: Good use of .into() and inline {cached_tokens}; matches TUI style guidance.

Follow-up (outside this PR scope)

  • If we want locale-aware grouping later, consider a formatter (e.g., feature‑gated) or extend format_token_count to support custom separators.

View workflow run

@seratch seratch force-pushed the issue-2148-number-format branch from 527d877 to 4df9b56 Compare August 25, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Delimiters for token count
1 participant