Skip to content

estimate_token_count units bug #9287

@Zaczero

Description

@Zaczero

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.

} => estimate_reasoning_length(content.len()) as i64,

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentIssues related to the core agent loopbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions