Files
codex/codex-rs/app-server-protocol/schema/precomputed
Steve Coffey b26c32c843 Record model attribution in persisted token usage (#64804)
## 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
2026-11-30 20:29:59 +00:00
..