mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Preserve usage limit windows in turn and compaction analytics (#48174)
## Why Usage limit errors discarded the server-selected window responsible for the limit, leaving turn and compaction analytics unable to distinguish five-hour limits from weekly limits. ## What changed Preserve optional `limit_window_minutes` from usage limit error responses in `UsageLimitReachedError` and report it as `usage_limit_window_minutes` in turn and compaction events. Accept unsigned integers that fit in `u16`; treat missing, null, malformed, or out-of-range values as unknown. Events for other error kinds report `null`. ## Testing Add coverage for HTTP and wrapped WebSocket error mapping, analytics serialization and reduction, and app-server propagation to turn and local/remote compaction events. Cases include five-hour and weekly windows, missing or invalid values, and unrelated errors. GitOrigin-RevId: a32066a007559d91a3c868a756bfd0f976777176
This commit is contained in:
@@ -475,6 +475,10 @@ impl CompactionAnalyticsAttempt {
|
||||
codex_error_kind: codex_error.map(Into::into),
|
||||
codex_error_http_status_code: codex_error
|
||||
.and_then(CodexErr::http_status_code_value),
|
||||
usage_limit_window_minutes: codex_error.and_then(|error| match error.details() {
|
||||
CodexErrorDetails::UsageLimitReached(error) => error.limit_window_minutes,
|
||||
_ => None,
|
||||
}),
|
||||
active_context_tokens_before,
|
||||
active_context_tokens_after,
|
||||
retained_image_count,
|
||||
|
||||
Reference in New Issue
Block a user