openai / openai/codex

Persistent websocket disconnect / reconnect loop (Broken pipe, os error 32) on macOS

Open
#44,099 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug connectivity
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of the Codex App are you using (From “About Codex” dialog)?

26.901.51231

What subscription do you have?

Pro

What platform is your computer?

Darwin 25.3.0 arm64 arm Apple M-series

What issue are you seeing?

Symptom

Mid-turn the stream dies and the client enters a reconnect loop: "Reconnecting... 1/5" through "5/5". Each retry stalls for minutes, so a request that should take 10 seconds takes 13+ minutes or never completes. Once the loop starts, the thread is effectively dead.

Errors seen

stream disconnected before completion: websocket closed by server before response.completed
stream disconnected before completion: failed to send websocket request: IO error: Broken pipe (os error 32)
Falling back from WebSockets to HTTPS transport

Noticeably worse on turns that read multiple images.

Environment

  • Bundled codex-cli 0.153.4
  • Model: gpt-6-astra, reasoning effort medium and high, service_tier default
  • Auth: ChatGPT subscription login (not API key)
  • Home network, no VPN, no proxy

What I already tried (no effect)

  • responses_websockets = false and responses_websockets_v2 = false in config.toml (these appear to be removed flags)
  • Custom model_provider with supports_websockets = false, plus stream_max_retries = 1
  • Disabling all 13 plugins (computer-use, chrome, browser, unified-computer-use, sites, visualize, documents, pdf, spreadsheets, presentations, template-creator, etc.)
  • Running the bundled Codex CLI in Terminal instead of the app — same failure
  • Machine restart, fresh sessions, different network (mobile hotspot), incognito

The web version of ChatGPT works reliably on the same account and same network.

Requests

  1. Websocket keepalive so a dead stream is detected in seconds instead of 300s.
  2. Fall back to HTTPS on the first idle timeout, not the fifth.
  3. A supported way to force HTTPS-only transport for ChatGPT-login users.
What steps can reproduce the bug?
  1. Open the Codex app on macOS, signed in with a ChatGPT subscription (Pro).
  2. Start a task in a project folder — reading and comparing several local images makes it fire much more often.
  3. Send a normal prompt and wait.
  4. Mid-turn the stream goes silent, then "Reconnecting... 1/5" appears and counts up to 5/5, each retry stalling for minutes.

Happens across fresh sessions, different models, and different times of day. Not tied to one thread.

What is the expected behavior?

The stream should stay alive until the turn completes. If the websocket does drop, the client should detect it within seconds and fall back to HTTPS immediately, rather than stalling ~5 minutes per retry across 5 retries before falling back.

Additional information

Other users report the same thing — see the r/codex thread "The 'Stream disconnected before completion' error seems to be happening more frequently than ever" and related issues in this repo (#38638, #28503, #19804, #19821).

One user reported the problem stopped for them after disabling most of their skills and plugins. I disabled all 13 of mine and it made no difference in my case.

Happy to provide session IDs or logs if that helps.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by reproducing the websocket disconnect and reconnect loop with the bundled codex-cli on macOS, then trace the reconnect and HTTPS fallback entry points using the reported errors. Done means a dead stream is detected promptly and the client falls back without the repeated multi-minute retry cycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust
Domain
cli, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.