Skip to content

WebSocket transport closes immediately with code 1008 (Policy) then falls back to HTTPS #13039

@kali113

Description

@kali113

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), kernel 6.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 = true
    • realtime_conversation = true
    • voice_transcription = true

Repro steps

  1. Enable websocket + realtime + voice feature flags.
  2. Run:
    codex exec -C /home/arch --skip-git-repo-check --json "Reply with exactly: WS_FINAL_CHECK"
  3. 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) and responses_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions