Codex mobile Remote Control stale host cannot be removed and QR pairing fails
| iPhone: searching | iPhone: empty state |
|---|---|
| <img src="https://github.com/user-attachments/assets/05bfe11a-6808-4434-9369-247a66979bad" width="320"> | <img src="https://github.com/user-attachments/assets/faf011e0-b515-443a-a2a7-3714c897aacd" width="320"> |
<img width="1478" height="763" alt="Image" src="https://github.com/user-attachments/assets/7ed678c8-0503-407c-978f-cb7085ab84a5" />
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.513.20950 (2816)
What subscription do you have?
plus
What platform is your computer?
macOS: 26.4.1, build 25E253
What issue are you seeing?
Subject: Codex mobile Remote Control stale host cannot be removed and QR pairing fails
Hi OpenAI Support,
I’m reporting a Codex mobile / Codex macOS Remote Control bug.
Issue:
The ChatGPT iOS app still shows a stale Codex Desktop connection named Host-003.lan in Codex > Connections. It is red/offline and cannot be removed. QR pairing from Codex macOS does not complete: scanning the QR code opens ChatGPT/Codex on iOS and returns to Connections, but the iPhone never appears under “Devices that can control this Mac” on the Mac.
This stale host persists even after:
- Using “Disconnect All” on iOS
- Deleting the ChatGPT iOS app
- Powering off/restarting the iPhone
- Reinstalling ChatGPT from the App Store
- Signing back into the same account/workspace
Mac/local checks already performed:
- macOS: 26.4.1, build 25E253
- Codex macOS app: 26.513.20950, build 2816
- Codex CLI: 0.130.0
remote_controlis enabled: true- Local Codex remote control enrollment DB was reset
- Current local enrollment count is 0 in
~/.codex/state_5.sqlite - Codex macOS is running, but iOS still shows stale
Host-003.lan
Expected behavior:
After Disconnect All / reinstall / local reset, the old host should disappear from iOS, or QR pairing should create a fresh working device connection.
Actual behavior:
The old host remains visible on iOS and pairing does not complete.
Request:
Please purge/reset the stale Codex Remote Control host/device association for my account/workspace, or escalate this as a backend/mobile state bug. This appears to be persisted server-side, not in local macOS state or iOS app cache.
I can provide screenshots showing Host-003.lan offline/red on iOS and an empty “Devices that can control this Mac” list on Codex macOS.
What steps can reproduce the bug?
Feedback ID: 019e2869-3923-7b23-b152-cfffe054a8c4
What is the expected behavior?
well... Remote connection maybe?
Additional information
_No response_
25 Comments
Yeah same here, it's kind of annoying as it did load the chat titles but never made it into a thread. Then trying to re-auth has me also stuck with the machine I cant delete from the iOS app. There is no exposed way to delete a connection on the app.
@ardjo-s I have a workaround that calls the server side endpoint to list / delete these connections: https://gist.github.com/sirmalloc/fefef0b65729d9644794a3c67d1a28b9
me too
Update after testing the workaround from @sirmalloc.
First, thank you @sirmalloc for putting that Gist together and trying to help. I tested it against my account. It did help clean up stale server-side environments: the backend endpoint now returns
backend_count=0.Unfortunately, the original issue still reproduces after that cleanup.
Current state:
codex-cli 0.130.026.513.20950build2816/codex/remote/control/environments?limit=100:backend_count=0remote_control_enrollments:0The suspicious part is that after deleting the backend environments and clearing local enrollment rows, the desktop app still rewrites stale local remote-control keys into
~/.codex/.codex-global-state.json:So the workaround seems to solve only the server-side stale environment list. The remaining bug looks like the desktop/iOS pairing flow can stay stuck with stale client-side state even when the backend environment list is empty.
A product-side “forget/reset remote control host” path, or a stronger cleanup of the desktop/iOS pairing state, may be needed.
Additional update after testing the QR flow again, following the documented path:
Observed behavior:
Approve on your device.Add connection; no desktop host is found.Host-003.lanentry no longer appears, so the backend cleanup did remove the stale host entry. The remaining failure is that a fresh desktop pairing/discovery never completes.Current diagnostics from the Mac after reproducing this:
codex-cli 0.130.0remote_controlfeature flag istrueGET /backend-api/codex/remote/control/environments?limit=100: HTTP200, count0remote_control_enrollments:0~/.codex/.codex-global-state.jsonstill contains/recreates the local remote-control state keys (electron-local-remote-control-installation-id,electron-local-remote-control-environment-id,codex-mobile-has-connected-device) after relaunching the appThis looks like two separate things now:
I avoided posting the raw QR-code screenshot directly because it contains a pairing code, but the visible macOS state is the modal stuck at
Approve on your device, while iOS stays in the search/no-host-found loop described above.| iPhone: searching | iPhone: empty state |
|---|---|
| <img src="https://github.com/user-attachments/assets/a2ba235c-27e2-473c-89a2-03a4ab14a31c" width="320"> | <img src="https://github.com/user-attachments/assets/1a6be308-9089-4f88-a032-a1400408280c" width="320"> |
I'm having this issue too, has anyone found a workaround that gets things working again?
EDIT: Ok it turns out if you remove the app and it's data from your iPhone, then reinstall, then log out and log in again it all works.
I've had success after logging out of the iPhone app and logging back in. It starts the pairing flow over again after revoking the device via the codex desktop app.
Additional update after the clean-reset attempt and retesting the QR pairing flow.
First, thanks @sirmalloc for the logout/login suggestion and earlier workaround. I tried the iPhone-side reset path as well: removed/reinstalled the ChatGPT iOS app, logged back in, and started the pairing flow again from
Add connection. Unfortunately the QR pairing still hangs.Current observed behavior remains:
| Desktop | iPhone |
|---|---|
| Codex macOS shows the QR modal and stays on
Approve on your device. | iPhone stays onWaiting for desktop/ searching after scanning the QR. |Local state after running a clean reset while Codex was closed:
Current verification output after reopening Codex:
Backend environments also appear empty from the authenticated backend API check:
One suspicious detail: after restoring
remote_control = truein~/.codex/config.tomlwhile Codex is closed, the CLI can reportremote_controlas true. After launching the macOS GUI again, the app appears to rewrite~/.codex/config.toml:remote_control = truedisappears, whileremote_connections = trueremains. At the same time,electron-local-remote-control-installation-idreappears in global state even though local enrollments and backend environments are both empty.So this now looks less like an iOS-only cache issue and more like a desktop state reconciliation/config rewrite issue after the sequence:
remote_controlfeature flag from config.I have not deleted
~/.codex/auth.json, changed macOS Sharing/Remote Login, or changed the hostname. The symptom is unchanged after the clean reset.@ardjo-s Dont just login after reinstall, it still fails that way. You have to log out while logged in. Any other way keeps something in the keychain around that breaks the flow, even after deleting and reinstalling and logging in on a fresh install.
Arf tried everything - this release was not for me. I'll try next Thursday!
@codex-maintainers @codex Still no official fix for this bug?
New update from today's retest.
The failure mode changed again. iOS now gets past the initial mobile setup screen far enough to show the auth page (
Authorize Codex on this device), but the setup still fails with:After that, the iOS Connections screen shows a stale desktop entry:
Local state on the Mac at the same time:
The backend remote-control environment list explained the stale iOS UI. Before cleanup it contained one stale environment:
I deleted that environment with the backend DELETE endpoint. The first delete returned HTTP 204 but the same stale host reappeared once with a new environment id. A second bounded delete pass removed it, and a follow-up check after a short wait now shows:
So the new state is:
Host-003.lan/0.128.0card came from the server-side environments endpoint, not from the current installed Codex.app on disk.0.131.0-alpha.9embedded app-server/CLI).remote_control = true; I re-enabled it locally and verified the effective flag is now true.I did not fully quit/relaunch Codex.app from inside this active Codex Desktop session, because that would risk killing the running report session. The next useful verification is a full Codex.app relaunch and a fresh mobile pairing attempt after the backend list is empty and
remote_controlis enabled.Follow-up from the same retest: deleting the stale backend environment was not sufficient.
After the stale
Host-003.lan/0.128.0environment was removed, a fresh mobile setup attempt still fails on iOS with the generic:I then found a more precise desktop-side failure in the local app-server logs. The desktop app-server attempts to create a new remote control enrollment, but the enrollment endpoint rejects it:
This repeats after the app-server's auth recovery attempts (
reloadandrefresh_token). The UI-facing status event remains:Current local/backend state after the retry:
I also tried the embedded daemon tooling as a workaround:
That starts a managed app-server with
--enable remote_control, but enrollment still fails with the sameHTTP 403 Forbidden/Multi-factor authentication required, so no fresh environment is advertised and the backend list remains empty.One extra note: while trying to restart only the background app-server, the Codex Desktop UI showed a crash page with
(code=null, signal=SIGTERM). That was caused by terminating the child app-server process during the workaround attempt, not by the original iOS pairing action. The relevant pairing failure is the enrollment 403 above.So the current blocker no longer appears to be only the stale server-side environment. The current fresh-enrollment path is failing because the desktop app-server receives an MFA-required response from
/backend-api/wham/remote/control/server/enroll, while the mobile UI only surfaces a generic secure-setup failure.Follow-up after checking the current local state and the official Codex remote connection docs.
Current state on 2026-05-20 18:38 CEST:
cliVersion=0.131.0-alpha.9,appServerVersion=0.131.0-alpha.9.remote_control_enrollmentscount is still0.https://chatgpt.com/backend-api/wham/remote/control/server/enrolland gets:HTTP 403 Forbidden{"detail":"Multi-factor authentication required"}0e571e18-5bbc-42e6-9cb8-33fe9df7515dThis now matches the official Codex remote connection docs, which say mobile setup must finish any required multi-factor authentication, SSO, or passkey steps before retrying, and that setup still failing after that can require confirming workspace Remote Control access is enabled: https://developers.openai.com/codex/remote-connections#authentication-blocks-setup
So the stale
0.128.0environment is gone and the local daemon is current/running, but fresh enrollment is blocked by an account/workspace MFA requirement that the desktop daemon's auth recovery does not satisfy automatically.Additional state after the user confirmed their MFA provider behavior:
https://chatgpt.com/backend-api/wham/remote/control/server/enrollHTTP 403 Forbidden{"detail":"Multi-factor authentication required"}41bd7a57-2e8a-41f2-956a-2fdef7a462150.131.0-alpha.9.remote_control_enrollmentsremains0.count=0.This suggests the visible Dashlane/MFA confirmation is not being reflected in the auth state used by the desktop app-server daemon enrollment request, or the enrollment path is checking a different account/workspace auth requirement than the one satisfied in the mobile/browser flow.
Final local re-auth attempt before full reinstall/reset:
codex login --device-auth.401 token_invalidatedand reported the refresh token was revoked.codex logout, thencodex login --device-authagain.HTTP 403 Forbiddenand body{"detail":"Multi-factor authentication required"}.dc7e859f-d6a0-469d-8f76-cf86fbe3a847at 2026-05-20 19:09 CEST.remote_control_enrollmentsremains0.count=0.At this point the user is moving to a full Codex/CodexBar uninstall/reset to remove local app state before reinstalling.
The later repros here suggest two different stale-state problems may be getting mixed:
remote_control_enrollmentsrow is created.Those need different fixes. Deleting the old backend environment can address the first without proving the second enrollment path is healthy.
For the fresh setup failure, the most useful discriminator may be the first durable state transition that does not happen:
token_invalidated/401;If local enrollment count remains
0after a fresh authenticated attempt, this looks upstream of normal mobile connection state; if a row is created and then mobile still shows stale hosts, it is more likely a backend/mobile host-list reconciliation issue.Do you still see
remote_control_enrollments = 0after the clean re-auth, or does a new row appear and then fail later?Closing this from my side after a full reset/retest, but I want to leave the most complete state I have because the fix path is still a bit ambiguous.
cc @codex-maintainers @codex for awareness.
What changed
After the previous failing state, I did a very broad local reset/reinstall of Codex/CodexBar and then completed the ChatGPT account security/MFA flow again.
The two things that changed were:
I am not 100% sure which of those actually unblocked the root cause, or whether both were required. My current guess is that both mattered: the local reset removed stale desktop identity/state, while the ChatGPT security flow made the backend accept the fresh remote-control enrollment.
Local reset performed
From shell history, the reset targeted at least:
Previous failing state
Before the reset/MFA retest, the issue had evolved into two separate failure modes:
So deleting the stale backend environment fixed the stale host row, but did not by itself make fresh pairing work. The fresh enrollment path was still blocked before any local enrollment row was created.
Current working-ish state after reset + MFA/security flow
Current machine/app state:
The newly recreated local Codex state shows:
The enrollment row now exists:
And
~/.codex/.codex-global-state.jsonnow contains fresh local remote-control state:One odd detail:
codex features listcurrently still reports:but the local enrollment row exists now, which is the important difference from the previous failing state.
My read
There seem to be two distinct bugs or at least two distinct recovery requirements here:
Host-003.lan/0.128.0environment that is not the currently installed desktop app.remote_control_enrollmentsrow if the backend returnsMulti-factor authentication required. In my case, the visible mobile/browser auth flow did not seem to satisfy the auth state used by the desktop daemon until I went through the ChatGPT security/MFA flow with SMS + Dashlane.The main product issue, in my opinion, is that the user-facing mobile setup only showed a generic secure setup failure, while the useful desktop-side error was the backend
403 Multi-factor authentication required. Also, a full~/.codexreset probably should not be necessary to recover from this kind of state.I am no longer blocked after the full reset + MFA/security retest, so closing from the reporter side. I am leaving the details here in case this helps distinguish stale environment cleanup from the separate fresh-enrollment/MFA failure path.
Thanks for leaving the final state here. This is useful because it keeps the failure split into two gates instead of collapsing everything into "mobile pairing is broken".
My read of your final result is:
For maintainers, the product fix probably should not require users to do a full app/cache/keychain-style reset. A safer flow would be an explicit "forget this desktop / regenerate host identity" action plus a setup error that distinguishes stale host identity from MFA/security enrollment rejection.
That would turn this from a destructive reset workaround into a diagnosable recovery path.
If you knew how many tokens I used before having to nuke Codex on my Mac…
@tibo-openai, thank you. The final reset was clearly what was needed to close this issue.
Yes, that cost is exactly why the recovery path needs to become a first-class product flow instead of tribal cleanup knowledge.
A full local nuke works as proof that stale desktop identity/state was part of the failure, but it is too destructive to be the expected fix. The actionable version would be something like:
Leaving this closed makes sense if your setup is unblocked, but the diagnostic trail here is still useful for turning the reset workaround into a supported recovery flow.
@Snailflyer, please stop posting AI-generated replies to our issue tracker. You're generating a lot of noise for maintainers.
Understood. Sorry for the noise. I will stop posting these replies in this issue tracker.
I am hitting what appears to be the same stale-host recovery problem, with Windows Desktop + ChatGPT iOS.
The important difference in my case is that the host had paired successfully before. The broken state started after the phone/device entry was accidentally deleted from the Codex Desktop side. After that:
Setup failed / Couldn't finish secure setup. Try again(Chinese UI:设置失败 / 无法完成安全设置。请重试。).This looks like a state mismatch between desktop-side paired-device deletion and mobile/account-side host retention. A user-visible "Forget/remove this computer" action on iOS, plus a fresh QR path that can replace stale enrollment state, would likely fix this recovery case.
I opened a focused Windows + iOS variant of this stale-host issue here: #26535
It reproduces after deleting the paired phone from the desktop-side Connections UI: desktop has no controlling devices, but iOS keeps the old offline host and fresh QR setup fails with
Setup failed / Couldn't finish secure setup.