Expand description
WebSocket passthrough for ChatGPT’s /backend-api rail (#597).
When the Codex ChatGPT subscription opt-in is enabled, Codex’s
chatgpt_base_url points at the proxy, so every ChatGPT backend call —
including Codex Desktop’s remote-control pairing, which opens a
WebSocket to chatgpt.com — flows through the proxy. The HTTP/SSE
super::chatgpt::backend_api_handler cannot carry that: it strips the
Upgrade/Connection headers and never speaks the WS protocol, so pairing
never completed and remote control stayed broken.
This module makes the proxy a transparent WebSocket tunnel for those calls:
it accepts the client upgrade, opens an upstream wss://chatgpt.com socket
(replaying the client’s auth + the shared Cloudflare clearance), and relays
every frame verbatim in both directions. The model-turn rail
(/backend-api/codex/responses) keeps its own dedicated handlers and is
never reached here.