From aabce31e841c8ae5f9f866d7f62bf9c7c0448894 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 17 Jul 2025 21:25:28 -0700 Subject: [PATCH] review --- codex-rs/core/src/codex.rs | 6 +++--- codex-rs/core/src/model_provider_info.rs | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 46e6607ddd..2c5baf152f 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -1126,8 +1126,8 @@ async fn try_run_turn( // Poll the next item from the model stream. We must inspect *both* Ok and Err // cases so that transient stream failures (e.g., dropped SSE connection before // `response.completed`) bubble up and trigger the caller's retry logic. - let next = stream.next().await; - let Some(next) = next else { + let event = stream.next().await; + let Some(event) = event else { // Channel closed without yielding a final Completed event or explicit error. // Treat as a disconnected stream so the caller can retry. return Err(CodexErr::Stream( @@ -1135,7 +1135,7 @@ async fn try_run_turn( )); }; - let event = match next { + let event = match event { Ok(ev) => ev, Err(e) => { // Propagate the underlying stream error to the caller (run_turn), which diff --git a/codex-rs/core/src/model_provider_info.rs b/codex-rs/core/src/model_provider_info.rs index 84296a3593..72ef58c60a 100644 --- a/codex-rs/core/src/model_provider_info.rs +++ b/codex-rs/core/src/model_provider_info.rs @@ -179,19 +179,20 @@ impl ModelProviderInfo { /// Effective maximum number of request retries for this provider. pub fn request_max_retries(&self) -> u64 { self.request_max_retries - .unwrap_or(OPENAI_REQUEST_MAX_RETRIES) + .unwrap_or(DEFAULT_REQUEST_MAX_RETRIES) } /// Effective maximum number of stream reconnection attempts for this provider. pub fn stream_max_retries(&self) -> u64 { - self.stream_max_retries.unwrap_or(OPENAI_STREAM_MAX_RETRIES) + self.stream_max_retries + .unwrap_or(DEFAULT_STREAM_MAX_RETRIES) } /// Effective idle timeout for streaming responses. pub fn stream_idle_timeout(&self) -> Duration { self.stream_idle_timeout_ms .map(Duration::from_millis) - .unwrap_or(Duration::from_millis(OPENAI_STREAM_IDLE_TIMEOUT_MS)) + .unwrap_or(Duration::from_millis(DEFAULT_STREAM_IDLE_TIMEOUT_MS)) } }