mirror of
https://github.com/openai/codex.git
synced 2026-10-26 07:58:43 +00:00
## Why Serialized response items include message IDs, metadata, and JSON escaping that inflate token estimates without adding model-visible content. ## What changed - Estimate each response item from its content, retaining JSON syntax for structured tool payloads. - Apply image estimates to all image inputs, including non-base64 URLs, and count audio and encrypted content through their modality-specific estimates. - Exclude plaintext reasoning and bookkeeping-only items from replay accounting. ## Testing Update unit expectations for text, images, audio, and encrypted content. Add a remote compaction regression test showing that equal-length text produces identical token usage estimates despite different message IDs, metadata, and JSON escaping, while preserving the submitted messages. GitOrigin-RevId: 1c43d5abbcc1668b4ab413901a2b4b6511ca5892