codex icon indicating copy to clipboard operation
codex copied to clipboard

[Windows][Remote Control] WebSocket TLS fails with UNABLE_TO_VERIFY_LEAF_SIGNATURE after successful enrollment

Open naochan-0114 opened this issue 2 months ago • 11 comments

What version of the Codex App are you using (From “About Codex” dialog)?

ChatGPT/Codex Desktop: 26.903.8094.0 Bundled Codex CLI: 0.153.4

What subscription do you have?

ChatGPT Pro

What platform is your computer?

Windows 11 Professional x64 OS version: 10.0.26200 System language: ja-JP

What issue are you seeing?

Remote Control fails when attempting to connect from the Windows desktop app to an already enrolled remote Windows device.

Device enrollment and authentication succeed, and the remote device is discovered and displayed in the desktop app.

However, when the app attempts to open the Remote Control WebSocket transport, the connection fails before the WebSocket is opened with:

UNABLE_TO_VERIFY_LEAF_SIGNATURE

"unable to verify the first certificate; if the root CA is installed locally, try running Node.js with --use-system-ca"

The application then repeatedly retries and fails with the same TLS certificate verification error.

Relevant sanitized log sequence:

remote_control_client_refresh_finish_response ... scopes=["remote_control_controller_websocket"]

remote_control_websocket.connect_failed_before_open ... errorCode=UNABLE_TO_VERIFY_LEAF_SIGNATURE errorMessage="unable to verify the first certificate; if the root CA is installed locally, try running Node.js with --use-system-ca"

app_server_connection.transport_connect_failed ... transport=websocket

Screenshot of the error: Image

What steps can reproduce the bug?

  1. Enable Remote Control on a Windows machine that will be controlled remotely.

  2. On another Windows 11 machine, open the ChatGPT/Codex desktop app.

  3. Go to Settings > Connections > Control other devices.

  4. Pair/enroll the remote machine using the normal device approval/PIN flow.

  5. The remote Windows device appears successfully in the device list.

  6. Attempt to connect to / enable the enrolled remote device.

  7. The connection fails with:

    unable to verify the first certificate; if the root CA is installed locally, try running Node.js with --use-system-ca

  8. The desktop app automatically retries and repeatedly fails with UNABLE_TO_VERIFY_LEAF_SIGNATURE.

What is the expected behavior?

After successful enrollment and authentication, the Remote Control WebSocket should establish normally and the enrolled Windows device should become available for remote control.

Additional information

I performed additional diagnostics to isolate the problem.

Codex Doctor v0.153.4:

  • 22 ok
  • 1 idle
  • 1 note
  • 1 warning
  • 0 failures

Connectivity diagnostics:

  • Codex Doctor WebSocket test succeeds: HTTP 101 Switching Protocols
  • ChatGPT provider endpoints are reachable.
  • No proxy environment variables are configured.
  • WinHTTP reports direct access / no proxy.
  • Browser access to https://chatgpt.com uses a normal Let's Encrypt certificate.

Bundled Node runtime test:

Default Node HTTPS request: https://chatgpt.com -> HTTP 403

Same request with: node --use-system-ca

Result: https://chatgpt.com -> HTTP 403

Therefore TLS certificate verification succeeds in both the bundled Node runtime's default mode and with --use-system-ca.

The Remote Control transport inside the desktop application is the only tested path that produces UNABLE_TO_VERIFY_LEAF_SIGNATURE.

The same remote Windows target can also be controlled normally from the ChatGPT mobile app, so the target machine and Remote Control enrollment itself appear to be working.

Third-party antivirus:

  • Norton Antivirus is active.
  • No corresponding blocked connection was found in Norton's intrusion-prevention connection history or security history.
  • Interestingly, Codex Doctor reports: "no supported endpoint protection detected"

Possibly related but distinct issue: openai/codex#41121

That issue reports HTTP 403 after successful Remote Control enrollment. In this case, authentication/enrollment succeeds, but the subsequent desktop WebSocket transport fails locally during TLS certificate verification before the WebSocket opens.

I can provide a sanitized desktop log if needed.

naochan-0114 avatar Sep 09 '26 07:09 naochan-0114

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

  • #43489

Powered by Codex Action

github-actions[bot] avatar Sep 09 '26 07:09 github-actions[bot]

I can reproduce a closely related failure on Windows behind Zscaler TLS inspection.

  • Codex Desktop: 26.901.6511.0
  • Enrollment and HTTPS refresh succeed.
  • The Remote Control WebSocket fails before opening with UNABLE_TO_GET_ISSUER_CERT_LOCALLY.
  • The Zscaler root CA is trusted by Windows; curl and the bundled Node runtime with --use-system-ca succeed.
  • CODEX_CA_CERTIFICATE and SSL_CERT_FILE point to a valid PEM bundle and are present in the ChatGPT.exe environment.
  • NODE_EXTRA_CA_CERTS is present in Explorer's environment but absent from ChatGPT.exe.
  • The packaged Electron fuse wire has EnableNodeOptionsEnvironmentVariable disabled, so Electron removes/ignores NODE_EXTRA_CA_CERTS.

This suggests the Remote Control Node.js WebSocket path does not use CODEX_CA_CERTIFICATE or the Windows system CA, while the packaged Electron configuration prevents the NODE_EXTRA_CA_CERTS workaround. Please make this WebSocket path explicitly load CODEX_CA_CERTIFICATE or the system CA store.

nuitsjp avatar Sep 11 '26 10:09 nuitsjp

Update (2026-09-16 JST): Remote Control briefly started working again on the same Windows PC without any intentional local certificate, proxy, antivirus, or TLS changes.

The previously enrolled remote device became visible again, and I was able to send a command. The remote side appeared to receive/start processing the command, so the connection was functional at least briefly.

However, after a short time the Windows Codex app returned to the same Remote Control connection failure state. This means the issue is not actually resolved; the recovery was transient/intermittent.

I cannot yet tell whether the failure happened before or after the remote command completed, but the command content/progress was visible before the connection dropped.

This intermittent behavior may help narrow the issue: the same environment can sometimes establish Remote Control successfully without any local configuration change, then fail again shortly afterward.

I am leaving the issue open.

naochan-0114 avatar Sep 16 '26 00:09 naochan-0114

I can reproduce the Remote Control WebSocket TLS failure reported here with a Windows ARM64 controller and a macOS remote host.

Environment

  • Controller: Windows 11 Home 25H2, OS build 26200.9457, ARM64; Codex App 26.924.22138
  • Remote host: macOS 26.6.2 (25G83), arm64; Codex App 26.924.22138

Reproduction and result

The Mac appears under Settings > Connections > Control other devices. Selecting it fails with “unable to verify the first certificate.” The Windows Codex App log records UNABLE_TO_VERIFY_LEAF_SIGNATURE while opening the Remote Control WebSocket, before the WebSocket connection is established. The expected result is an open remote session.

The log does not identify the failed WebSocket URL or the certificate issuer, so I cannot attribute the failure to a particular endpoint or certificate.

Additional observations

  • The same Mac can be controlled from an iPhone and an iPad.
  • Windows has no connected VPN; its manual proxy and setup-script settings are off. WinHTTP reports direct access.
  • Edge shows a certificate issued by Google Trust Services (WE1) for https://chatgpt.com. This browser observation does not identify the certificate presented to the failing WebSocket.
  • I have not changed any security or certificate settings.

This adds a Windows-to-macOS reproduction on app version 26.924.22138. I can provide a sanitized excerpt of the Windows App log if useful.

mtk177a avatar Sep 28 '26 20:09 mtk177a

Additional update (2026-09-29 JST):

The temporary Remote Control success I reported on Sep 16 appears to have been a one-time event.

Since that brief successful connection, I have not been able to establish Remote Control successfully again even once. The same TLS/certificate connection failure continues to occur.

However, the session that became visible during that one successful connection is still permanently shown in the Codex app UI, even though Remote Control itself has not successfully reconnected since then.

So in my environment, the behavior is currently:

  • One brief successful Remote Control connection on Sep 16
  • No successful Remote Control connections since then
  • The session created/visible during that successful connection remains listed in the UI
  • Live Remote Control connection continues to fail

I have not intentionally changed any certificate, proxy, antivirus, or TLS settings during this period.

naochan-0114 avatar Sep 29 '26 00:09 naochan-0114

Additional Windows/Kaspersky case for this issue: the desktop Remote Control transport fails with SELF_SIGNED_CERT_IN_CHAIN.

Environment

  • Windows controller: x64, Windows 11 25H2, build 26200.9457.
  • Installed Windows app package: OpenAI.Codex 26.928.3736.0.
  • Internal bundled app package.json.version: 26.928.31416 (reported separately because this differs from the MSIX package version).
  • Bundled Codex CLI: 0.159.2.
  • Kaspersky is running; the installed service/application directory identifies the 21.26 branch. Its full product patch version was not collected.

Observed failure and sanitized evidence

Opening a remote host connection in the Windows desktop app fails during TLS, before the Remote Control WebSocket opens. The desktop log recorded this sequence on 2026-10-01:

2026-10-01T14:02:10.839Z warning [remote-control-transport]
remote_control_websocket.connect_failed_before_open
errorCode=SELF_SIGNED_CERT_IN_CHAIN
errorMessage="self signed certificate in certificate chain"
errorStack="Error: self signed certificate in certificate chain
    at TLSSocket.onConnectSecure (node:internal/tls/wrap:1768:34)
    at TLSSocket.emit (node:events:509:28)
    at TLSSocket._finishInit (node:internal/tls/wrap:1203:8)
    at ssl.onhandshakedone (node:internal/tls/wrap:984:12)"

2026-10-01T14:02:10.840Z warning [AppServerConnection]
app_server_connection.transport_connect_failed
errorCode=SELF_SIGNED_CERT_IN_CHAIN
transport=websocket

The public certificate CN=Kaspersky Anti-Virus Personal Root Certificate, O=AO Kaspersky Lab is present in BOTH Windows CurrentUser\\Root and LocalMachine\\Root stores.

Separate, unauthenticated TLS-handshake-only probes demonstrated that Kaspersky interception is still active for some connections. These probes did NOT measure the certificate presented to the actual failing desktop WebSocket:

Hostname Bundled standalone Node probe PowerShell/.NET probe
chatgpt.com Google Trust Services WE1 Kaspersky root
ab.chatgpt.com Google Trust Services WE1 Kaspersky root
api.openai.com Kaspersky root; SELF_SIGNED_CERT_IN_CHAIN Google Trust Services WE1

The probes were separate connections at different times. The differences could reflect application-specific inspection, inspection behavior, or changes during diagnosis; they must not be interpreted as proof that the desktop transport is healthy or as an identification of its actual certificate issuer.

Read-code observation and candidate explanation

Read-only inspection of the installed app bundle found different explicit CA handling:

  • The desktop Remote Control client is constructed in the Electron main process (ChatGPT.exe), using Node ws. Its WebSocket construction passes headers, handshake timeout, and compression options, without an explicit CA list at that call site.
  • A separate cloud WebSocket path explicitly combines tls.getCACertificates("default") and tls.getCACertificates("system") and passes them as ca.
  • The Remote Control default route is wss://chatgpt.com/backend-api/codex/remote/control/client; workspace routing can replace the origin. The actual failing hostname and certificate chain were not identified by the available error log.

This inconsistent explicit CA handling is a candidate explanation for failures under HTTPS inspection, not a confirmed root cause. Effective trust still depends on the bundled runtime and its configuration. No claim is made that Electron ignores NODE_EXTRA_CA_CERTS; that behavior was not tested in this installation.

The user reports that adding an application-level encrypted-traffic exclusion did not resolve the problem. The actual effective Kaspersky exclusions were not inspected. Also, Kaspersky documents that some protection components can continue scanning encrypted connections even for websites in encrypted-scan exclusions: https://support.kaspersky.com/kaspersky-for-windows/21.26/85549

Requested fix / diagnostics

Please make the desktop Remote Control client's CA behavior consistent with the documented/custom-CA and system-trust behavior, or document a supported way to configure its CA trust. Retain TLS verification.

A sanitized diagnostic reporting the failed hostname and certificate issuer/chain (without tokens or remote-device identifiers) would also help distinguish HTTPS inspection from other certificate-chain failures.

No antivirus settings, certificate stores, or environment variables were changed during this diagnostic collection. No raw logs, credentials, session transcripts, local usernames, or remote-device IDs are attached.

zerobrokenmk2 avatar Oct 01 '26 14:10 zerobrokenmk2

I can reproduce this issue consistently on Windows Codex Desktop.

Error: "unable to verify the first certificate; if the root CA is installed locally, try running Node.js with --use-system-ca"

Environment / observations:

  • Windows Codex Desktop Remote Control is enabled on the host PC.
  • Remote Control from my phone to the same Windows host works normally.
  • Remote Control from my Windows laptop to the host consistently fails with the certificate error above.
  • The problem occurs even when both Windows PCs are on the same home network.
  • Both PCs have been updated to the same Codex Desktop version when tested.
  • The issue has persisted across multiple Codex & OWL releases:
    • 26.924.22138 (released 2026-09-26)
    • 26.924.51851 (released 2026-09-28)
    • 26.928.21956 (released 2026-09-29)
    • 26.930.21537 (released 2026-10-01)

I previously worked around the same error by setting:

NODE_OPTIONS=--use-system-ca

This workaround allowed Windows-to-Windows Remote Control to work before, but it no longer resolves the issue with the recent Codex Desktop releases.

Troubleshooting performed:

  1. Confirmed NODE_OPTIONS at the user level: NODE_OPTIONS=--use-system-ca

  2. Confirmed the following user-level environment variables are NOT set: SSL_CERT_FILE CODEX_CA_CERTIFICATE HTTP_PROXY HTTPS_PROXY

  3. Confirmed the corresponding machine-level environment variables are also NOT set.

  4. Confirmed WinHTTP has no proxy configured: Direct access (no proxy server).

  5. Tested from the same home network, with the same certificate error.

  6. Found that Windows Time on the host was initially not synchronized. I restarted W32Time and successfully synchronized it with time.windows.com: Leap Indicator: 0 (no warning) Source: time.windows.com Last Successful Sync Time: 2026-10-02 08:39:59

    The Codex Remote Control certificate error persisted after successful time synchronization.

  7. The Windows Store package version observed on an earlier affected build was: OpenAI.Codex 26.924.2738.0 ARM64

The most important observation is that the same host remains reachable through Remote Control from my phone, while Windows Codex Desktop -> Windows Codex Desktop fails during certificate verification.

This suggests that the host itself and Remote Control session are functional, and that the failure may be specific to certificate validation in the Windows Codex Desktop Remote Control/WebSocket path.

Please let me know if logs or additional diagnostics from the affected Windows laptop would be useful.

bun2315 avatar Oct 02 '26 12:10 bun2315

Additional Windows reproduction on a newer build, with a few diagnostics that may help narrow the Windows-specific behavior.

Environment

  • Windows x64 controller
  • Codex Desktop MSIX: 26.930.7945.0
  • Standalone Node used for probes: v24.19.0
  • No WinHTTP proxy; no HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NODE_EXTRA_CA_CERTS, SSL_CERT_FILE, or NODE_OPTIONS present in the Codex process environment

Observed failure The desktop log consistently records:

[remote-control-transport] remote_control_websocket.connect_failed_before_open
errorCode=UNABLE_TO_VERIFY_LEAF_SIGNATURE
errorMessage="unable to verify the first certificate; if the root CA is installed locally, try running Node.js with --use-system-ca"

[AppServerConnection] app_server_connection.transport_connect_failed
transport=websocket

Across the logs inspected on the affected controller I found 276 connect_failed_before_open occurrences and no successful Remote Control WebSocket handshake.

Direct TLS checks On the same machine, standalone Node successfully validates chatgpt.com:443 both normally and with --use-system-ca:

default Node TLS: authorized=true
Node --use-system-ca: authorized=true
subject: CN=chatgpt.com
issuer: Google Trust Services / WE1

A request to:

https://chatgpt.com/backend-api/codex/remote/control/client/refresh/start

returns HTTP 405 in both modes, which is sufficient here to show that TLS verification succeeds and the endpoint is reachable. Enrollment/refresh requests also succeed; the failure starts only when the Remote Control WebSocket is opened.

Windows MSIX / NODE_OPTIONS check I also tested the error message's suggested --use-system-ca workaround. On this packaged Windows build, NODE_OPTIONS does not reach the main ChatGPT.exe process.

I verified the target process environment directly after:

  1. setting NODE_OPTIONS=--use-system-ca in the launching PowerShell process;
  2. restarting Explorer under that environment and activating the MSIX app;
  3. temporarily setting the user-level NODE_OPTIONS before app activation.

In each case the launched ChatGPT.exe environment contained:

NODE_OPTIONS=<absent>

The temporary user-level variable was removed immediately afterward.

Bundle inspection Read-only inspection of this installed build reproduces the CA-handling difference already reported above in this issue:

  • Remote Control creates the Node ws client with headers, handshake timeout and perMessageDeflate: false, but no explicit ca option at that call site.
  • A separate cloud WebSocket path explicitly combines tls.getCACertificates("default") and tls.getCACertificates("system") and passes that as ca.
  • The default Remote Control URL is derived from /codex/remote/control/client and converted from HTTPS to WSS, i.e. the normal route resolves to wss://chatgpt.com/backend-api/codex/remote/control/client.

This does not prove the missing explicit ca is the root cause, but it does confirm the same code-path difference on 26.930.7945.0 and shows that the workaround suggested by the runtime error is not actually injectable through the packaged Windows app in this environment.

No certificate stores, antivirus settings, or persistent network configuration were modified during these tests.

Tungsteno74 avatar Oct 06 '26 19:10 Tungsteno74

Hi maintainers — a brief follow-up on this Windows Codex Desktop Remote Control TLS issue.

The reports above now include independent reproductions across Windows x64/ARM64 controllers, Windows/macOS remote hosts, and several newer Codex Desktop builds. Enrollment/refresh and standalone TLS checks can succeed while the Remote Control WebSocket fails before opening with certificate-chain errors.

Could you confirm whether this issue is being tracked, and whether there is a supported fix/workaround or any specific sanitized diagnostics that would help investigate it? In particular, guidance that retains TLS verification would be appreciated.

For my own environment, the last confirmed result was still the certificate failure after the single brief successful connection on Sep 16; I have not yet retested the latest app build.

Thanks for taking a look.

naochan-0114 avatar Oct 20 '26 01:10 naochan-0114

I can reproduce this on ChatGPT Desktop for Windows with the OpenAI.Codex package version 26.1111.2228.0 (x64). The controlling PC is running Windows build 10.0.26300.9974, and the remote host is a Windows VM.

In Settings → Connections, I add the VM under Devices you can control from this PC and enter the pairing PIN. The VM appears in the device list, but opening the connection fails with:

Connection failed · unable to verify the first certificate; if the root CA is installed locally, try running Node.js with --use-system-ca

  • Remote Control from the ChatGPT mobile app works with the same VM.
  • The Windows desktop app still fails after restarting it, uninstalling and reinstalling it, and connecting the controlling PC through a mobile hotspot.
  • From the same PC on the hotspot, curl.exe 8.22.0 with Schannel completes TLS verification and receives HTTP 405 Method Not Allowed with Allow: POST for a GET to https://chatgpt.com/backend-api/codex/remote/control/client/refresh/start. This confirms that HTTPS works for that endpoint.

Is there a supported workaround for this Windows build that keeps certificate verification enabled? I can provide sanitized desktop app logs if you can point me to the relevant log location.

eisenluk avatar Nov 15 '26 19:11 eisenluk

Additional Windows case and outcome (Microsoft Store package 26.1120.6357.0):

  • Device enrollment/authentication completed, but the enrolled device remained offline and Remote Control could not open its WebSocket. The desktop log included SELF_SIGNED_CERT_IN_CHAIN.
  • During the OAuth localhost callback investigation, IPv6 loopback was also failing: ping -6 ::1 returned “General failure”, and a .NET TCP probe to ::1 failed with “access to the socket was forbidden”. A Windows Filtering Platform capture identified a third-party VPN filter blocking IPv6 loopback. This was a separate observed localhost problem; I cannot confirm it caused the WebSocket certificate error.
  • The VPN remained enabled. The IPv4-mapped IPv6 prefix precedence was restored to its original value (35).
  • After a full Windows reboot, the Remote Control WebSocket reached connected, and the remote device's chats appeared on the second PC. Restarting Codex alone had not resolved it.
  • TLS verification was never disabled. The reboot is the confirmed recovery step in this case, but the exact cause is still unconfirmed.

Sharing this as an additional Windows data point; it does not establish that the VPN filter caused the TLS failure.

averkinin-crypto avatar Nov 27 '26 05:11 averkinin-crypto