Codex Desktop macOS: opening any session causes auth token loss and returns to Sign In after configuring Remote Connection

Open 💬 6 comments Opened Aug 20, 2026 by rui-pcsilva
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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

Version 26.818.21641

What subscription do you have?

Plus

What platform is your computer?

macOS 26.6.1
Apple Silicon
64-bit

What issue are you seeing?

Since Aug 19, 2026, opening a Codex session causes Codex Desktop to immediately return to the ChatGPT Sign In screen.

Authentication initially succeeds and the session itself appears to load successfully. Logs show:

thread/read → errorCode=null
thread/resume → errorCode=null
maybe_resume_success

Immediately afterward, Desktop authentication fails:

desktop_fetch_auth_401 hadToken=true

authMethod=chatgpt
hasToken=false
nullReason=auth_token_missing
refreshToken=true
tokenExpiryState=missing

authenticatedAccountPresent=false
failureType=account_info_token_unavailable

Subsequent requests then show:

desktop_fetch_auth_401
hadToken=false
skipRetryReason=no_token_attached

HTTP 401 Unauthorized

One request explicitly reports:

Unauthorized - Access token is missing

Signing in again succeeds, but opening a session immediately reproduces the same loop.

This appears to match the authentication regression reported in #39162, with closely related symptoms in #39581 and #39491.

What steps can reproduce the bug?

Launch Codex Desktop on macOS.
Sign into ChatGPT successfully.
Open an existing Codex session.
The thread begins loading/resuming successfully.
Desktop receives an authenticated 401 (hadToken=true).
Auth state changes to auth_token_missing / hasToken=false.
Subsequent requests are made with hadToken=false and return 401.
Desktop redirects to the ChatGPT Sign In screen.
Sign in again and open a session.
The same failure repeats.

I have reproduced this across multiple sessions.

What is the expected behavior?

Opening or resuming a Codex session should preserve the authenticated ChatGPT account state and load the session normally.

A failed authenticated request/token refresh should not cause Desktop to discard the available authentication state and subsequently issue requests without an access token.

Additional information

The issue first appeared immediately after I configured a Remote Connection on Aug 19.

I initially suspected Remote Control, but the problem persists after revoking all connections and disabling Remote Control entirely. I therefore cannot establish that Remote Connection caused the issue; it may only have coincided with or exposed the underlying authentication regression.

Troubleshooting completed:

Reinstalled Codex/ChatGPT Desktop — no change.
Signed out and performed fresh authentication — no change.
Tested multiple existing sessions — same behavior.
Revoked all Remote Connections — no change.
Disabled Remote Control entirely — no change.
Removed ~/.codex/auth.json and reauthenticated — no change.
Moved the entire ~/.codex directory aside and allowed Codex to generate completely fresh state — no change.
Removed the macOS Keychain Codex Safe Storage entry and performed fresh authentication — no change.
Fully restarted the application/processes — no change.
codex doctor reports databases healthy, config loaded, auth configured, WebSocket connected, and provider endpoints reachable.

The issue therefore reproduces with fresh Codex state and freshly initialized secure storage.

There is also a stale local workspace reference that generates an unrelated ENOENT/fs/readFile warning. However, thread/read, thread/resume, and maybe_resume_success complete before authentication collapses, so this does not appear to cause the Sign In loop.

The auth sequence appears particularly close to #39162:

authenticated
→ thread resume succeeds
→ hadToken=true
→ HTTP 401
→ auth_token_missing
→ hasToken=false
→ subsequent hadToken=false requests
→ Sign In

Related reports:

#39162 — macOS, near-identical auth sequence
#39581 — similar token/auth-state collapse
#39491 — similar behavior on Windows

Sanitized Desktop log containing the complete reproduction: codex-desktop-2026-08-20.log

View original on GitHub ↗

6 Comments

github-actions[bot] contributor · 8 days ago

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

  • #39162
  • #39581
  • #39491

Powered by Codex Action

ClawYin0306 · 5 days ago

Independent reproduction on macOS with Codex Desktop 26.818.41705 (build 6971).

The app remains stable while idle. Opening any existing conversation is sufficient to trigger the failure; no message needs to be sent. The session initially resumes, then the Desktop logs show this sequence:

desktop_fetch_auth_401 hadToken=true
refresh_token_invalidated / auth_token_missing
authenticatedAccountPresent=false
→ Desktop UI returns to Sign In

The main Desktop process remains alive, and Remote continues to work, so this is an interaction-triggered Desktop authentication loss rather than a full application crash.

Additional controls:

  • Reproduces across different conversations.
  • Reproduces after Desktop cache reset.
  • Reproduces while Chrome automation/native-host consumers are fully isolated.
  • Browser/remote paths remain usable.

Has anyone found a working temporary mitigation or a fixed/test Desktop build? Reinstall, repeated sign-in, cache reset, and Chrome isolation have not resolved it.

jtxiii · 3 days ago

I can consistently reproduce this on macOS.

A few additional observations that may help narrow the root cause:

  • I have Advanced Account Security enabled.
  • I also have Remote Connection / Control enabled on this Mac.
  • Those settings may be relevant triggers, but they should not cause the desktop application to repeatedly lose its authentication state. The desktop client should handle these account features transparently.

In my case the behaviour is:

  • Sign-in succeeds.
  • The app works briefly.
  • Opening an existing conversation, starting a new one, or enabling a remote connection eventually causes the desktop client to invalidate its own session and return to the login screen.
  • Web ChatGPT continues to work normally.

From the logs I consistently see the authentication transition beginning with entries such as:

desktop_fetch_auth_401

followed by

auth_token_missing

and then repeated HTTP 401 responses before the UI logs me out.

This feels less like an account configuration issue and more like a regression in the desktop authentication lifecycle. Advanced Account Security and Remote Connection should be fully supported features, not combinations that leave the client in an unrecoverable authentication loop.

If there are additional diagnostic flags or log categories that would help, I'm happy to provide sanitized logs.

ClawYin0306 · 2 days ago

Thanks — this is really helpful. Your Advanced Account Security + Remote Connection data point lines up closely with what I saw.

In my case, Remote kept working while the Desktop UI lost authentication, and the same logout still reproduced after Chrome/native-host consumers were fully isolated. That makes me think Remote may expose the broken path, but is probably not the root cause by itself.

I’ve rolled back to an older signed build and it is stable for now. I’m going to avoid more destructive resets and wait for either a confirmed fixed build or a reproducible account/workspace sign-in workaround. If you happen to test explicit Personal workspace selection or a different sign-in route, I’d be interested to hear whether it changes the behavior.

etsabary · 1 day ago

Independent reproduction here on macOS, with the same pattern described in this issue.

Environment

  • MacBook Air M2, 16 GB
  • macOS Tahoe 26.5.2
  • ChatGPT/Codex Desktop 26.820.60940
  • Also reproduced on the previous build 26.818.61809
  • Codex CLI 0.149.1

What happened

The problem began while I was setting up Remote access from my iPhone, around the same time I was required to change my ChatGPT password because the previous password had been reported as leaked. I completed normal MFA authentication. I was offered Advanced Account Security but did not enable it.

Desktop behavior is now consistently:

  1. Sign in to ChatGPT successfully.
  2. Codex opens normally.
  3. Open an existing Codex conversation.
  4. The app immediately loses authentication and returns to “Sign in to ChatGPT.”
  5. Sign in again successfully.
  6. Open a conversation → immediately returned to Sign In again.

This loops indefinitely.

I have revoked Remote access from both the iPhone and desktop sides, fully quit/restarted the app, signed out/in again, and updated from 26.818.61809 to 26.820.60940. The problem persists.

Important control: the standalone Codex CLI on the same Mac and same ChatGPT account works normally.

codex login status returns:

Logged in using ChatGPT

and this succeeds:

codex exec --ephemeral --skip-git-repo-check "Reply with exactly OK"

using gpt-5.6-sol, returning OK.

So the account, ChatGPT authentication, Codex entitlement, and model access are all working; the failure appears specific to the Desktop app session.

I also inspected cookie names only, not values, in:

~/Library/Application Support/Codex/Default/Cookies

After successful desktop authentication I see the normal Cloudflare/device cookies for chatgpt.com, but no __Secure-next-auth.session-token. This seems consistent with the desktop session/cookie failure being investigated in #40029.

OpenAI Support has also now escalated my report to a support specialist.

The issue is currently 100% reproducible on 26.820.60940. Happy to provide any additional desktop logs or diagnostics that would help isolate it.

etsabary · 1 day ago

Update: login loop resolved for me so far
I was previously able to complete sign-in successfully, but opening a Codex thread would immediately return the desktop app to the sign-in state. Updating the app and repeatedly signing in did not resolve the problem.
I then tried the following sequence:

  1. Fully quit the ChatGPT desktop app.
  2. Signed out of ChatGPT in my web browser.
  3. Moved the local Codex authentication file aside rather than deleting it:

mv ~/.codex/auth.json ~/.codex/auth.json.before-desktop-reset

  1. Relaunched the desktop app.
  2. Signed in to ChatGPT again through the desktop OAuth flow.
  3. After confirming that Codex Desktop was working, signed back into ChatGPT in the browser.

Environment:

  • macOS 26.5.2, Apple Silicon
  • ChatGPT Desktop 26.820.60940

So far, the result has remained stable through:

  • Running a real Codex task for several minutes
  • Opening existing threads
  • Creating and opening a new thread
  • Quitting and relaunching the desktop app

I cannot determine which step was decisive, so I would not characterize this as a confirmed root-cause fix. The potentially meaningful difference from my previous attempts was signing out of the browser session before moving aside the local Codex authentication file and completing a fresh desktop login.
I retained the old file as auth.json.before-desktop-reset and have not restored it.
I will update the issue if the login loop returns.