[Bug][Windows Desktop 26.820.9563.0 / Codex CLI] Chronic Auth De-sync, Infinite Login Loop, and Off-screen Bounds
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Summary
We are reporting a critical set of chronic bugs affecting the Windows ChatGPT Desktop App (UWP/Electron package: OpenAI.Codex_26.820.9563.0_x64__2p2nqsd0c76g0) and Codex CLI (v0.150.0-alpha.8) on Windows 10/11 environments.
These issues lead to severe user frustration, frequent de-authentications, unrecoverable OAuth loading loops ("Continue signing in with your browser"), and window rendering failures where the window is placed at off-screen negative coordinates.
Environment
- Operating System: Windows 11 / Windows 10 (x64) + WSL2
- ChatGPT Desktop App Version:
OpenAI.Codex_26.820.9563.0_x64__2p2nqsd0c76g0 - Codex CLI Version:
v0.150.0-alpha.8(Codex App Tools bundled:server.mjs) - Browser: Google Chrome / Microsoft Edge (Default)
Key Issues & Root Cause Analysis
1. Chronic De-authentication & Infinite "Continue signing in with your browser" Loop
- Symptom:
- The desktop app randomly drops active user sessions and resets to the landing screen ("Sign in to ChatGPT").
- Clicking "Continue to sign in" transitions the app into "Continue signing in with your browser" with a single
[Cancel sign-in]button. - The local OAuth server spawns on
http://localhost:1455(or dynamic ports), but if the browser does not automatically navigate to the generated OAuth URL or if the protocol handler callback (codex://orhttp://localhost:1455/auth/callback) is blocked/delayed by Windows sandbox restrictions, the app deadlocks indefinitely.
- Root Cause:
- The UWP AppContainer isolation (
%LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Roaming\Codex\web\Codex) fails to reliably sync token state with%APPDATA%\Codex\auth.jsonand~/.codex/auth.json. - Even when
--device-authsucceeds in CLI, the desktop Electron webview does not listen for file changes or re-read tokens without a manual process teardown.
- The UWP AppContainer isolation (
2. Window Bounds Rendered Off-Screen at Negative Coordinates (-1920, -1040)
- Symptom:
- The app process (
ChatGPT.exe) runs with high CPU/memory in Task Manager and reportsMainWindowTitle: ChatGPT, but no window appears on any connected display. MainWindowHandlefrequently evaluates to0or points to an off-screen viewport.
- The app process (
- Root Cause:
- In
.codex-global-state.json,electron-main-window-boundsis frequently written with negative coordinates, e.g.:"electron-main-window-bounds": { "x": -1920, "y": -1040, "width": 1918, "height": 2076, "isMaximized": false } - The app lacks bounds sanitization/clamping against current active virtual screen bounds during startup.
- In
3. UTF-8 BOM JSON Parsing Crash on Startup
- Symptom:
- The app silently terminates immediately after launch without opening any window or UI.
- Root Cause:
- If
.codex-global-state.jsoncontains a UTF-8 Byte Order Mark (\xef\xbb\xbf), Electron'sJSON.parse()throws a fatal syntax error before window creation.
- If
Reproduction Steps
- Install
OpenAI.Codex_26.820.9563.0on Windows 11 with WSL2 enabled. - Sign in using the default browser OAuth flow.
- Work across multiple sessions or restart the computer / close the app.
- Observe that:
- The app randomly returns to "Sign in to ChatGPT" / "Continue signing in with your browser".
- The window occasionally vanishes due to negative coordinates written to
.codex-global-state.json.
Suggested Fixes & Recommendations
- OAuth UI Fallback: Provide an interactive Device Code entry (
auth.openai.com/codex/device) directly within the desktop UI instead of relying solely on localhost port callbacks. - Window Bounds Sanitization: On startup, validate
electron-main-window-boundsand reset(x, y)to primary monitor center if coordinates fall outside visible display geometry. - Robust JSON Parsing: Strip BOM automatically before parsing state JSON files (
content.replace(/^\uFEFF/, '')). - Unified Token Sync: Ensure UWP AppContainer and Win32 CLI share a unified, persistent credential cache.
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 reproducing the three reported failures and inspect .codex-global-state.json, %APPDATA%\Codex\auth.json, and ~/.codex/auth.json; server.mjs and the localhost:1455 callback are also named entry points. Done means the app recovers from stale authentication, restores visible window bounds, and starts when the state JSON contains a UTF-8 BOM, with tests or reproducible checks for each case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, rust
- Domain
- authentication, cli, desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100