diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index 99c8ee6b21..394edb34a8 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -618,8 +618,6 @@ pub struct AccountRateLimitsUpdatedNotification { pub rate_limits: RateLimitSnapshot, } -// CamelCased copy of codex_protocol::protocol::{RateLimitSnapshot, RateLimitWindow} -// for the v2 API. This avoids leaking snake_case into the v2 wire format. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] @@ -642,21 +640,21 @@ impl From for RateLimitSnapshot { #[ts(export_to = "v2/")] pub struct RateLimitWindow { /// Percentage (0-100) of the window that has been consumed. - pub used_percent: f64, + pub used_percent: i64, /// Rolling window duration, in minutes. #[ts(type = "number | null")] - pub window_minutes: Option, - /// Unix timestamp (seconds since epoch) when the window resets. + pub window_duration_mins: Option, + /// Unix timestamp (milliseconds since epoch) when the window resets. #[ts(type = "number | null")] - pub resets_at: Option, + pub resets_at_ms: Option, } impl From for RateLimitWindow { fn from(value: codex_protocol::protocol::RateLimitWindow) -> Self { Self { - used_percent: value.used_percent, - window_minutes: value.window_minutes, - resets_at: value.resets_at, + used_percent: value.used_percent as i64, + window_duration_mins: value.window_minutes, + resets_at_ms: value.resets_at.map(|ms| ms * 1000), } } } diff --git a/codex-rs/app-server/src/outgoing_message.rs b/codex-rs/app-server/src/outgoing_message.rs index d148c1ee38..19d222a2af 100644 --- a/codex-rs/app-server/src/outgoing_message.rs +++ b/codex-rs/app-server/src/outgoing_message.rs @@ -181,9 +181,9 @@ mod tests { codex_app_server_protocol::AccountRateLimitsUpdatedNotification { rate_limits: RateLimitSnapshot { primary: Some(RateLimitWindow { - used_percent: 25.0, - window_minutes: Some(15), - resets_at: Some(123), + used_percent: 25, + window_duration_mins: Some(15), + resets_at_ms: Some(123), }), secondary: None, },