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:
Adam Perry @ OpenAI
2026-08-14 16:23:17 +00:00
committed by copyberry
parent 3360f4a909
commit da898490fc
3 changed files with 20 additions and 1 deletions
+6
View File
@@ -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"
},
+6 -1
View File
@@ -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()
+8
View File
@@ -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",