WebSocket transport closes immediately with code 1008 (Policy) then falls back to HTTPS
Summary
Codex WebSocket transport to wss://chatgpt.com/backend-api/codex/responses consistently fails in my environment.
The websocket handshake succeeds (101 Upgrade), then the server immediately sends a close frame with code 1008 (Policy) and empty reason. Codex retries 5 times and falls back to HTTPS.
This blocks websocket transport usage for realtime/voice related features.
Environment
- OS: Arch Linux (
x86_64), kernel6.18.9-arch1-2 - Codex CLI:
0.106.0 - Also tested:
0.107.0-alpha.5(same result) - Node:
v25.7.0 - npm:
11.10.1 - Auth mode: ChatGPT login (
codex login status=> Logged in using ChatGPT) - Feature flags:
responses_websockets_v2 = truerealtime_conversation = truevoice_transcription = true
Repro steps
- Enable websocket + realtime + voice feature flags.
- Run:
``bash``
codex exec -C /home/arch --skip-git-repo-check --json "Reply with exactly: WS_FINAL_CHECK"
- Observe reconnect loop and fallback.
Expected
WebSocket connection remains open and request/stream proceeds over websocket transport.
Actual
- Repeated:
Reconnecting... 2/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)- through
5/5 - Then:
Falling back from WebSockets to HTTPS transport. stream disconnected before completion: failed to send websocket request: Connection closed normally
Trace evidence
Sanitized trace (auth redacted) shows successful websocket upgrade followed by immediate policy close:
2026-02-27T18:27:54.791212Z INFO ... connecting to websocket: wss://chatgpt.com/backend-api/codex/responses
2026-02-27T18:27:55.174925Z INFO ... 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"") })
...
Reconnecting... 5/5 (stream disconnected before completion: failed to send websocket request: Connection closed normally)
... Falling back from WebSockets to HTTPS transport ...
Additional notes
- Reproduces across many attempts/sessions.
- Same behavior with
responses_websockets(legacy) andresponses_websockets_v2. - No local proxy env vars configured.
- This looks like server-side policy rejection after successful upgrade.
Request
Please help identify why this account/session is policy-closed (1008) for Codex responses websocket, and whether there are account entitlements/conditions required for websocket transport.
8 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Follow-up triage details to help de-duplicate correctly:
wss://chatgpt.com/backend-api/codex/responsesCloseFrame { code: Policy (1008), reason: "" }responses_websockets_v2 = trueresponses_websockets = true(legacy)codex-cli 0.106.0(stable)codex-cli 0.107.0-alpha.5Sanitized evidence excerpt:
Given the immediate
1008post-upgrade behavior, this looks like a server policy/entitlement gate on websocket transport rather than local connectivity.Any chance you are in a corporate environment, possibly behind a proxy?
Closing per reporter preference; will recreate later with a sanitized report package and fresh repro. (For context: this was reproduced outside corporate proxy/VPN conditions.)
I know this issue is closed but just wanted to point out that this is happening to me too (Ubuntu 24, not in a corporate env/proxy).
@yoloyash, we're tracking this in #13041. We're investigating the problem.
Falling back from WebSockets to HTTPS transport 这个问题如何解决呢
Still happening btw