From 7bcc77bb3cf0d592c4fb55857489188d89dda121 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 17 Jul 2025 17:16:03 -0700 Subject: [PATCH] remove them from env flags --- codex-rs/core/src/flags.rs | 8 -------- codex-rs/core/src/model_provider_info.rs | 10 +++------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/codex-rs/core/src/flags.rs b/codex-rs/core/src/flags.rs index 48b46a32bc..c150405491 100644 --- a/codex-rs/core/src/flags.rs +++ b/codex-rs/core/src/flags.rs @@ -11,14 +11,6 @@ env_flags! { pub OPENAI_TIMEOUT_MS: Duration = Duration::from_millis(300_000), |value| { value.parse().map(Duration::from_millis) }; - pub REQUEST_MAX_RETRIES: u64 = 4; - pub OPENAI_STREAM_MAX_RETRIES: u64 = 10; - - // We generally don't want to disconnect; this updates the timeout to be five minutes - // which matches the upstream typescript codex impl. - pub OPENAI_STREAM_IDLE_TIMEOUT_MS: Duration = Duration::from_millis(300_000), |value| { - value.parse().map(Duration::from_millis) - }; /// Fixture path for offline tests (see client.rs). pub CODEX_RS_SSE_FIXTURE: Option<&str> = None; diff --git a/codex-rs/core/src/model_provider_info.rs b/codex-rs/core/src/model_provider_info.rs index 9a6caae215..97a94d4231 100644 --- a/codex-rs/core/src/model_provider_info.rs +++ b/codex-rs/core/src/model_provider_info.rs @@ -12,9 +12,6 @@ use std::env::VarError; use std::time::Duration; use crate::error::EnvVarError; -use crate::flags::OPENAI_STREAM_IDLE_TIMEOUT_MS; -use crate::flags::OPENAI_STREAM_MAX_RETRIES; -use crate::flags::REQUEST_MAX_RETRIES; use crate::openai_api_key::get_openai_api_key; /// Value for the `OpenAI-Originator` header that is sent with requests to @@ -178,20 +175,19 @@ impl ModelProviderInfo { /// Effective maximum number of request retries for this provider. pub fn request_max_retries(&self) -> u64 { - self.request_max_retries.unwrap_or(*REQUEST_MAX_RETRIES) + self.request_max_retries.unwrap_or(4) } /// Effective maximum number of stream reconnection attempts for this provider. pub fn stream_max_retries(&self) -> u64 { - self.openai_stream_max_retries - .unwrap_or(*OPENAI_STREAM_MAX_RETRIES) + self.openai_stream_max_retries.unwrap_or(10) } /// Effective idle timeout for streaming responses. pub fn stream_idle_timeout(&self) -> Duration { self.openai_stream_idle_timeout_ms .map(Duration::from_millis) - .unwrap_or(*OPENAI_STREAM_IDLE_TIMEOUT_MS) + .unwrap_or(Duration::from_millis(300_000)) } }