Repository navigation
Description
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:
- it does not read the Windows system proxy (WinINET /
ProxyEnable+ProxyServer), even though the HTTP client inside the app-server does; - it does not read
HTTP_PROXY/HTTPS_PROXY, even thoughcodex.exein the same process tree does (see the A/B test below); - 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
- Enable the Windows system proxy (pointing at a local HTTP proxy). Do not enable TUN.
- Use a network where
chatgpt.comis DNS-poisoned (or any network that requires a proxy). - Launch the ChatGPT desktop app, open Settings → Connections → Control this computer, enable "Allow connection".
- 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
- In parallel,
Get-NetTCPConnectionon the main process shows a direct connection to a public IP stuck inSynSent(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 withconnection 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)
- Honor
HTTP_PROXY/HTTPS_PROXY/ALL_PROXYfor WebSockets opened by the desktop app main process, consistent with the app-server. - At minimum honor the Windows system proxy (WinINET), so the very common "system proxy only" setup works.
- Provide a configurable endpoint override (e.g.
CODEX_CLOUD_BACKEND_URLor a settings entry) for self-hosted gateways / enterprise environments. - 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
docs: 回填上游 issue 链接 openai/codex#55557
github-actions commentedon Oct 20, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
336al commentedon Oct 20, 2026
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.compoisoned). 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:
open_timeout/ 1006Switching 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:
Transport start success→open_timeoutis 15.004 s, and it stays at 15.004 s across all 457 attempts recorded on 2026-10-20 (reconnect_failed478 times that day).codex doctoron the same machine reportsconnect timeout 15000 msfor its own WebSocket — the same constant, butdoctorreachesHTTP 101 Switching Protocols.3. Direct dial confirmed on the Electron main process:
4. Through the proxy the host is fast, not blocked. HTTP CONNECT → TLS →
Upgrade: websocket:codex-cloud-backend.chatgpt.comchatgpt.comws.chatgpt.comThe 403 carries
Server: cloudflareand aCF-RAYheader — bot filtering against an unauthenticated client, consistent with your finding that acodex-desktop/...User-Agent gets101on 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_openedrepeatedly;codex doctor101), while only the main-processdurablesocket fails. That matches your A/B matrix: the Rust app-server honoursHTTP_PROXY, the Nodewssocket does not.Original report with these details (now closed as a duplicate of this issue): #55584.
336al commentedon Oct 21, 2026
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.
Two things change at the same moment:
hostId=durablereachesnextState=connectedin ~2 s instead of dying at 15.0 s.codex-cloud-backend.chatgpt.comstarts 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.zhy8359-commits commentedon Nov 14, 2026
Additional read-only Windows reproduction, observed on 2026-11-14.
Environment:
OpenAI.Codexversion26.1111.2228.0; package status OK, executable signature verified as OpenAI.0.9.3+2026110401, embedded mihomo versionv1.19.33.Observed:
codex-cloud-backend.chatgpt.com, inSYN_SENT. This is endpoint-level evidence, not a packet-to-WebSocket-request correlation.hostKind=durable,transport=websocket,ECONNRESET; the connection remained unavailable to the native task tools.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:
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.
3230050028-prog commentedon Nov 15, 2026
Additional Windows reproduction with authenticated WebSocket control (2026-11-14–15, UTC+8)
Environment:
26.1111.21308OpenAI.Codex 26.1111.2228.0127.0.0.1:7897features.respect_system_proxy = true01a17ae8-37ab-7371-b033-a3e5103c961cThe desktop durable connection continues retrying with:
Independent verification through the same proxy found:
ws.chatgpt.com,chatgpt.com, andcodex-cloud-backend.chatgpt.com.wss://codex-cloud-backend.chatgpt.com/, using the existing account authentication, successfully reached theOpenstate.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.
3230050028-prog commentedon Nov 16, 2026
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:
26.1111.21308OpenAI.Codex 26.1111.2228.0127.0.0.1:789701a17ae8-37ab-7371-b033-a3e5103c961cA/B result:
WebSocket was closed before the connection was established.Meta Tunneladapter asUp. At 10:56:19 UTC+8, the desktop log changed toinitialized=true,next=connected,error=null, and the reconnect counter reset to zero.Meta Tunneladapter disappeared, the Windows system proxy remained127.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.
msbtx commentedon Nov 24, 2026
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, andNODE_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.