Skip to content

[Windows desktop] "Account authentication unavailable" from local app-server never recovers after connectivity returns; only an app-server restart fixes it #58308

Open

Description

@mapleleo-hub

What version of the Codex app are you using?

  • Windows Store package: 26.1027.3384.0, x64
  • Bundled runtime in use: C:\Users\LYQ\AppData\Local\OpenAI\Codex\bin\22cfb1d302613eae
  • Bundled codex.exe --version: codex-cli 0.166.0-alpha.5.1

What subscription do you have?

ChatGPT Plus, signed in with ChatGPT auth (auth_mode: chatgpt in ~/.codex/auth.json).

What operating system are you using?

Windows 11 Pro 25H2, build 26200.9711, x64.

Network: Mihomo / Clash Party with TUN enabled. chatgpt.com is routed through a select group whose default member is a url-test group; egress is US.

What issue are you seeing?

The composer shows a banner:

账户身份验证不可用:桌面端无法从本地 Codex 服务 (app-server) 获取可用的账户身份验证信息。发送消息和加载聊天会受到影响。

("Account authentication unavailable: the desktop app cannot obtain usable account authentication from the local Codex service (app-server). Sending messages and loading chats will be affected.")

The banner does not clear once connectivity returns. It only clears when the codex.exe ... app-server child process is killed and respawned by the app.

Timeline

All timestamps are as logged (UTC). Local offset was UTC+8.

  • 08:45:36Z: previous app-server closed with code=0. The reason carried in the close payload is a codex_core_plugins::manager warning: failed to refresh remote installed plugins cache ... failed to send remote plugin catalog request to https://chatgpt.com/backend-api/ps/plugins/installed?limit=200. The app immediately restarts it.
  • 08:45:37Z: sa_server_request_failed attachAuth=true errorMessage="Failed to retrieve authentication token", several "Authenticated workspace changed" warnings, chatgpt_pubsub_connection_failed.
  • 08:45:47Z: new app-server pid 69048 running.
  • 08:47:37Z and 08:47:47Z: cloud_picker_identity ... accountChanged=false ... hasAccount=false dataAgeMs=null fetchStatus=null. These are the last hasAccount samples before recovery.
  • 08:51Z–09:40Z: the proxy node carrying chatgpt.com went down. Every dial in the proxy log is context deadline exceeded.
  • 09:41:45Z → 09:41:46Z: websocket_reconnect_recovery_start then websocket_reconnect_recovery_done ... refreshRecentConversationsFailed=false. The WebSocket layer reconnected cleanly.
  • 09:43Z–09:45Z: tpp-local-executor sampling healthy every 60s, mcp_server_startup_status_updated ... status=ready, every response_routed ... errorCode=null. No app_server_connection error, crash or exit is logged between the successful reconnect and the manual kill.
  • At that moment, with the stored access token, GET https://chatgpt.com/backend-api/me returns 200 and GET https://chatgpt.com/backend-api/accounts/check/v4-2023-04-27 returns 200 through the same proxy (1.3s / 2.4s). The banner was still displayed.
  • 09:46:36Z: killed app-server pid 69048 only (renderer untouched). The app respawned it as pid 47292 within a second.
  • 09:46:38Z: cloud_picker_identity ... accountChanged=true ... hasAccount=true.
  • 09:46:43Z: chatgpt_pubsub_topic_subscribed. Recovered. The Electron window was never restarted.

Credentials are not the problem

  • ~/.codex/auth.json was valid throughout and is valid now: auth_mode=chatgpt, access_token present, JWT exp about 17 hours in the future at the time of the failure, refresh_token and account_id present.
  • codex doctor on the same machine at the same time reports ✓ auth auth is configured, stored auth mode chatgpt, auth mode chatgpt, reachability mode ChatGPT auth.

The app-server simply never re-reads or retries.

Failing calls counted in the electron main-process log for the day

491  sa_server_request_failed attachAuth=true errorCode=cloudflare_challenge
134  sa_server_request_failed attachAuth=true errorCode=ERR_CONNECTION_CLOSED
 14  Authenticated desktop fetch failed (403)

The 491 Cloudflare challenges cluster between T02 and T07 and stop at 07:35:36Z. The 403s are all inside that window. During the window the account fetch cannot succeed. account/read and getAuthStatus still answer at the RPC level with errorCode=null, i.e. the RPC is fine but carries no account.

Reproducer

  1. Use the Windows desktop app normally with a working route to chatgpt.com.
  2. Let the app-server restart itself, or break the chatgpt.com route for a few minutes so the account fetch cannot complete.
  3. Restore the route and confirm GET /backend-api/me returns 200 with the stored token.
  4. The "account authentication unavailable" banner stays. There is no retry, no toast, no action in the UI.
  5. Kill only the codex.exe ... app-server child process. The app respawns it and the banner disappears in about two seconds.

Expected: after the transport recovers, the app-server should retry the account fetch, or the UI should offer a retry / re-authenticate action. Currently the only recovery is a manual app-server restart, which most users will not discover.

Related

Both cover the Cloudflare 403 trigger. This report is a different surface: the local app-server auth status, which never self-heals after connectivity returns.

Activity

  1. added
    bug
    app
    windows-os
    auth
    app-server
    connectivity
    on Oct 30, 2026
  2. minority commented on Oct 31, 2026

    @minority

    A couple of days ago, the same issue cropped up: I can't work via the Codex Desktop, only through the cli.

  3. mapleleo-hub commented on Nov 5, 2026

    @mapleleo-hub
    Author

    Thanks for the source pointers, they're useful. Short answer: I can't produce the post-recovery account/read payload you're asking for without instrumenting the Electron main process, so here is what the logs do constrain and what I'm missing.

    What the sequence shows:

    • During the outage, account/read and getAuthStatus still answered at the RPC level with errorCode=null, but carried no account. The RPC was alive, the payload was empty.
    • After the route came back and before any kill, GET /backend-api/me returned 200 and GET /backend-api/accounts/check/v4-2023-04-27 returned 200 through the same proxy (1.3s and 2.4s), while the banner was still displayed.
    • The WebSocket layer recovered on its own at 09:41:45Z to 09:41:46Z (websocket_reconnect_recovery_done, refreshRecentConversationsFailed=false).
    • Killing only the app-server child at 09:46:36Z gave cloud_picker_identity accountChanged=true hasAccount=true two seconds later, with the renderer never restarted.

    So at the moment of the failure the token and the transport were both fine, and the state that had to be rebuilt lived inside the app-server process.

    What I can't answer: whether an explicit account/read issued after recovery would have returned an account. The desktop talks to app-server over its own stdio channel, so I have no way to send that RPC from outside without a patched build. The last cloud_picker_identity samples in my log are from 08:47:37Z and 08:47:47Z, both hasAccount=false, and I don't have any post-recovery samples.

    If you can point me at a supported way to call account/read against the running app-server (debug socket, env var, or a build flag), I'll run the pair you describe: outage recovery with the original process alive, then the fresh-process control.

  4. mapleleo-hub commented on Nov 5, 2026

    @mapleleo-hub
    Author

    Correction to my previous comment, and then the numbers you asked for.

    I said I could not drive account/read from outside. That was wrong for a fresh process, right for the desktop's own instance. codex app-server generate-json-schema --out <dir> dumps the protocol, and the process speaks newline-delimited JSON over stdio, so a fresh instance can be driven directly. The desktop instance still cannot: it is spawned with plain stdio and no --sock, and ~/.codex/app-server-control/ is never created, so codex app-server proxy has nothing to attach to.

    Protocol as it actually looks on codex-cli 0.166.0-alpha.5.1:

    • initialize requires params.clientInfo {name, version}.
    • account/read takes GetAccountParams { refreshToken?: boolean }.
    • There is no getAuthStatus method in the client request enum on this build. The account methods present are account/read, account/rateLimits/read, account/usage/read, account/workspaceMessages/read, account/sendAddCreditsNudgeEmail, account/login/start, account/login/cancel, account/logout, account/gatewayOAuth/read|login|cancel. My desktop log does contain inbound method=getAuthStatus, so either the desktop layer calls something not in the published schema or the schema lags the build.

    Baseline from a fresh instance on this machine, same token, same proxy, healthy network:

    {"id":2,"result":{
      "account":{"type":"chatgpt","email":"...","planType":"plus","workspaceName":null},
      "requiresOpenaiAuth":true,
      "workspaceRouting":{
        "chatgptAccountId":"bae6dd93-...",
        "backendOrigin":"https://chatgpt.com",
        "accountRoutingOverride":"NO_CONSTRAINT"
      }}}
    

    refreshToken:false and refreshToken:true return the same complete object. Immediately after initialize, before I sent any request, the server pushed:

    {"method":"account/updated","params":{"authMode":"chatgpt","planType":"plus"},"emittedAtMs":...}
    

    Now the measurement you asked for. I re-extracted every account/read round trip from the desktop main-process log of the failing session, with durationMs and RPC error code. 93 calls for the day; the relevant window:

    Recorded at (UTC) durationMs errorCode note
    08:41:56 7 null healthy, before the incident
    08:46:25 – -32603 app-server started 08:45:47
    08:46:36 – -32603
    08:46:46 42807 -32603 implies the request started ~08:46:03
    08:46:56 52823 -32603 also implies ~08:46:03, so these two ran concurrently
    no account/read between 08:46:56 and 09:46:38 59m42s, covering the outage 08:51–09:40 and the recovery at 09:41
    09:46:38 170 null first call after I killed the child
    09:46:42 13 null

    Three things fall out, and one of them corrects my earlier framing.

    1. The failure is a JSON-RPC internal error, not an empty success.

    I wrote earlier that the RPC answered with errorCode=null but no account. That was wrong. The round trips that failed carry -32603 (Internal error). The errorCode=null lines I had picked up were the request-tracking records, not the responses. So the desktop did receive an error, it just receives no actionable classification: -32603 covers the routing-discovery failure, the 15 s bound being exceeded, and anything else bubbling out of the account processor.

    2. The client stops asking and never resumes.

    websocket_reconnect_recovery_start fires at 09:41:45Z and websocket_reconnect_recovery_done ... refreshRecentConversationsFailed=false at 09:41:46Z. Between that and my manual kill at 09:46:36Z there are zero account/read calls. The 59-minute gap is not a sampling artifact; the client simply does not ask again after the backoff completes. Whatever had to be rebuilt lived in the desktop's identity store, and the transport-recovery event does not re-drive it.

    3. The 15-second bound does not match the log.

    Two concurrent calls, both started around 08:46:03, returned -32603 after 42.8 s and 52.8 s. If read_account() were bounded at 15 s per attempt, then either the bound does not apply on this Windows desktop path, or there is a retry ladder underneath it that surfaces the last error only after several attempts. 42.8 ≈ 3 × 14.3 and 52.8 is not a clean multiple, so the ladder theory fits only loosely. Worth checking whether the bound covers the /accounts/check routing discovery inside read_account() and not just the account fetch.

    That combination explains why the banner has no retry affordance: the desktop got a classification-free internal error, backed off, and had nothing better to show than "authentication unavailable".

    What to test next, now that the logs point somewhere specific:

    • (a) Deliberately reproduce the timeout: black-hole chatgpt.com for the app-server only, then call account/read from a driven instance and record whether it returns at 15 s or at 40–50 s. This isolates the bound from the routing discovery.
    • (b) Have the renderer re-issue account/read on websocket_reconnect_recovery_done. That event already fires correctly in my logs and is the natural hook; it needs no app-server change.
    • (c) Push account/updated again when the app-server observes its transport recover, instead of only at startup and on auth transitions.

    I can run (a) here on request; it needs a few minutes of deliberately black-holed egress for chatgpt.com, which is why I have not done it unprompted. For an in-situ capture of the desktop's own app-server during a real outage, the cheapest enabler would be a build flag or env var that makes the desktop expose its control socket. With that, codex app-server proxy would let me run the full outage-recovery plus fresh-process control pair you described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appapp-serverauthbugconnectivitywindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions