openai / openai/codex

Codex Desktop repeatedly signs out on macOS while CLI and web remain authenticated

Open
#40,815 8 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app auth bug
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

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

ChatGPT Desktop bundled Codex: codex-cli 0.149.0-alpha.4.3 I also tested standalone Codex CLI versions: 0.149.1 — works normally 0.148.0 — works normally

What subscription do you have?

ChatGPT Prolite

What platform is your computer?

Darwin 25.5.0 arm64 arm

What issue are you seeing?

What issue are you seeing?

ChatGPT/Codex Desktop on macOS repeatedly signs me out during normal use.

This issue appears to be specific to the Desktop app. ChatGPT web stays signed in and works normally, and standalone Codex CLI also remains authenticated and works normally with the same account.

Sometimes after the Desktop app signs me out, quitting and reopening the app restores the session automatically. However, the sign-out issue keeps recurring.

Relevant Desktop logs show:

Unauthorized - Access token is missing

desktop_fetch_auth_401

hadToken=false

skipRetryReason=no_token_attached

Example log entries:

status=401

errorMessage="Unauthorized - Access token is missing"

tokenSource=cached

willRetry=false

I have already tested the following:

  1. Reinstalled and updated ChatGPT Desktop.
  2. Confirmed ChatGPT web remains signed in.
  3. Confirmed Advanced Account Security is not enabled.
  4. Checked macOS Keychain; no relevant Codex credential issue was found.
  5. Confirmed ~/.codex/auth.json exists and is updated after authentication.
  6. Reset Desktop cache/profile data.
  7. Tested standalone Codex CLI 0.149.1 — stable.
  8. Tested standalone Codex CLI 0.148.0 — stable.
  9. Temporarily tested the Desktop app with the 0.148.0 Codex binary — Desktop still signed out.
  10. Restored the original ChatGPT app and verified the app code signature is valid.

Current behavior:

The Desktop app eventually behaves as if no access token is attached and starts returning HTTP 401 errors, even though the same account remains authenticated in ChatGPT web and Codex CLI.

Expected behavior:

The Desktop app should remain authenticated continuously, like ChatGPT web and standalone Codex CLI.

Additional diagnostic information was uploaded via /feedback.

Uploaded thread ID:
01a03cb1-2fb8-7603-8e9b-7cd01c7740ac

What steps can reproduce the bug?

Steps to reproduce

  1. Open the ChatGPT Desktop app on macOS.
  2. Enter Codex and sign in successfully.
  3. Start or open a Codex thread.
  4. Use Codex normally for a few minutes.
  5. The Desktop app eventually loses authentication and behaves as if the user has been signed out.
  6. Relevant requests then begin returning HTTP 401 errors.
  7. Quitting and reopening the Desktop app may restore the login session automatically, but the issue recurs again after continued use.

The issue reproduces without any specific prompt or code snippet.

It also reproduces after:

  • reinstalling/updating ChatGPT Desktop
  • resetting the Desktop cache/profile
  • confirming ~/.codex/auth.json exists and is updated
  • testing with a different bundled Codex binary version

Control tests:

  • ChatGPT web remains signed in and works normally with the same account.
  • Standalone Codex CLI 0.149.1 remains authenticated and works normally.
  • Standalone Codex CLI 0.148.0 also remains authenticated and works normally.

Relevant log messages include:

Unauthorized - Access token is missing

desktop_fetch_auth_401

hadToken=false

skipRetryReason=no_token_attached

Uploaded diagnostic thread ID:

01a03cb1-2fb8-7603-8e9b-7cd01c7740ac

Session ID / token usage / context window usage:
Not applicable. The issue appears to be authentication/session related rather than prompt-length or context-window related.

What is the expected behavior?

Expected behavior

ChatGPT/Codex Desktop should remain authenticated continuously after a successful sign-in.

Using Codex normally, opening threads, or leaving the app running should not cause the Desktop app to lose its authentication state or return to the signed-out screen.

Requests from the Desktop app should continue attaching a valid access token and should not fail with HTTP 401 errors during normal use.

The Desktop authentication behavior should be consistent with ChatGPT web and standalone Codex CLI, which remain signed in and work normally with the same account.

Additional information

Additional information

A few additional observations may help with diagnosis:

  • After the Desktop app signs out, quitting and reopening the app sometimes restores the session automatically without requiring me to sign in again.
  • This suggests that persistent credentials may still be valid while the Desktop runtime authentication state is being lost.
  • ~/.codex/auth.json remains present and is updated after authentication.
  • The issue persists even after resetting the Desktop cache/profile.
  • The issue also persisted when I temporarily tested the Desktop app with a 0.148.0 Codex binary.
  • Standalone Codex CLI remains stable with the same account, while the Desktop app repeatedly loses authentication.
  • ChatGPT web also remains signed in throughout.

This makes the issue appear specific to the Desktop authentication/token attachment layer rather than an account-level authentication failure.

Diagnostic information was uploaded via /feedback.

Uploaded thread ID:
01a03cb1-2fb8-7603-8e9b-7cd01c7740ac

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the sign-out flow in the macOS Desktop app and reviewing the reported Unauthorized - Access token is missing, desktop_fetch_auth_401, hadToken=false, and skipRetryReason=no_token_attached logs. Compare the Desktop runtime behavior with the persistent ~/.codex/auth.json state and the stable standalone CLI behavior. Done means the Desktop app remains authenticated during normal use and requests no longer fail with HTTP 401 errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust
Domain
authentication, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.