Skip to content

bug(windows-os): desktop app "Long-lived" host WebSocket ignores system proxy and HTTP_PROXY, hardcoded URL #55557

Open

Description

@Kirito14IT

Environment

Item Value
App ChatGPT desktop app (Windows, MSIX OpenAI.Codex_26.1013.4894.0_x64__2p2nqsd0c76g0)
Bundled app-server codex 0.163.0-alpha.10.2 (windows-x86_64)
OS Windows 11 10.0.26200 x64
Proxy Clash Verge Rev (mihomo core); Windows system proxy enabled (ProxyEnable=1, 127.0.0.1:7897); TUN not enabled
Network DNS poisoning present: chatgpt.com resolves to random forged IPs

Problem

After remoteControl/enable, the desktop app also opens a WebSocket to the hostId=durable ("Long-lived") host:

// app.asar — hardcoded, no config override
var uue = `wss://codex-cloud-backend.chatgpt.com/`;
function lb(e){ return { id: i.Ai, display_name: `Long-lived`, kind: `local`, websocket_url: uue } }

It is issued from the Electron main process using the Node ws package (not the Chromium network stack), and as a result:

  1. it does not read the Windows system proxy (WinINET / ProxyEnable + ProxyServer), even though the HTTP client inside the app-server does;
  2. it does not read HTTP_PROXY / HTTPS_PROXY, even though codex.exe in the same process tree does (see the A/B test below);
  3. the URL is hardcoded and there is no setting to override it.

On any network that requires a proxy — in particular "system proxy on, TUN off", which is the default setup for a very large number of users in mainland China — this connection fails deterministically.

Reproduction

  1. Enable the Windows system proxy (pointing at a local HTTP proxy). Do not enable TUN.
  2. Use a network where chatgpt.com is DNS-poisoned (or any network that requires a proxy).
  3. Launch the ChatGPT desktop app, open Settings → Connections → Control this computer, enable "Allow connection".
  4. Watch the desktop app log
    (%LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\Codex\Logs\):
[AppServerConnection] app_server_connection.websocket_error connectionId=58 errorCode=unknown
  hostKind=durable message="WebSocket was closed before the connection was established" transport=websocket
[AppServerConnection] app_server_connection.closed code=1006 connectionId=58 failureReason=open_timeout
[AppServerConnection] app_server_connection.reconnect_scheduled baseDelayMs=20000 reconnectAttempt=57
  1. In parallel, Get-NetTCPConnection on the main process shows a direct connection to a public IP stuck in SynSent (the DNS-poisoned address) instead of the local proxy:
RemoteAddress    RemotePort  State
127.0.0.1        7897        Established      <- Chromium traffic goes through the proxy
199.16.158.190   443         SynSent          <- long-lived WS connects directly, hits a forged IP

A/B test: the app-server does honor proxy env vars

Same machine, same subscription, one variable changed at a time, using codex remote-control --no-daemon and looking for connected to app-server remote control websocket in the log:

Group HTTP_PROXY/HTTPS_PROXY Extra flag Result
A set — ✅ connected to app-server remote control websocket
E set — ✅ reproduces A
B set -c features.respect_system_proxy=true ❌ Error: Remote control is enabled on <name> but the connection is errored.
C cleared — ❌ os error 10060 (WSAETIMEDOUT)
D cleared -c features.network_proxy=true -c network.proxy_url=... ❌ os error 10060

So the Rust app-server does honor HTTP_PROXY, while the main-process WebSocket does not — inconsistent proxy behavior inside the same app/process tree.

Two further observations:

  • features.respect_system_proxy=true (which reads the Windows system proxy from the registry) makes the app-server WS fail outright with connection is errored; the system-proxy path appears to be broken for the WS transport.
  • network.proxy_url / network.socks_url (features.network_proxy) only apply to network policy for sandboxed commands; they do not cover the app-server's own long-lived connections.

The endpoint itself works (so this is not a server-side problem)

WS upgrade handshake through the local proxy:

$ curl -x http://127.0.0.1:7897 \
    -H 'Connection: Upgrade' -H 'Upgrade: websocket' \
    -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: <random>' \
    -H 'Origin: https://chatgpt.com' \
    https://codex-cloud-backend.chatgpt.com/

User-Agent: (none)                         -> HTTP/1.1 403 Forbidden
User-Agent: node                           -> HTTP/1.1 403 Forbidden
User-Agent: codex-desktop/26.1013.4894.0   -> HTTP/1.1 101 Switching Protocols
User-Agent: ChatGPT/26.1013.4894.0         -> HTTP/1.1 101 Switching Protocols

As soon as the request goes through the proxy with an acceptable User-Agent, the handshake succeeds — the server and the network egress are fine.

Isolation: after fixing the proxy env vars, the toggle works but this channel still does not

This pins the problem precisely to the connection described here:

# after setting user-level HTTP_PROXY/HTTPS_PROXY and restarting the app
Settings -> Connections -> Control this computer -> "Allow connection"  =>  ON, pairing QR dialog shown  OK
desktop log                                                                   =>  os error 10060 gone,
                                                                                 "connected to rendezvous"  OK

# but the long-lived channel is still connecting directly
codex.exe (app-server) sockets     =>  127.0.0.1:7897  Established        OK
Electron main process "durable"    =>  199.16.158.190:443  SynSent        still direct

In other words: the toggle itself is backed by the app-server tunnel (now working), but the channel the cloud uses to call back into this machine — issued by the Electron main process — is never taken over by the proxy. "Allow connection" being on does not mean a remote session can actually be established.

Expected behavior (suggestions)

  1. Honor HTTP_PROXY / HTTPS_PROXY / ALL_PROXY for WebSockets opened by the desktop app main process, consistent with the app-server.
  2. At minimum honor the Windows system proxy (WinINET), so the very common "system proxy only" setup works.
  3. Provide a configurable endpoint override (e.g. CODEX_CLOUD_BACKEND_URL or a settings entry) for self-hosted gateways / enterprise environments.
  4. Fix features.respect_system_proxy, which currently breaks the app-server WS when enabled.

Impact

In mainland China and any other "proxy required, system proxy only, TUN off" environment, the desktop app's cloud long-lived connection is unavailable, so remote control sessions initiated from a phone may fail to establish even though the "Allow connection" toggle turns on and the device shows as online.

Paths for further investigation

Desktop app logs:
%LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\Codex\Logs\<YYYY>\<MM>\<DD>\codex-desktop-*.log

Codex CLI binary shipped with the desktop app (copied into the user profile):
%LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\codex.exe

A full local investigation with all raw log excerpts, socket dumps and the A/B test matrix is also available at
https://github.com/Kirito14IT/chatgpt-codex-windows-remote-control-proxy-fix (contains one-click diagnostic scripts).

Activity

  1. added
    bug
    app
    windows-os
    connectivity
    app-server
    on Oct 20, 2026
  2. github-actions commented on Oct 20, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. 336al commented on Oct 20, 2026

    @336al

    Additional data points from a second machine hitting the same failure (Codex desktop 26.1013.4894.0, bundled codex 0.163.0-alpha.10.2, Windows 11 10.0.26100, Windows system proxy on, TUN off, DNS for chatgpt.com poisoned). They corroborate this report and add two controls it does not have.

    1. It is not the egress exit. Two different proxy exits, app restarted before each phase, same nominal conditions:

    Phase Window (CST) Duration durable attempts open_timeout / 1006 Per minute
    A (exit 1) 21:06:34 – 21:20:51 14.3 min 27 25 1.75
    B (exit 2, app restarted 21:20:38) 21:20:51 – 21:35:26 14.6 min 26 27 1.85

    Switching exits changes nothing, which is exactly what "the socket never goes through the proxy" predicts.

    2. The 15 s is the client's own connect timeout. From the log:

    13:08:39.434Z info  [AppServerConnection] Starting app-server connection hostId=durable
    13:08:39.445Z info  [AppServerConnection] Transport start success connectionId=2
    13:08:54.449Z error [AppServerConnection] websocket_error  message="WebSocket was closed before the connection was established"
    13:08:54.449Z info  [AppServerConnection] closed  code=1006  failureReason=open_timeout
    

    Transport start success → open_timeout is 15.004 s, and it stays at 15.004 s across all 457 attempts recorded on 2026-10-20 (reconnect_failed 478 times that day). codex doctor on the same machine reports connect timeout 15000 ms for its own WebSocket — the same constant, but doctor reaches HTTP 101 Switching Protocols.

    3. Direct dial confirmed on the Electron main process:

    local DNS   codex-cloud-backend.chatgpt.com -> <address not belonging to Cloudflare/OpenAI>
    process     ChatGPT.exe (main)             -> <that address>:443   state = SynSent, repeating
    

    4. Through the proxy the host is fast, not blocked. HTTP CONNECT → TLS → Upgrade: websocket:

    Target CONNECT TLS Certificate Upgrade response
    codex-cloud-backend.chatgpt.com 200 / 23 ms TLS 1.3 / 327 ms CN=chatgpt.com, GTS WE1 403 in 106 ms
    chatgpt.com 200 / 1 ms TLS 1.3 / 264 ms CN=chatgpt.com, GTS WE1 403 in 100 ms
    ws.chatgpt.com 200 / 0 ms TLS 1.3 / 347 ms CN=ws.chatgpt.com, GTS WE1 404 in 577 ms

    The 403 carries Server: cloudflare and a CF-RAY header — bot filtering against an unauthenticated client, consistent with your finding that a codex-desktop/... User-Agent gets 101 on the same URL.

    5. Same inconsistency inside one process tree: the pubsub transport and the app-server reach the network fine on this machine (pubsub transport_opened repeatedly; codex doctor 101), while only the main-process durable socket fails. That matches your A/B matrix: the Rust app-server honours HTTP_PROXY, the Node ws socket does not.

    Original report with these details (now closed as a duplicate of this issue): #55584.

  4. 336al commented on Oct 21, 2026

    @336al

    Confirmed from a second machine, and it also yields a workaround for anyone on a "system proxy only" setup.

    Switching the client from system-proxy mode to TUN (transparent capture) fixes it completely. The exit egress did not change; the only variable was how traffic is captured.

    2026-10-21 12:26:40 +08  open_timeout          <- 15 s failure loop, one attempt per ~20 s
    2026-10-21 12:27:00 +08  attempt -> open_timeout
    2026-10-21 12:27:35 +08  attempt -> open_timeout
    2026-10-21 12:28:10 +08  attempt -> open_timeout
    2026-10-21 12:28:45 +08  attempt -> open_timeout
    ------------------------ TUN enabled ------------------------
    2026-10-21 12:29:20 +08  attempt
    2026-10-21 12:29:22 +08  nextState=connected     <- 2 s
                             (re-checked 90 s later: still connected, zero further open_timeout)
    

    Two things change at the same moment:

    1. hostId=durable reaches nextState=connected in ~2 s instead of dying at 15.0 s.
    2. Local DNS for codex-cloud-backend.chatgpt.com starts returning real Cloudflare addresses (172.64.155.209, 104.18.32.47) instead of forged ones (103.252.115.221, 2001::67f0:b475).

    That combination isolates the cause to the capture method: with TUN the main-process socket is intercepted at the network layer, so its direct dial can no longer reach a poisoned address.

    Workaround for other users: enable TUN / transparent capture in your proxy client. Note two side effects — TUN usually disables the system proxy (ProxyEnable=0) and routes traffic for the whole machine, so split-tunnel rules matter if you rely on LAN or local services.

    Not affected by this: server_overloaded ("Selected model is at capacity") is a separate, service-side issue and is unchanged by the network setup; it is tracked in #55260.

  5. zhy8359-commits commented on Nov 14, 2026

    @zhy8359-commits

    Additional read-only Windows reproduction, observed on 2026-11-14.

    Environment:

    • Official Store package OpenAI.Codex version 26.1111.2228.0; package status OK, executable signature verified as OpenAI.
    • FlClash 0.9.3+2026110401, embedded mihomo version v1.19.33.
    • Windows system proxy enabled, existing loopback HTTP CONNECT proxy; Rule mode, TUN disabled. The official application and network configuration were left unchanged.

    Observed:

    1. A 24-second, owner-PID TCP-table observation found the Electron main process attempting direct TCP/443 connections to the IPv4 addresses returned for codex-cloud-backend.chatgpt.com, in SYN_SENT. This is endpoint-level evidence, not a packet-to-WebSocket-request correlation.
    2. Desktop logs repeatedly reported hostKind=durable, transport=websocket, ECONNRESET; the connection remained unavailable to the native task tools.
    3. Through the existing local proxy, an unauthenticated control completed HTTP CONNECT (200), TLS 1.3 with certificate verification enabled, and a WebSocket Upgrade request received HTTP 401. No credentials, cookies, or authentication subprotocol were supplied. This establishes proxy-path reachability only: it is neither authenticated WSS success nor evidence that the exit node is faulty.
    4. Read-only inspection of the installed Desktop routing branch still found the public durable hostname receiving no explicit proxy agent, with a SOCKS proxy selected only for the internal-hostname branch. This supports a transport-policy mismatch; it does not establish every cause of every task-tool failure.

    Separately, native local maintenance-thread read/send/reply/readback succeeded, while the cloud/Dot path remained unverified. A fallback returned conversation_inaccessible; we are treating that as an independent access/routing problem, not assuming that a network change would remove it.

    We have stopped local package-patching and system-wide interception workarounds. A hosts-based relay was reviewed offline but not enabled; its interaction with the proxy's system-hosts resolution and abnormal-exit cleanup did not meet our deployment requirements. No hosts change, TUN activation, node switch, certificate override, or application restart was performed.

    Could maintainers identify:

    • A supported proxy configuration that specifically covers the Desktop main-process durable WebSocket, rather than only the native Codex runtime or sandboxed commands?
    • If this has been fixed, the exact Desktop release/build and supported setup/verification steps?

    We will verify any supported fix against the existing tasks: Dot reads the intended task, sends one harmless uniquely marked message, the target replies, and Dot reads back that same reply. A connected socket or local-only ACK will not be counted as end-to-end success.

    Privacy: this supplement intentionally excludes raw logs, account identifiers, conversation/task IDs, machine/user names, local paths, public IP addresses, request IDs, and credentials. No duplicate issue is being opened.

  6. 3230050028-prog commented on Nov 15, 2026

    @3230050028-prog

    Additional Windows reproduction with authenticated WebSocket control (2026-11-14–15, UTC+8)

    Environment:

    • Codex Desktop: 26.1111.21308
    • Installed MSIX package: OpenAI.Codex 26.1111.2228.0
    • Windows system proxy: local HTTP CONNECT proxy at 127.0.0.1:7897
    • features.respect_system_proxy = true
    • Feedback session ID: 01a17ae8-37ab-7371-b033-a3e5103c961c

    The desktop durable connection continues retrying with:

    WebSocket was closed before the connection was established
    

    Independent verification through the same proxy found:

    1. TCP 443 and TLS succeed for ws.chatgpt.com, chatgpt.com, and codex-cloud-backend.chatgpt.com.
    2. Certificates are issued by Google Trust Services (WE1); no TLS interception or certificate replacement was observed.
    3. An authenticated standalone WebSocket connection to wss://codex-cloud-backend.chatgpt.com/, using the existing account authentication, successfully reached the Open state.
    4. The Codex desktop durable client alone still fails before initialization.

    This authenticated control shows that the account, proxy route, TLS, and endpoint are functional. The remaining failure appears specific to the desktop durable WebSocket transport or its proxy handling.

  7. 3230050028-prog commented on Nov 16, 2026

    @3230050028-prog

    Confirmed A/B: TUN immediately restores durable WebSocket; disabling it reproduces the failure

    Additional controlled test on Windows on 2026-11-16 (UTC+8), using the same account, proxy node, and Codex Desktop session.

    Environment:

    • Codex Desktop: 26.1111.21308
    • Installed MSIX: OpenAI.Codex 26.1111.2228.0
    • Clash Verge: system HTTP proxy at 127.0.0.1:7897
    • Feedback session ID: 01a17ae8-37ab-7371-b033-a3e5103c961c

    A/B result:

    1. System proxy only, TUN disabled: the durable host repeatedly failed before initialization with WebSocket was closed before the connection was established.
    2. TUN enabled: Windows reported the Meta Tunnel adapter as Up. At 10:56:19 UTC+8, the desktop log changed to initialized=true, next=connected, error=null, and the reconnect counter reset to zero.
    3. TUN disabled again and Clash Verge returned to ordinary user mode: the Meta Tunnel adapter disappeared, the Windows system proxy remained 127.0.0.1:7897, and the same durable failure reproduced at 10:57:47 and 10:58:15 UTC+8.

    No Codex configuration, account, proxy node, or endpoint changed during the comparison. The only test variable was whether traffic was captured by TUN.

    This A/B result strongly indicates that the Electron main-process durable WebSocket does not use the Windows system proxy path, while transparent TUN capture makes the same connection succeed. The machine has been restored to its original system-proxy-only state after the test. No raw logs, credentials, or session files are attached.

  8. msbtx commented on Nov 24, 2026

    @msbtx

    I'm experiencing the same issue. It affects the desktop app in both roles: as a remote-controlled host and as a controller connecting to a remote Codex CLI instance.

    In my case, the WebSocket handshake consistently times out despite configuring the system proxy, --proxy-server, HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and NODE_USE_ENV_PROXY=1. I've also verified that the NodeService process inherits these environment variables correctly.

    Remote Control works immediately when TUN mode is enabled. The iOS app can also connect to the same remote Codex CLI instance without any issues.

    This suggests that the desktop app's controller-side WebSocket transport may not respect the configured proxy settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appapp-serverbugconnectivityremotewindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions