mirror of
https://github.com/openai/codex.git
synced 2026-10-21 07:42:01 +00:00
Make unbounded connection retries configurable (#38601)
## What changed - Add the stable, default-enabled `unbounded_connection_retries` feature. - Require the feature for unbounded sampling retries after connection failures. When disabled, connection failures use the existing bounded retry and transport fallback path. - Expose the feature in the generated configuration schema. GitOrigin-RevId: bd80d02ef065ba924f805c29b639752fc817ed64
This commit is contained in:
committed by
copyberry
parent
3360f4a909
commit
da898490fc
@@ -777,6 +777,9 @@
|
||||
"unavailable_dummy_tools": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"unbounded_connection_retries": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"undo": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -5434,6 +5437,9 @@
|
||||
"unavailable_dummy_tools": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"unbounded_connection_retries": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"undo": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::session::session::Session;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use crate::util::backoff;
|
||||
use codex_client::RetryOperation;
|
||||
use codex_features::Feature;
|
||||
use codex_protocol::error::CodexErr;
|
||||
use codex_protocol::error::CodexErrorDetails;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
@@ -54,7 +55,11 @@ pub(crate) async fn handle_retryable_response_stream_error(
|
||||
ResponsesStreamRequest::RemoteCompactionV2 => RetryOperation::RemoteCompactionV2,
|
||||
};
|
||||
|
||||
if matches!(request, ResponsesStreamRequest::Sampling)
|
||||
if turn_context
|
||||
.config
|
||||
.features
|
||||
.enabled(Feature::UnboundedConnectionRetries)
|
||||
&& matches!(request, ResponsesStreamRequest::Sampling)
|
||||
&& matches!(err.details(), CodexErrorDetails::ConnectionFailed(_))
|
||||
&& !turn_context.session_source.is_internal()
|
||||
&& !turn_context.provider.info().is_amazon_bedrock()
|
||||
|
||||
@@ -157,6 +157,8 @@ pub enum Feature {
|
||||
Chronicle,
|
||||
/// Compress request bodies (zstd) when sending streaming requests to codex-backend.
|
||||
EnableRequestCompression,
|
||||
/// Keep active sampling turns alive until a failed network connection recovers.
|
||||
UnboundedConnectionRetries,
|
||||
/// Start the managed network proxy for sandboxed sessions.
|
||||
NetworkProxy,
|
||||
/// Respect host system proxy settings for Codex-owned network clients.
|
||||
@@ -1054,6 +1056,12 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
stage: Stage::Stable,
|
||||
default_enabled: true,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::UnboundedConnectionRetries,
|
||||
key: "unbounded_connection_retries",
|
||||
stage: Stage::Stable,
|
||||
default_enabled: true,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::NetworkProxy,
|
||||
key: "network_proxy",
|
||||
|
||||
Reference in New Issue
Block a user