mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
## Why Turn completion metrics used session-level telemetry, which could label usage with the wrong model after a model switch. A turn can also include compaction and responses from different models, so a single token total cannot attribute usage correctly. ## What changed - Accumulate token usage by model using each response's resolved step settings, and emit one histogram sample per model and token type per turn. - Preserve zero-valued samples when no usage is reported, without adding a sample for an unused selected model when only compaction ran. - Use turn telemetry for tool-call, memory, network-proxy, and running-process metrics. ## Testing Add regression tests for model switches, step-level model changes, compaction followed by a response or an aborted turn, and turns without responses. Verify repeated requests aggregate into one sample per model and earlier session usage is excluded. GitOrigin-RevId: 03ab1dcde7da0b16b3a500a9a05e4c86583ee585
23 lines
777 B
Rust
23 lines
777 B
Rust
mod additional_context;
|
|
mod auto_compact_window;
|
|
mod service;
|
|
mod session;
|
|
mod turn;
|
|
mod turn_token_usage;
|
|
|
|
pub(crate) use crate::tools::ExecutedToolCalls;
|
|
pub(crate) use additional_context::AdditionalContextStore;
|
|
pub(crate) use auto_compact_window::AutoCompactWindowIds;
|
|
pub(crate) use auto_compact_window::AutoCompactWindowSnapshot;
|
|
pub(crate) use service::SessionServices;
|
|
pub(crate) use session::ReasoningEffortPin;
|
|
pub(crate) use session::SessionState;
|
|
pub(crate) use turn::AcceptedUserInputResponse;
|
|
pub(crate) use turn::ActiveTurn;
|
|
pub(crate) use turn::MailboxDeliveryPhase;
|
|
pub(crate) use turn::PendingRequestPermissions;
|
|
pub(crate) use turn::RunningTask;
|
|
pub(crate) use turn::TaskKind;
|
|
pub(crate) use turn::TurnState;
|
|
pub(crate) use turn_token_usage::TurnTokenUsage;
|