From 71019744b731fcfc9760e19f786b82062e18d5f6 Mon Sep 17 00:00:00 2001 From: Vitalii Valkov Date: Sat, 29 Aug 2026 19:15:14 +0200 Subject: [PATCH] Let codex retry a turn the overlay dropped A turn reaches the platform over the overlay, and a connection that served one turn may be gone by the next: the tunnel closes its circuit and the following request goes into it before anything notices. With no retries at all that was fatal -- the tool call ran, and the turn that should have reported what it found died on the way out with nothing posted to the thread. The zeros were set to match what the e2e config had, which is a reason to make a test deterministic and not a reason for an agent in a cluster to give up on its first dropped connection. --- internal/daemon/codexconfig.go | 10 ++++++++-- internal/daemon/codexconfig_test.go | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/daemon/codexconfig.go b/internal/daemon/codexconfig.go index 6f3eccf..b4ad8c4 100644 --- a/internal/daemon/codexconfig.go +++ b/internal/daemon/codexconfig.go @@ -97,6 +97,12 @@ var codexSystemConfigPath = "/etc/codex/config.toml" const codexCredentialsStore = `mcp_oauth_credentials_store = "file" ` +// A turn reaches the platform over the overlay, and a connection that served +// one turn may be gone by the next: the tunnel closes its circuit and the next +// request goes into it before anything notices. Refusing to retry made that +// fatal -- the tool call would run and the turn that should have reported it +// died on the way out, with nothing posted to the thread. Two is small enough +// that a provider genuinely refusing is still reported rather than hammered. const codexConfigTemplate = `model_provider = "platform" approval_policy = "never" sandbox_mode = "danger-full-access" @@ -105,8 +111,8 @@ sandbox_mode = "danger-full-access" name = "Agyn LLM" base_url = %q %swire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 +request_max_retries = 2 +stream_max_retries = 2 supports_websockets = false ` diff --git a/internal/daemon/codexconfig_test.go b/internal/daemon/codexconfig_test.go index 4576241..fc55885 100644 --- a/internal/daemon/codexconfig_test.go +++ b/internal/daemon/codexconfig_test.go @@ -395,8 +395,8 @@ sandbox_mode = "danger-full-access" name = "Agyn LLM" base_url = %q %swire_api = "responses" -request_max_retries = 0 -stream_max_retries = 0 +request_max_retries = 2 +stream_max_retries = 2 supports_websockets = false mcp_oauth_credentials_store = "file" `, baseURL, apiKeyEnv)