Lightweight coding agent that runs in your terminal
Rust
Raise image byte estimate for compaction token accounting (#12717)
Eric Traut8da40c9251c7
diff --git a/codex-rs/core/src/context_manager/history.rs b/codex-rs/core/src/context_manager/history.rsindex a3dbc643bb..f6f7198f6e 100644--- a/codex-rs/core/src/context_manager/history.rs+++ b/codex-rs/core/src/context_manager/history.rs@@ -421,9 +421,9 @@ fn estimate_item_token_count(item: &ResponseItem) -> i64 {/// Approximate model-visible byte cost for one image input.///-/// The estimator later converts bytes to tokens using a 4-bytes/token heuristic,-/// so 340 bytes is approximately 85 tokens.-const IMAGE_BYTES_ESTIMATE: i64 = 340;+/// The estimator later converts bytes to tokens using a 4-bytes/token heuristic+/// with ceiling division, so 7,373 bytes maps to approximately 1,844 tokens.+const IMAGE_BYTES_ESTIMATE: i64 = 7373;pub(crate) fn estimate_response_item_model_visible_bytes(item: &ResponseItem) -> i64 {match item {