mirror of
https://github.com/openai/codex.git
synced 2026-10-21 14:23:14 +00:00
## Why Terminal `response.incomplete` errors discard reported token usage. Counting that usage as a new context baseline can also double-count input and trigger unnecessary compaction on the next turn. ## What changed - Carry the response ID and valid reported usage with incomplete-response errors. - Record usage for sampling and foreground compaction in cumulative totals, rollout records, budgets, and token-usage contributors without replacing the context baseline. Preserve the original terminal error, including when accounting exhausts the budget or cancellation races the error. - Charge incomplete background compaction requests to the rollout budget without publishing foreground token usage. - Ignore missing or malformed usage rather than estimating it. ## Testing Extend coverage for SSE and WebSocket incomplete responses, rollout usage records, compaction accounting, deferred token-count events, and token-usage contributors. Add regressions for unnecessary compaction on the next turn and background compaction publishing foreground usage. GitOrigin-RevId: bf1ee6df3912052ab7c19e1c6af8ad3dc4b07675
codex-protocol
This crate defines the "types" for the protocol used by Codex CLI, which includes both "internal types" for communication between codex-core and codex-tui, as well as "external types" used with codex app-server.
This crate should have minimal dependencies.
Ideally, we should avoid "material business logic" in this crate, as we can always introduce Ext-style traits to add functionality to types in other crates.