Repository navigation
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 [Windows 26.820] Codex Desktop cannot start: bundled codex.exe relocation from WindowsApps fails #40700 / [Bug] Windows Desktop app fails to start after update to v26.820.60940 ("Unable to locate Codex CLI" & spawn EINVAL on .cmd wrapper) #40752 / [Windows Desktop] Stale CODEX_CLI_PATH after app update breaks paginated thread restore #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
Activity
github-actions commentedon Sep 17, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
jhclarke90 commentedon Sep 19, 2026
Confirming this on a second machine, and I think I can add the mechanism.
Same environment as the report — Windows 11 Pro 26200, x64, MSIX install. I've hit this on eight
consecutive updates since 3 September, and the staging directory was verified fully hash-correct
immediately after each repair, so every occurrence starts from a known-good state.
One difference worth noting: my per-user copy is
%USERPROFILE%\.codex\plugins\.plugin-appserver\rather than
.sandbox-bin\, and myCODEX_CLI_PATHpins…\.plugin-appserver\codex.exe. Samefour binaries, same failure, so I suspect one root cause behind both directories. #40817 looks like
the same bug again.
Mechanism
Three things from the shipped bundle:
codex-code-mode-hostis not a staging entry of its own — it's a companion of thecodexentry. So any failure staging
codex.exesilently takes the host binary down with it. That's whatescalates "stale app-server" into "no terminal at all", and it explains why these two specific files
are the ones that break.
Staging looks like delete-then-copy, and isn't atomic. One model fits every occurrence:
unlinksucceeds → the copy never happens → ends up absentcodex.exe, running as the app-server) →unlinkfailsEPERM→ old buildsurvives → ends up stale
That's exactly the split I see every time:
codex.exestale, the others absent. Logged 16 times on3 Sept and 3 times on 6 Sept:
The strongest evidence for delete-then-copy: on 4 Sept
codex-command-runner.exeandcodex-windows-sandbox-setup.exewere verified present and hash-correct. On 6 Sept both wereabsent, with no replacement written. Files that existed were removed and not replaced.
Related:
EPERMunlinking a lockedcodex.exeduring self-update is already open as #21872 and#23320 in the npm/CLI path, since May. Probably the same underlying problem in a different updater.
Occurrences
codex.execode-mode-hostcommand-runnersandbox-setupcodex.exehas been wrong 8 times out of 8. Restarting the app never fixes it — the app launchesits app-server from the staged
codex.exe, loading and locking it, and only then runs the refreshthat needs to replace it.
Two traps for anyone reproducing this:
codex.exewas byte-identical insize to the package copy but differed by SHA-256 — matching the "identical size, different
content" note in the original report.
builds, so they matched whether or not anything was written. Only when they changed between builds
did it become visible that they were absent.
Suggested fixes
the target (
MoveFileEx+MOVEFILE_REPLACE_EXISTING, falling back toMOVEFILE_DELAY_UNTIL_REBOOTfor a locked target). This alone would fix it.defeats its own refresh.
codex-code-mode-hostits own staging entry, so it can't be taken down by a sibling'sfailure.
downstream
os error 2instead. That's what makes this so hard to diagnose.Reproduction / verification without the GUI
Workaround — fully quit the app first, then:
Not endpoint security
Pre-empting the obvious triage: this machine runs CrowdStrike Falcon with Defender AV disabled, but
it isn't an EDR problem. The "missing" binary survives untouched with an identical SHA-256 in both
the MSIX package and
%LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\— a conviction would have removedevery copy. And quarantine can't produce a stale
codex.exerather than a deleted one.