Windows: Desktop fails to start after auto-update - stale per-user backend (CODEX_CLI_PATH) and silently invalidated auth session
Nobody has claimed this yet.
- 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)?
26.911.7940.0 (Windows package OpenAI.Codex_26.911.7940.0_x64__2p2nqsd0c76g0); bundled CLI in use: codex-cli 0.154.0-alpha.6.2
What subscription do you have?
ChatGPT Plus
What platform is your computer?
Windows 11 Pro, Build 26200, x64
What issue are you seeing?
After the Codex desktop app auto-updated, it failed to start: no window appeared for 4+ minutes while the main process burned CPU continuously.
Two independent root causes were found on this machine.
- Stale bundled CLI in the per-user runtime directory
The app launches the executable selected by the user-level CODEX_CLI_PATH override, which points at the per-user runtime copy:
C:\Users<user>.codex.sandbox-bin\codex.exe
The MSIX package update only replaces the payload under C:\Program Files\WindowsApps\ and does NOT refresh this per-user copy. After the last update, all four backend binaries in .sandbox-bin differed from the ones bundled in the updated package - and comparing file sizes alone is not enough, because several differ in content while having identical sizes:
- codex.exe: size identical, content differs
- codex-code-mode-host.exe: differs (72,471,848 vs 72,471,856)
- codex-command-runner.exe: size identical, content differs
- codex-windows-sandbox-setup.exe: size identical, content differs
The app gave no indication it was running a stale app-server; startup simply hung.
- Auth session silently invalidated, while login status still reports "logged in"
codex login status reported "Logged in using ChatGPT", while the stored tokens were unusable. Refreshing returned HTTP 401:
{"error":{"message":"Your session has ended. Please log in again.","code":"refresh_token_invalidated"}}
The id_token was expired and the refresh_token had been revoked server-side (the machine had been idle for several days). Nothing in the UI surfaced this - the app just failed to start.
What steps can reproduce the bug?
- Use Codex Desktop on Windows with a user-level CODEX_CLI_PATH set. This override is the documented workaround for the "Unable to locate the Codex CLI binary" startup failure (see #40700 / #40752 / #40796).
- Let the app auto-update through the MSIX store while the override is in place.
- Fully exit and relaunch the app.
- Observe: no window appears and the main process consumes CPU indefinitely.
- Compare each .exe under %USERPROFILE%.codex.sandbox-bin against the same-named file under the updated package's app\resources directory - hashes differ even when file sizes match.
- Separately, leave the app unused for several days and relaunch:
codex login statusstill says logged in, but POST https://auth.openai.com/oauth/token with grant_type=refresh_token returns 401 refresh_token_invalidated.
What is the expected behavior?
-
When the desktop app updates, it should validate the version and/or protocol capabilities of the app-server binary it is about to launch (including one selected via CODEX_CLI_PATH), and either refresh it automatically or refuse to start with an actionable error naming the configured path and the detected version mismatch - instead of hanging silently.
-
Before opening a thread, the app should verify that stored credentials are still usable (e.g. probe the refresh endpoint). If the session has been invalidated server-side, it should prompt the user to sign in again, instead of continuing to report
codex login status: Logged in using ChatGPT.
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing desktop startup with a user-level CODEX_CLI_PATH, comparing binaries in %USERPROFILE%.codex.sandbox-bin with the package's app\resources directory. Then inspect the codex login status flow and the OAuth refresh endpoint behavior for refresh_token_invalidated. Done means stale binaries are detected with an actionable error or refreshed, and invalid sessions prompt the user to sign in again instead of reporting a usable login.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- authentication, desktop
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100