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
WebSocket upgrade succeeds then server closes with 1008 Policy (falls back to HTTPS) #13041
Codex websocket transport to wss://chatgpt.com/backend-api/codex/responses upgrades successfully and is then immediately closed by server policy (1008), leading to reconnect loop and fallback to HTTPS.
Environment
OS: Arch Linux (x86_64), kernel 6.18.9-arch1-2
Codex CLI: 0.106.0 (also reproduced on 0.107.0-alpha.5)
Node: v25.7.0
npm: 11.10.1
Auth: ChatGPT login mode
Features enabled:
responses_websockets_v2 = true
realtime_conversation = true
voice_transcription = true
Repro
codex exec -C /home/arch --skip-git-repo-check --json "Reply with exactly: WS_FINAL_CHECK"
Expected
Websocket transport should remain open and stream should proceed without fallback.
Actual
Reconnecting retries (2/5..5/5)
Fallback message:
Falling back from WebSockets to HTTPS transport. stream disconnected before completion...
Key sanitized evidence
INFO connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
INFO successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
DEBUG Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
... reconnect loop ...
Falling back from WebSockets to HTTPS transport ...
What was ruled out
Reproduces on stable + alpha codex CLI.
Reproduces on responses_websockets_v2 and legacy responses_websockets.
No HTTP_PROXY/HTTPS_PROXY env vars configured.
Attachments (sanitized)
Evidence is posted inline in issue comments (no local-file dependency).
Maintainer note: local paths like /tmp/... in the issue body are not externally accessible. Posting sanitized evidence inline below.
Sanitized websocket policy-close trace
2026-02-27T18:27:54.791212Z INFO codex_api::endpoint::responses_websocket: connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:55.174925Z INFO codex_api::endpoint::responses_websocket: successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:55.176795Z DEBUG tungstenite::protocol: Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
2026-02-27T18:27:55.182285Z INFO codex_api::endpoint::responses_websocket: connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:55.606312Z INFO codex_api::endpoint::responses_websocket: successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:55.611381Z DEBUG tungstenite::protocol: Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
2026-02-27T18:27:55.822204Z INFO codex_api::endpoint::responses_websocket: connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:56.332352Z INFO codex_api::endpoint::responses_websocket: successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:56.339828Z DEBUG tungstenite::protocol: Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
Reconnecting... 2/5 (stream disconnected before completion: websocket closed by server before response.completed)
2026-02-27T18:27:56.725861Z INFO codex_api::endpoint::responses_websocket: connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:57.021299Z INFO codex_api::endpoint::responses_websocket: successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:57.021518Z DEBUG tungstenite::protocol: Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
Reconnecting... 3/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)
2026-02-27T18:27:57.760883Z INFO codex_api::endpoint::responses_websocket: connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:58.126456Z INFO codex_api::endpoint::responses_websocket: successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:58.126738Z DEBUG tungstenite::protocol: Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
Reconnecting... 4/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)
2026-02-27T18:27:59.871851Z INFO codex_api::endpoint::responses_websocket: connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:28:00.243959Z INFO codex_api::endpoint::responses_websocket: successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:28:00.244204Z DEBUG tungstenite::protocol: Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
Reconnecting... 5/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)
2026-02-27T18:28:03.562616Z INFO codex_api::endpoint::responses_websocket: connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:28:03.930484Z INFO codex_api::endpoint::responses_websocket: successfully connected to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:28:03.930770Z DEBUG tungstenite::protocol: Received close frame: Some(CloseFrame { code: Policy, reason: Utf8Bytes(b"") })
{"type":"item.completed","item":{"id":"item_1","type":"error","message":"Falling back from WebSockets to HTTPS transport. stream disconnected before completion: failed to send websocket request: Connection closed normally"}}
Sanitized codex exec --json output
{"type":"thread.started","thread_id":"019ca058-ef8b-7a40-9cad-64885362c9f9"}
{"type":"item.completed","item":{"id":"item_0","type":"error","message":"Under-development features enabled: realtime_conversation, responses_websockets_v2, voice_transcription. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in /home/arch/.codex/config.toml."}}
{"type":"turn.started"}
{"type":"error","message":"Reconnecting... 2/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"error","message":"Reconnecting... 3/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"error","message":"Reconnecting... 4/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"error","message":"Reconnecting... 5/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"}
{"type":"item.completed","item":{"id":"item_1","type":"error","message":"Falling back from WebSockets to HTTPS transport. stream disconnected before completion: failed to send websocket request: Connection closed normally"}}
{"type":"item.completed","item":{"id":"item_2","type":"reasoning","text":"**Preparing final output**"}}
{"type":"item.completed","item":{"id":"item_3","type":"agent_message","text":"WS_FINAL_CHECK"}}
{"type":"turn.completed","usage":{"input_tokens":9350,"cached_input_tokens":8320,"output_tokens":49}}
Just to add to the report: I can confirm this is also happening on macOS Tahoe.
I’m using the ChatGPT login flow. However, when I switch to API key authentication, the problem does not happen.
Reacted by Tomáš Hübelbauer, 02loveslollipop and David Westman
@bruno-ortiz, if you're able to reliably repro the failure, can you use /feedback to upload your logs and a sample session, then post the thread ID here? Thanks!
same: Falling back from WebSockets to HTTPS transport. stream disconnected before completion: websocket closed by server before response.completed
Reacted by johnzan0743, Canberk Sinangil, Yi Xu, 32-3, Alex Micic, bkrescaperaseuse, Ashitaka, Aleksandr Murashkin, Philip Huang, Jean-Marie Porchet and 2 more
This issue is a regular for me, my codex is always the latest version - MacOS Tahoe 26.4
Falling back from WebSockets to HTTPS transport. stream disconnected before completion: websocket
closed by server before response.completed
Edit: With a bit of debugging - my likely cause is overloading the context with a single message - likely by sending images (likely when compaction was near)
Activity
github-actions commentedon Feb 27, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
kali113 commentedon Feb 27, 2026
Maintainer note: local paths like
/tmp/...in the issue body are not externally accessible. Posting sanitized evidence inline below.Sanitized websocket policy-close trace
Sanitized
codex exec --jsonoutput{"type":"thread.started","thread_id":"019ca058-ef8b-7a40-9cad-64885362c9f9"} {"type":"item.completed","item":{"id":"item_0","type":"error","message":"Under-development features enabled: realtime_conversation, responses_websockets_v2, voice_transcription. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in /home/arch/.codex/config.toml."}} {"type":"turn.started"} {"type":"error","message":"Reconnecting... 2/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"} {"type":"error","message":"Reconnecting... 3/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"} {"type":"error","message":"Reconnecting... 4/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"} {"type":"error","message":"Reconnecting... 5/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)"} {"type":"item.completed","item":{"id":"item_1","type":"error","message":"Falling back from WebSockets to HTTPS transport. stream disconnected before completion: failed to send websocket request: Connection closed normally"}} {"type":"item.completed","item":{"id":"item_2","type":"reasoning","text":"**Preparing final output**"}} {"type":"item.completed","item":{"id":"item_3","type":"agent_message","text":"WS_FINAL_CHECK"}} {"type":"turn.completed","usage":{"input_tokens":9350,"cached_input_tokens":8320,"output_tokens":49}}kali113 commentedon Feb 27, 2026
@pakrym-oai Follow-up with corrected formatting from my previous comment:
Repro is outside corporate environment (no corporate proxy/VPN), and proxy env vars are unset.
Observed behavior remains: websocket upgrade succeeds, then server immediately closes with
1008 Policy, and client falls back to HTTPS after retries.If useful, I can run any additional diagnostics you want on this machine/account.
bruno-ortiz commentedon Feb 27, 2026
Just to add to the report: I can confirm this is also happening on macOS Tahoe.
I’m using the ChatGPT login flow. However, when I switch to API key authentication, the problem does not happen.
etraut-openai commentedon Feb 27, 2026
@bruno-ortiz, if you're able to reliably repro the failure, can you use
/feedbackto upload your logs and a sample session, then post the thread ID here? Thanks!bruno-ortiz commentedon Feb 27, 2026
Hey @etraut-openai, here is the thread ID.
019ca10b-6a31-7bd0-9c2e-1a9d7f309f79. Let me know if I can help in any other way.etraut-openai commentedon Feb 27, 2026
Thanks, I see the failure in your logs. Are you using a VPN or corporate network proxy?
jordyvandomselaar commentedon Feb 28, 2026
Another thread ID: 019ca197-45c7-7700-a15c-ae5d694daefe
Not on a VPN or a proxy =)
VisionaryOS commentedon Feb 28, 2026
same: Falling back from WebSockets to HTTPS transport. stream disconnected before completion: websocket closed by server before response.completed
bruno-ortiz commentedon Feb 28, 2026
@etraut-openai no vpn or proxy.
killianMei commentedon Feb 28, 2026
same: codex app 26.227.1448 (747)
PerryFinn commentedon Feb 28, 2026
We encountered the same problem on Mac, but we used the company's VPN.
canberksinangil commentedon Feb 28, 2026
Same here, no VPN or Proxy @etraut-openai
I hope this helps > 019ca36e-6685-7791-a1d6-9b8cfe5e8a3f
kali113 commentedon Feb 28, 2026
@etraut-openai no vpn or proxy. the thread ID is 019ca37b-863f-72a3-958a-799e338cc67a
sPredictorX1708 commentedon Feb 28, 2026
+1 facing the same problem. How to solve it?
56 remaining items
artemgetmann commentedon May 27, 2026
still happening. for me also
aminekechaou commentedon May 27, 2026
the workaround mentioned here worked for me. It is however much slower than with websockets (and even when using fast mode)
fix!: write root-level model_provider override for GUI/raw codex paths
fix!: write-once config model — remove Backup/Restore round-trip
fix(responses): resolve bare ChatGPT model ids to codex on HTTP fallb…
ptanner2022 commentedon Jun 5, 2026
Having this issue on aws ec2 ubuntu
kaansoral commentedon Jun 14, 2026
This issue is a regular for me, my codex is always the latest version - MacOS Tahoe 26.4
Falling back from WebSockets to HTTPS transport. stream disconnected before completion: websocket
closed by server before response.completed
Edit: With a bit of debugging - my likely cause is overloading the context with a single message - likely by sending images (likely when compaction was near)
m1cham0v commentedon Jun 16, 2026
Ditto +1
OS:
Arch Linux (x86_64), kernel 7.0.11-arch1-1Codex CLI:
openai-codex 0.140.0-1Node:
v26.2.0npm:
11.17.0diegomrsantos commentedon Jul 2, 2026
I get this very often; it's incredibly frustrating.
fix(responses): resolve bare ChatGPT model ids to codex on HTTP fallb…
fix(responses): resolve bare ChatGPT model ids to codex on HTTP fallb…
Unknown47Dream commentedon Sep 14, 2026
this is still happening, how this is closed?
fix(responses): resolve bare ChatGPT model ids to codex on HTTP fallb…
fix(responses): resolve bare ChatGPT model ids to codex on HTTP fallb…