### What version of Codex is running? 0.0.0 ### What subscription do you have? N/A ### Which model were you using? _No response_ ### What platform is your computer? _No response_ ### What terminal emulator and version are you using (if applicable)? _No response_ ### What issue are you seeing? estimate_token_count uses estimate_reasoning_length without converting it to token count via approx_tokens_from_byte_count, causing ~4x overcount. https://github.com/openai/codex/blob/faeb08c1e139590a1e01929d2bf289c2a6c47e2e/codex-rs/core/src/context_manager/history.rs#L100 ### What steps can reproduce the bug? when getting back in history, at 25% context usage, the compaction starts as if 100% context was used ### What is the expected behavior? _No response_ ### Additional information i think your style of naming is error prone and could be better or you could make use of strong aliasing https://doc.rust-lang.org/reference/items/type-aliases.html
Activity
Fix token estimate during compaction
Fix token estimate during compaction (#9337)
etraut-openai commentedon Jan 16, 2026
Thanks for the bug report and analysis. This will be addressed in the next release.
Fix token estimate during compaction (openai#9337)