You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Responses WebSocket stalls 300s per retry; opt-out flag removed; HTTPS fallback requires 5 failed retries #38638
appIssues related to the Codex desktop appbugSomething isn't workingconnectivityIssues involving networking or endpoint connectivity problems (disconnections)
Environment: ChatGPT desktop 26.810.41047 (macOS, Darwin 25.3.0), bundled codex-cli 0.148.0-alpha.9, model gpt-5.6-sol (high/max reasoning effort), service_tier priority, ChatGPT-plan auth.
Symptom: Sampling over wss://chatgpt.com/backend-api/codex/responses goes silent mid-turn. The client detects the dead stream only via a 300s idle timeout (codex_core::responses_retry: stream disconnected before completion: idle timeout waiting for websocket; sometimes IO error: Connection reset by peer (os error 54)). Each retry cycle is a ~5-minute user-visible stall with frozen token counts.
Evidence (2026-08-14, UTC):
Thread 01a00079-2445-7f01-a7a1-2764c376afe9: 11 stalls of 301–310s between 13:33–14:35, including four consecutive (13:59 → 14:15).
Turn 01a00191-22f6-79f1-a260-71201ed53982: exhausted retries 5/5 at 19:17.
A prior incident produced 16 five-minute reconnects across three tasks in one day.
Aggravating factors:
responses_websockets / responses_websockets_v2 are stage removed in codex features list — users cannot opt out of the websocket transport.
Built-in provider override is rejected ("model_providers contains reserved built-in provider IDs"), so supports_websockets / stream_idle_timeout_ms are unreachable.
HTTPS fallback only engages after 5 failed retries (~25 minutes of stalling).
The network here has documented upstream packet loss under load, which is presumably the trigger — but SSE-based clients on the same link detect drops and recover in seconds. The websocket transport takes 300s per detection with no user recourse.
Request: websocket-level keepalive/liveness so a dead stream is detected in seconds rather than 300s; and/or restore the transport opt-out; and/or engage the HTTPS fallback on the first idle timeout instead of the fifth.
Follow-up with stronger evidence that this is transport/server-side, not the local network.
2026-08-18 (ChatGPT desktop 26.810.52044, same bundled codex-cli 0.148.0-alpha.9): 33 websocket idle-timeout stall/retry cycles logged in one day — worst so far. Example chain: turn 01a0162c-a4d2-71e2-80f1-dab3f385118c hit retries 1→4 at 18:47:06, 18:52:11, 18:57:19, 19:02:28 UTC (one ~5-minute frozen stall per retry), preceded by turn 01a015fa-40b7-7780-b354-99e3e29fcb1b retries at 18:31:44 / 18:36:51. All stream disconnected before completion: idle timeout waiting for websocket.
The key datapoint: an automated hourly line-quality test ran at 18:32 UTC — in the middle of that stall cluster — and measured 22 Mbps up / 360 Mbps down with zero errors and 0% idle packet loss to the ISP's first hop. The local link was verifiably healthy at the exact minutes the websocket streams were stalling. (This host previously had a genuinely lossy uplink; on 2026-08-18 it tested clean all day — 14/14 hourly runs passed — while Codex logged its worst stall count yet.)
This rules out the local-network explanation for these episodes and points at the websocket path (edge terminates at DFW per cf-ray) or upstream sampling. The 300s detection time and 5-retries-before-HTTPS-fallback turn each server-side hiccup into 5–25 minutes of frozen UI.
Re-requesting: ws keepalive/liveness (seconds, not 300s), transport opt-out, or first-timeout HTTPS fallback.
We hit the same idle timeout waiting for websocket + silent retrying sampling request (n/5) on Desktop 26.814.41407 / 0.148.0-alpha.15 / gpt-5.6-sol high.
A localhost reverse proxy injecting unknown-type text frames ({"type":"codex.client.keepalive"}) every 45s stopped the idle timeout. Codex logged unhandled responses event: "codex.client.keepalive" and the same in-flight request resumed with a real tool/patch after ~8.5 min of no model text.
So at least some of these 300s stalls are false dead-streams (no Responses text during high-reasoning), not packet loss. Faster dead-stream detection would have aborted a live turn. Built-in openai still cannot set stream_idle_timeout_ms / supports_websockets, which matches this issue.
Additional sanitized prevalence data from Codex Desktop 26.818.41509 / bundled command runner 0.149.0-alpha.4.1:
A seven-day local host audit found 296 Responses WebSocket retry log entries across 175 tasks. I cannot determine billing impact from local logs and am not asserting that every retry was charged. The important operational result is that reconnect/fallback is common enough to amplify latency and agent recovery work.
This supports a session-level circuit breaker or supported transport selector: after a confirmed transport failure, switch once to HTTPS rather than repeating the same WebSocket path through the full retry budget.
For me it was my USB ethernet adapter. I worked fine for videocalling so I assumed all was well, but switching to another slower more reliable one proved successful.
I've also encountered the delayed HTTPS fallback described here while using native Codex app-server through T3 Code on both Linux and Windows. Reproduced the recovery sequence separately with Codex 0.166.0 against a local mock Responses API.
Captured production trigger differs from the original 300-second idle timeout, but confirms the five-retry fallback behavior:
One Windows trace starts with websocket_connection_limit_reached at the documented 60-minute connection lifetime.
Codex opens fresh WebSocket connections, but subsequent requests fail with websocket closed by server before response.completed.
The UI receives Reconnecting... 2/5 through 5/5. About 60 seconds after the initial error, native Codex logs falling back to HTTP.
That turn eventually completes successfully. Other retained Linux and Windows incidents also show upstream stream interruptions followed by recovery. This is an upstream Responses connection failure reported by app-server; the recorded notification does not establish a browser-to-T3 disconnection.
The generic early-close errors do not identify whether the service or an intermediary closed the connection. I am not attributing those errors to a specific network component or claiming to have reproduced the original issue's idle-timeout trigger.
For the isolated 0.166.0 reproduction:
A mock model response calls a dynamic tool, and the tool returns its result.
The next sampling request receives the connection-limit error; subsequent fresh WebSocket connections close before completion.
With stream_max_retries=5, Codex emits the repeated reconnect notifications, then falls back to HTTP/SSE and completes.
With stream_max_retries=1 on the mock provider, Codex makes one fresh WebSocket retry, then falls back and completes. The tool result is preserved, and the tool executes only once in each run.
The reproduction used temporary Codex state, a loopback-only mock service, and no real model inference. It changed provider configuration, not the native executable.
This supports a bounded, earlier HTTPS fallback for repeated WebSocket transport failures. The fallback gate in current core/src/responses_retry.rs::handle_response_stream_error still waits for the configured stream retry budget to be exhausted. I have not applied a native runtime patch or changed production transport settings.
Update: the trigger on my side was my own network, not OpenAI. The way Codex handled it is still worth reporting.
Cause
The host's IPv6 default route had two next hops, the ISP router and a second router on the same LAN that dropped all IPv6 traffic. Linux picks a new path for a flow after packet loss, so a long-lived WebSocket to chatgpt.com could move to the dead router mid-stream and go silent with no RST. After I pinned the default route to the ISP router, Codex logged no idle timeout waiting for websocket in the next 36 hours. There was one Connection reset without closing handshake, and Codex recovered from it in 191 ms.
What Codex did with a dead path
It took 300 s to notice each time. Before the fix I had 9 such timeouts in two days.
The retry could hit the same dead path. In one turn the first retry, on a new connection, stalled for another 300 s, so the turn lost 10 minutes.
During one stall the socket had 94 unacknowledged bytes and the kernel had retransmitted them 11 times, so the client could have seen that the path was dead.
The first retry sent no notification to the app-server client. The client could not tell a stall from long reasoning.
turn/steer returned success at once, but the model only received the user's messages after recovery, 5 minutes later.
A client ping with a pong deadline, as proposed in #42914, would have caught all of these within about 45 s. Showing the first retry and telling the client that a steer is still queued would also help.
Environment: codex-cli 0.166.0, codex app-server over stdio from T3 Code, gpt-6.1-sol at high reasoning, Linux x86_64.
I’m experiencing the same recurring/intermittent Codex Desktop behavior: Reconnecting …/5 followed by stream disconnected before completion: idle timeout waiting for websocket.
I submitted an in-app report using the /feedback command so OpenAI can correlate the client/server diagnostics with this issue.
I reproduced the delayed fallback on Codex CLI 0.169.1 through the Codex App Server on macOS arm64. OpenBot 0.72.0 still displayed its generic no-update warning after the first five-minute idle timeout. Codex logged retry 1/5. The first retry has no App Server notification in the release build. The cause of the production silence remains unknown.
The loopback test below forces a silent WebSocket immediately after a synthetic read-only tool call. It sets the fixture retry budget to two and uses a short idle timeout. Stock 0.169.1 sent three silent WebSocket sampling requests before switching transports. I ended the first HTTP stream before completion. The second HTTP request completed the original turn. The client executed the tool once. Each retry carried one copy of the original tool result. App Server reported the second WebSocket retry and the first HTTP retry.
The candidate keeps the current idle timeout. It changes the transport after the first WebSocket sampling request that Codex has already timed out, sends a retry notification, and keeps the HTTP retry budget and any Retry-After deadline. It targets the 0.169.1 source. Current main has an immediate-fallback policy for WebsocketMessageTooLarge; an idle timeout remains on the generic stream retry path. The attached regression passes on stock in baseline mode and fails in patched mode as expected. The Rust candidate still needs a release build and test run.
Candidate patch for 0.169.1
diff --git a/codex-rs/core/src/responses_retry.rs b/codex-rs/core/src/responses_retry.rs
index 6a42146..c32df1f 100644
--- a/codex-rs/core/src/responses_retry.rs+++ b/codex-rs/core/src/responses_retry.rs@@ -23,6 +23,12 @@ use tracing::warn;
const INITIAL_CONNECTION_RETRY_DELAY: Duration = Duration::from_secs(5);
const MAX_CONNECTION_RETRY_DELAY: Duration = Duration::from_secs(60);
+fn is_sampling_websocket_idle_timeout(request: ResponsesStreamRequest, err: &CodexErr) -> bool {+ matches!(request, ResponsesStreamRequest::Sampling)+ && matches!(err.details(), CodexErrorDetails::Stream(message)+ if message == "idle timeout waiting for websocket")+}+
#[derive(Debug, Clone, Copy)]
pub(crate) enum ResponsesStreamRequest {
Sampling,
@@ -118,23 +124,30 @@ pub(crate) async fn handle_response_stream_error(
return Ok(());
}
- if retry_state.retries >= max_retries+ let websocket_idle_timeout = is_sampling_websocket_idle_timeout(request, &err);+ if (retry_state.retries >= max_retries || websocket_idle_timeout)
&& client_session.try_switch_fallback_transport(
&turn_context.session_telemetry,
turn_context.model_info(),
)
{
+ // A silent socket has already held this request for one idle timeout. Tell the app that+ // the request will continue, and give HTTPS its usual retry budget.+ let message = format!("Falling back from WebSockets to HTTPS transport. {err:#}");+ let retry_at = retry_after.map(RetryAfter::deadline).or_else(|| {+ (websocket_idle_timeout && retry_state.retries < max_retries)+ .then(|| Instant::now() + delay)+ });+ if websocket_idle_timeout {+ sess.notify_stream_error(turn_context, "Reconnecting over HTTPS", err)+ .await;+ }
// Changing transport must not bypass the server's retry deadline.
- if let Some(retry_after) = retry_after {- tokio::time::sleep_until(retry_after.deadline()).await;+ if let Some(retry_at) = retry_at {+ tokio::time::sleep_until(retry_at).await;
}
- sess.send_event(- turn_context,- EventMsg::Warning(WarningEvent {- message: format!("Falling back from WebSockets to HTTPS transport. {err:#}"),- }),- )- .await;+ sess.send_event(turn_context, EventMsg::Warning(WarningEvent { message }))+ .await;
retry_state.retries = 0;
return Ok(());
}
diff --git a/codex-rs/core/src/responses_retry_tests.rs b/codex-rs/core/src/responses_retry_tests.rs
index 65aa293..236e71e 100644
--- a/codex-rs/core/src/responses_retry_tests.rs+++ b/codex-rs/core/src/responses_retry_tests.rs@@ -1,6 +1,7 @@
use super::ResponsesStreamRequest;
use super::ResponsesStreamRetryState;
use super::handle_response_stream_error;
+use super::is_sampling_websocket_idle_timeout;
use super::log_retry;
use crate::realtime_history::RealtimeHistoryState;
use crate::session::step_context::StepContext;
@@ -13,6 +14,32 @@ use tokio::sync::Mutex;
use tokio::time::Instant;
use tracing_test::internal::MockWriter;
+#[test]+fn only_sampling_websocket_idle_timeout_requests_early_http_fallback() {+ let websocket_idle = CodexErr::Stream("idle timeout waiting for websocket".to_string());+ assert!(is_sampling_websocket_idle_timeout(+ ResponsesStreamRequest::Sampling,+ &websocket_idle,+ ));+ assert!(!is_sampling_websocket_idle_timeout(+ ResponsesStreamRequest::RemoteCompactionV2,+ &websocket_idle,+ ));+ for message in [+ "idle timeout waiting for SSE",+ "websocket closed by server before response.completed",+ ] {+ assert!(!is_sampling_websocket_idle_timeout(+ ResponsesStreamRequest::Sampling,+ &CodexErr::Stream(message.to_string()),+ ));+ }+ assert!(!is_sampling_websocket_idle_timeout(+ ResponsesStreamRequest::Sampling,+ &CodexErr::InternalServerError,+ ));+}+
#[tokio::test]
async fn sampling_retry_logs_stream_error_context() {
let (_session, turn_context) = make_session_and_context().await;
Loopback App Server regression
Save as reproduce-post-tool.mjs. Run bun reproduce-post-tool.mjs /path/to/stock/codex baseline or bun reproduce-post-tool.mjs /path/to/candidate/codex patched.
importassertfrom'node:assert/strict';import{writeFile}from'node:fs/promises';import{join}from'node:path';constexecutable=process.argv[2];assert.ok(executable,'usage: bun reproduce-post-tool.mjs /path/to/codex baseline|patched');constmode=process.argv[3]??'baseline';assert.ok(['baseline','patched'].includes(mode),'expected baseline or patched');constevents=[];constcallId='call_transport_fixture';consttoolValue='FIXTURE_TOOL_RESULT_4E2C';consttoolOutputs=[];letreturnedToolCall=false;letdiscoveredFixtureTool=null;lethttpEncodings=[];functionfixtureTool(tools){for(consttooloftools??[]){if(tool.type==='function'&&tool.name==='read_transport_fixture')return{};if(tool.type==='namespace'&&tool.tools?.some(member=>member.name==='read_transport_fixture')){return{namespace: tool.name};}}returnnull;}functionrecordToolOutput(transport,request){constoutputs=(request.input??[]).filter(item=>item.type==='function_call_output'&&item.call_id===callId);toolOutputs.push({transport,count:outputs.length,hasValue:outputs.some(item=>JSON.stringify(item.output).includes(toolValue))});}constmessages=[{type: 'response.output_item.done',output_index: 0,item: {type: 'message',id: 'msg_fixture',role: 'assistant',status:'completed',phase:'final_answer',content: [{type:'output_text',text:'transport recovered',annotations: []}]}},{type: 'response.completed',response: {id: 'resp_fixture',status:'completed',output: []}},];constserver=Bun.serve({hostname: '127.0.0.1',port: 0,asyncfetch(request,instance){const{pathname}=newURL(request.url);if(pathname.endsWith('/responses')&&request.headers.get('upgrade')==='websocket'){returninstance.upgrade(request) ? undefined : newResponse(null,{status: 400});}if(pathname.endsWith('/responses')&&request.method==='POST'){events.push('http-response');constencoding=request.headers.get('content-encoding')??'identity';httpEncodings.push(encoding);letbody=newUint8Array(awaitrequest.arrayBuffer());if(encoding==='zstd')body=Bun.zstdDecompressSync(body);if(encoding==='gzip')body=Bun.gunzipSync(body);recordToolOutput('http',JSON.parse(newTextDecoder().decode(body)));if(events.filter(event=>event==='http-response').length===1){// End the first HTTP stream before completion to verify it can be retried.returnnewResponse('data: {"type":"response.created","response":{"id":"resp_incomplete"}}\n\n',{headers: {'content-type': 'text/event-stream'},});}returnnewResponse(messages.map(event=>`data: ${JSON.stringify(event)}\n\n`).join(''),{headers: {'content-type': 'text/event-stream'},});}returnResponse.json({data: []});},websocket: {message(socket,raw){constrequest=JSON.parse(String(raw));if(request.type!=='response.create')return;discoveredFixtureTool??=fixtureTool(request.tools);if(request.generate===false){events.push('websocket-prewarm');socket.send(JSON.stringify({type: 'response.completed',response: {id: 'resp_prewarm',status:'completed',output: []}}));return;}if(!returnedToolCall){returnedToolCall=true;constitem={type: 'function_call',id: 'fc_transport_fixture',call_id: callId,name: 'read_transport_fixture',
...(discoveredFixtureTool??{}),arguments: '{}',};events.push('websocket-tool-call');socket.send(JSON.stringify({type:'response.output_item.done',output_index:0,item}));socket.send(JSON.stringify({type:'response.completed',response:{id:'resp_tool',status:'completed',output:[item]}}));return;}events.push('websocket-silent');recordToolOutput('websocket',request);},},});try{constcwd=import.meta.dir;constconfig={model_provider: 'transport_fixture','model_providers.transport_fixture.name': 'OpenAI','model_providers.transport_fixture.base_url': `http://127.0.0.1:${server.port}/v1`,'model_providers.transport_fixture.wire_api': 'responses','model_providers.transport_fixture.supports_websockets': true,'model_providers.transport_fixture.requires_openai_auth': false,'model_providers.transport_fixture.stream_idle_timeout_ms': 350,'model_providers.transport_fixture.stream_max_retries': 2,'analytics.enabled': false,'features.unified_exec': true,'features.code_mode': false,web_search: 'disabled',log_dir: join(cwd,'logs'),};constargs=['app-server','--listen','stdio://', ...Object.entries(config).flatMap(([key,value])=>['-c',`${key}=${JSON.stringify(value)}`])];constchild=Bun.spawn([executable, ...args],{cwd,stdin:'pipe',stdout:'pipe',stderr:'ignore'});constlimit=setTimeout(()=>child.kill(),20_000);letbuffer='';constreader=child.stdout.pipeThrough(newTextDecoderStream()).getReader();letnextId=0;constwireOutput=[];lettoolExecutions=0;letcode;functionsend(value){child.stdin.write(`${JSON.stringify(value)}\n`);child.stdin.flush();}asyncfunctionnextEvent(){while(!buffer.includes('\n')){constincoming=awaitreader.read();assert.equal(incoming.done,false,'Codex ended before completing the fixture');buffer+=incoming.value;}constend=buffer.indexOf('\n');constevent=JSON.parse(buffer.slice(0,end));buffer=buffer.slice(end+1);wireOutput.push(event);if(event.method&&event.id!==undefined){if(event.method==='item/tool/call'&&event.params?.tool==='read_transport_fixture'){toolExecutions+=1;send({id:event.id,result:{success:true,contentItems:[{type:'inputText',text:toolValue}]}});}else{send({id:event.id,error:{code:-32601,message:'Fixture supports only read_transport_fixture'}});}}returnevent;}asyncfunctionrequest(method,params){constid=++nextId;send({id,method,params});for(;;){constevent=awaitnextEvent();if(event.id===id&&!event.method){assert.ok(event.result,`Codex did not accept ${method}`);returnevent.result;}}}try{awaitrequest('initialize',{clientInfo:{name:'openbot',title:'Transport fixture',version:'0.72.0'},capabilities:{experimentalApi:true}});send({method:'initialized'});const{thread}=awaitrequest('thread/start',{
cwd,model:'gpt-6.2-sol',modelProvider:'transport_fixture',ephemeral:true,approvalPolicy:'never',sandbox:'read-only',dynamicTools:[{name:'read_transport_fixture',description:'Returns the test value.',deferLoading:false,inputSchema:{type:'object',properties:{},additionalProperties:false}}],});const{turn}=awaitrequest('turn/start',{threadId:thread.id,input:[{type:'text',text:'Read the transport fixture.',text_elements:[]}],effort:'low'});for(;;){constevent=awaitnextEvent();if(event.method==='turn/completed'&&event.params?.turn?.id===turn.id)break;}child.stdin.end();code=awaitchild.exited;}finally{clearTimeout(limit);if(child.exitCode===null)child.kill();awaitreader.cancel();awaitchild.exited;}constretryEvents=wireOutput.filter(event=>event.method==='error'&&event.params?.willRetry);constdiagnostics=retryEvents.map(event=>event.params.error.message);constidleDiagnostic=retryEvents[0]?.params.error.additionalDetails??'';constresult={
mode, code, events,eventTypes: wireOutput.filter(event=>event.method).map(event=>event.method),
diagnostics,
idleDiagnostic,
httpEncodings,
toolOutputs,
toolExecutions,completed: wireOutput.some(event=>event.method==='turn/completed'&&event.params?.turn?.status==='completed'),answer: wireOutput.find(event=>event.method==='item/completed'&&event.params?.item?.type==='agentMessage')?.params.item.text??null,};awaitwriteFile(join(cwd,`report-post-tool-${mode}.json`),JSON.stringify(result,null,2));console.log(JSON.stringify(result));assert.equal(code,0);assert.equal(events.filter(event=>event==='websocket-silent').length,mode==='patched' ? 1 : 3);assert.equal(events.filter(event=>event==='http-response').length,2);assert.equal(diagnostics.length,2);assert.match(idleDiagnostic,/idletimeoutwaitingforwebsocket/);assert.match(diagnostics[0],mode==='patched' ? /reconnectingoverhttps/i : /reconnecting[^\n]*2\/2/i);assert.match(diagnostics[1],/reconnecting[^\n]*1\/2/i);assert.equal(events.filter(event=>event==='websocket-tool-call').length,1);assert.equal(result.toolExecutions,1);assert.equal(wireOutput.filter(event=>event.method==='turn/started').length,1);assert.ok(toolOutputs.length>=3);assert.ok(toolOutputs.every(output=>output.count===1&&output.hasValue));assert.equal(result.answer,'transport recovered');assert.equal(result.completed,true);}finally{server.stop(true);}
appIssues related to the Codex desktop appbugSomething isn't workingconnectivityIssues involving networking or endpoint connectivity problems (disconnections)
Activity
github-actions commentedon Aug 14, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
etcendureanalytics commentedon Aug 18, 2026
Follow-up with stronger evidence that this is transport/server-side, not the local network.
2026-08-18 (ChatGPT desktop 26.810.52044, same bundled codex-cli 0.148.0-alpha.9): 33 websocket idle-timeout stall/retry cycles logged in one day — worst so far. Example chain: turn
01a0162c-a4d2-71e2-80f1-dab3f385118chit retries 1→4 at 18:47:06, 18:52:11, 18:57:19, 19:02:28 UTC (one ~5-minute frozen stall per retry), preceded by turn01a015fa-40b7-7780-b354-99e3e29fcb1bretries at 18:31:44 / 18:36:51. Allstream disconnected before completion: idle timeout waiting for websocket.The key datapoint: an automated hourly line-quality test ran at 18:32 UTC — in the middle of that stall cluster — and measured 22 Mbps up / 360 Mbps down with zero errors and 0% idle packet loss to the ISP's first hop. The local link was verifiably healthy at the exact minutes the websocket streams were stalling. (This host previously had a genuinely lossy uplink; on 2026-08-18 it tested clean all day — 14/14 hourly runs passed — while Codex logged its worst stall count yet.)
This rules out the local-network explanation for these episodes and points at the websocket path (edge terminates at DFW per
cf-ray) or upstream sampling. The 300s detection time and 5-retries-before-HTTPS-fallback turn each server-side hiccup into 5–25 minutes of frozen UI.Re-requesting: ws keepalive/liveness (seconds, not 300s), transport opt-out, or first-timeout HTTPS fallback.
aygerix commentedon Aug 20, 2026
Related but not the same failure mode: #39771.
We hit the same
idle timeout waiting for websocket+ silentretrying sampling request (n/5)on Desktop26.814.41407/0.148.0-alpha.15/gpt-5.6-solhigh.A localhost reverse proxy injecting unknown-type text frames (
{"type":"codex.client.keepalive"}) every 45s stopped the idle timeout. Codex loggedunhandled responses event: "codex.client.keepalive"and the same in-flight request resumed with a real tool/patch after ~8.5 min of no model text.So at least some of these 300s stalls are false dead-streams (no Responses text during high-reasoning), not packet loss. Faster dead-stream detection would have aborted a live turn. Built-in
openaistill cannot setstream_idle_timeout_ms/supports_websockets, which matches this issue.KoljaB commentedon Aug 23, 2026
Additional sanitized prevalence data from Codex Desktop 26.818.41509 / bundled command runner 0.149.0-alpha.4.1:
A seven-day local host audit found 296 Responses WebSocket retry log entries across 175 tasks. I cannot determine billing impact from local logs and am not asserting that every retry was charged. The important operational result is that reconnect/fallback is common enough to amplify latency and agent recovery work.
This supports a session-level circuit breaker or supported transport selector: after a confirmed transport failure, switch once to HTTPS rather than repeating the same WebSocket path through the full retry budget.
johnparkerg commentedon Sep 8, 2026
For me it was my USB ethernet adapter. I worked fine for videocalling so I assumed all was well, but switching to another slower more reliable one proved successful.
trevoedwards commentedon Oct 31, 2026
I've also encountered the delayed HTTPS fallback described here while using native Codex app-server through T3 Code on both Linux and Windows. Reproduced the recovery sequence separately with Codex 0.166.0 against a local mock Responses API.
Captured production trigger differs from the original 300-second idle timeout, but confirms the five-retry fallback behavior:
websocket_connection_limit_reachedat the documented 60-minute connection lifetime.websocket closed by server before response.completed.Reconnecting... 2/5through5/5. About 60 seconds after the initial error, native Codex logsfalling back to HTTP.The generic early-close errors do not identify whether the service or an intermediary closed the connection. I am not attributing those errors to a specific network component or claiming to have reproduced the original issue's idle-timeout trigger.
For the isolated 0.166.0 reproduction:
stream_max_retries=5, Codex emits the repeated reconnect notifications, then falls back to HTTP/SSE and completes.stream_max_retries=1on the mock provider, Codex makes one fresh WebSocket retry, then falls back and completes. The tool result is preserved, and the tool executes only once in each run.The reproduction used temporary Codex state, a loopback-only mock service, and no real model inference. It changed provider configuration, not the native executable.
This supports a bounded, earlier HTTPS fallback for repeated WebSocket transport failures. The fallback gate in current
core/src/responses_retry.rs::handle_response_stream_errorstill waits for the configured stream retry budget to be exhausted. I have not applied a native runtime patch or changed production transport settings.InfectedG commentedon Nov 3, 2026
Update: the trigger on my side was my own network, not OpenAI. The way Codex handled it is still worth reporting.
Cause
The host's IPv6 default route had two next hops, the ISP router and a second router on the same LAN that dropped all IPv6 traffic. Linux picks a new path for a flow after packet loss, so a long-lived WebSocket to chatgpt.com could move to the dead router mid-stream and go silent with no RST. After I pinned the default route to the ISP router, Codex logged no
idle timeout waiting for websocketin the next 36 hours. There was oneConnection reset without closing handshake, and Codex recovered from it in 191 ms.What Codex did with a dead path
turn/steerreturned success at once, but the model only received the user's messages after recovery, 5 minutes later.A client ping with a pong deadline, as proposed in #42914, would have caught all of these within about 45 s. Showing the first retry and telling the client that a steer is still queued would also help.
Environment: codex-cli 0.166.0,
codex app-serverover stdio from T3 Code,gpt-6.1-solat high reasoning, Linux x86_64.AlexADittrich commentedon Nov 9, 2026
I’m experiencing the same recurring/intermittent Codex Desktop behavior:
Reconnecting …/5followed bystream disconnected before completion: idle timeout waiting for websocket.I submitted an in-app report using the
/feedbackcommand so OpenAI can correlate the client/server diagnostics with this issue.Feedback ID:
01a1c234-f836-7bc3-ab8c-b23eb9e6f1f0Platform: Windows / Codex Desktop.
aslambinradianto-dotcom commentedon Nov 18, 2026
I reproduced the delayed fallback on Codex CLI 0.169.1 through the Codex App Server on macOS arm64. OpenBot 0.72.0 still displayed its generic no-update warning after the first five-minute idle timeout. Codex logged retry 1/5. The first retry has no App Server notification in the release build. The cause of the production silence remains unknown.
The loopback test below forces a silent WebSocket immediately after a synthetic read-only tool call. It sets the fixture retry budget to two and uses a short idle timeout. Stock 0.169.1 sent three silent WebSocket sampling requests before switching transports. I ended the first HTTP stream before completion. The second HTTP request completed the original turn. The client executed the tool once. Each retry carried one copy of the original tool result. App Server reported the second WebSocket retry and the first HTTP retry.
The candidate keeps the current idle timeout. It changes the transport after the first WebSocket sampling request that Codex has already timed out, sends a retry notification, and keeps the HTTP retry budget and any Retry-After deadline. It targets the 0.169.1 source. Current main has an immediate-fallback policy for
WebsocketMessageTooLarge; an idle timeout remains on the generic stream retry path. The attached regression passes on stock inbaselinemode and fails inpatchedmode as expected. The Rust candidate still needs a release build and test run.Candidate patch for 0.169.1
Loopback App Server regression
Save as
reproduce-post-tool.mjs. Runbun reproduce-post-tool.mjs /path/to/stock/codex baselineorbun reproduce-post-tool.mjs /path/to/candidate/codex patched.