mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
## Why A model can change between steps of the same turn. Persisted token usage records need the model for each response to distinguish usage before and after the switch. ## What changed Add an optional `model` field to `TokenUsageRecord`. Record the model selected for the sampling step on both completed and incomplete responses. Attribute compaction usage to the model selected at the start of the turn. Existing records without the field still deserialize. ## Testing Extend coverage to check persisted model attribution and cumulative token totals after a mid-turn switch, including when the response hits the output token limit. Verify that compaction keeps the turn-start model attribution and continues restored usage totals. GitOrigin-RevId: 3615724c1cbe6ed46c9367d6c3c1a29ebaba73d8
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.