Fixing Codex Remote Control: "Failed to update connection"
Table of Contents
Introduction
While debugging this with help from local Codex, I realised that the same remote Mac worked from ChatGPT mobile, and it also worked from another macOS user account on the same machine. That ruled out the remote Mac, the ChatGPT account, and the network. The broken state was local to my current macOS user account.
What did not fix it
I tried the obvious cleanup steps first (all were suggested by Codex):
Revoked remote access on both Macs
Added the devices again
Uninstalled Codex with AppCleaner
Uninstalled Codex with Homebrew
Reinstalled Codex
Deleted common Codex app support, cache, preference, and HTTP storage files
Cleared the
remote_control_enrollmentstable from~/.codex/state_5.sqliteDeleted OpenAI/Codex/ChatGPT entries from Keychain Access
None of those fixed it. After reinstalling, the old remote connection error state still came back.
The actual clue
The Codex logs showed the real error:
Remote-control client has been revokedThe failed request was:
POST https://chatgpt.com/backend-api/codex/remote/control/client/refresh/startThe important part was that Codex was still using an existing local remote-control client enrollment:
hasExistingEnrollment=true
localEnrollmentClientId=cli_REDACTEDThat meant Codex was not creating a fresh enrollment. It was reusing a revoked local client ID.
The file that actually mattered
The bad remote-control enrollment was stored in:
~/.codex/.codex-global-state.jsonand in its backup:
~/.codex/.codex-global-state.json.bakThe key that mattered was:
electron-remote-control-client-enrollmentsInside that JSON object, Codex had entries like this:
Codex Desktop
http://localhost:8000/api
https://chatgpt.com/backend-api
after-first-unlock-device-key-v1
user_REDACTEDThat entry contained the revoked clientId and its device key metadata.
The final fix that worked
Quit Codex completely.
I deleted these two files (mind you, this will revoke/reset many codex settings including all remote control connections):
~/.codex/.codex-global-state.json
~/.codex/.codex-global-state.json.bakAlternatively as suggested by Codex, you can open the above 2 files and remove the broken remote-control state from both files (but I resorted to deleting the files entirely, which worked for me. So if the following steps don't work for you, try deleting the files)):
The minimum key to remove was:
electron-remote-control-client-enrollmentsFor a cleaner reset, codex also recommended to remove these remote-control UI state keys:
selected-remote-host-id
remote-connection-auto-connect-by-host-id
added-remote-control-env-ids- Relaunch Codex.
- Pair the remote Mac again.
After that, Codex generated a fresh remote-control client enrollment and the connection worked.
Why reinstalling did not help
The important state was not inside the application bundle, normal app support folders, or the SQLite table I first suspected. It was in Codex's global user state file under ~/.codex/.
So uninstalling and reinstalling the app did not remove the revoked enrollment. Codex kept reading the same stale client ID from:
~/.codex/.codex-global-state.jsonThat is why a different macOS user account worked immediately: it had a different ~/.codex directory and did not inherit the revoked enrollment.
TLDR: Short version
If Codex remote control on macOS says "Failed to update connection", but the same remote machine works from ChatGPT mobile or another macOS user account, check (or delete or move the files to another temporary folder):
~/.codex/.codex-global-state.json
~/.codex/.codex-global-state.json.bakRemove:
electron-remote-control-client-enrollmentsThen restart Codex and reconnect the device.
That was the only fix that worked for me.
