[Bug]: Authentication switching issues on codex
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
Not sure
Steps to reproduce
1- authenticate to another account on codex. 2- in settings it displays that the account has been authenticated successfully 3- continue with chat and see that it is still running on old account since we get error that limits have been used up and the new accounts does not have issues 4- restart t3 and session is updated and new authenticated account works fine.
Expected behavior
Changing the authenticated account should automatically use the new authenticated account for new messages withought having to restart t3 for the new authenticated account to work.
Actual behavior
Unless you restart t3 the switched authenticated account does not take place and work when continuing chat threads that where on the old account.
Impact
Major degradation or frequent failure
Version or commit
No response
Environment
No response
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
No response
Thanks for the report — this looks real, and the restart workaround is a strong signal.
What we think is happening
Codex login is not an in-app OAuth flow. Settings “Authenticated” comes from a short-lived codex app-server status probe that reads the current auth.json. Existing threads keep a long-lived app-server process and reuse it for later messages (until Stop, a T3 restart, or the ~30 minute idle reaper).
So after you sign into another Codex account:
- Settings re-probes and shows the new account.
- Threads that already have a live Codex process keep the old tokens and can still hit that account’s usage limit.
- Restarting T3 kills those processes; the next turn starts a fresh app-server and the new login works.
That is the same shape as Claude #9607 / #11048 (CLI loads credentials once per process; T3 keeps the process).
This is not the same as switching between two configured Codex instances in the model picker (shadow-home / CODEX_HOME setup in the Codex provider docs). Those threads stay bound to the instance they started on unless you pick the other account. A restart alone would not rebind them.
Workaround
After changing the Codex login, Stop the affected thread (or restart T3), then send again. A new thread also picks up the new account immediately.
Fix direction
When a Codex provider refresh reports a different account identity than the live sessions for that instance, stop those sessions so the next message respawns app-server with current credentials. account/updated is already on the wire but does not trigger that today.
To confirm the path
Please add, if you have them:
- T3 version / desktop vs
npx t3 - Whether you ran
codex loginon the same Codex home, or added a second Codex instance (shadow home) - Whether the thread’s model picker still showed the same Codex instance after the switch
- The usage-limit error text from the thread
Accepting as a bug.
I just installed t3 so i am unfamiliar on how to see the version it is on, but it is on the latest one as of sending this message. I am using both desktop and npx t3 for connecting to my server. Both codex login and codex login --device-auth Just used normal codex directory, ( couldnt understand shadow home to get it to work yet ) Just normal codex ran out of usage error that i used to identify that the accounts wherent switched since i switched from one that had ran out of usage to one that had 100% usage, not really important to the issue. Just worth mentioning because if i hade usage on both accounts i wouldnt know that it didnt switch the authenticated accounts correctly.
Confirming this on the current T3 nightly version:
System / version
- T3 Code: Nightly
0.0.46-nightly.20261013.3053— Windows desktop app (x64) - OS: Windows 10
- Codex CLI:
0.160.1(codex login status→ "Logged in using ChatGPT") - CodexBar:
0.70.0
Answers to the confirmation questions
- Desktop app (Windows), single default Codex provider.
- Yes —
codex loginagainst the same default Codex home (~/.codexand/or%USERPROFILE%\.codex); no shadow home in the current setup. I also sometimes switch via CodexBar. - Yes — the thread's model picker still showed the same (default) Codex instance after the switch.
- The affected chat kept showing
Usage limit reached/Reset time unavailable; retry manually, while Settings / Usage showed the newly signed-in account at ~98% remaining (2% used).
Reproduction (current, single default provider)
- Work in a thread on Codex account A until it hits its limit; the thread shows the usage-limit banner and the composer is blocked.
- Switch to account B with
codex login(or CodexBar). - Settings / Usage shows account B authenticated with ~98% remaining.
- Back in the same chat, the limit state does not update — it still reflects account A, so the thread stays stuck.
- Fully restart T3 Code, then continue in the same chat: it runs on account B with fresh usage and no handoff, preserving the native Codex session.
This matches your diagnosis exactly: the long-lived codex app-server process keeps the old tokens until a restart. Stopping the thread also works as a lighter workaround.
Additional data — two-provider attempt (related: #16613) Before this, I tried adding account A and account B as two separate Codex provider instances with the default provider disabled. That did give per-account provider switching, but:
- switching instances mid-thread fell back to a portable T3 context handoff instead of resuming the native Codex thread (#16613), and
- it repeatedly required re-syncing the codex login, leading to failed chats (this is the #16613 path, not the login-switch path above)
I reverted to one default provider + external CLI/CodexBar switch + restart. So from a user's perspective "use two Codex accounts and switch when one runs out" is close, but the switch only takes effect after a restart and the two-instance path degrades to a handoff.
Confirmed on T3 Code Nightly 0.1.1-nightly.20261019.3360, build commit 1451e7cb23034d29774338608368a15d8845df36, macOS 26.3.1, arm64.
The default existing Codex CLI provider kept using the previous Business workspace after the user signed in to Personal/Pro against the same default Codex home. Restarting T3 made that same provider and conversation use the new account.
Captured sequence on 2026-10-19, UTC
| Time | Evidence |
|---|---|
| 12:01:53.850 | The saved native authentication record's last_refresh; token metadata identifies the Personal/Pro plan. |
| 12:02:46.269 | The authentication cache file's modification time. |
| 13:21:43.928–13:21:44.485 | The existing shared app-server still emits account/rateLimits/updated with planType: "team" for the old Business workspace. |
| 14:00:14.161 | T3 server starts after the user restarts the application. |
| 14:00:27.521 | The default provider's new app-server emits account/updated with authMode: "chatgpt", planType: "pro". Subsequent rate-limit events report 12% weekly usage, and the conversation works. |
The user initially identified the mismatch because T3 kept reporting the previous account's limit after signing in to Personal. The protocol events above independently confirm that the live process retained team after the on-disk credentials had changed, then switched to pro after restarting T3. This is not only a stale display label.
Answers to the triage questions
- Desktop app, Nightly build above.
- Same default Codex home and the same default provider instance throughout the captured sequence.
- A second managed Codex instance exists on this host, but this trace belongs to the default existing-CLI instance; the restart did not rebind the thread to that second instance.
- The account switch and recovery are observed. A separate controlled test of Stop-only recovery was not performed.
Expected: once a provider probe detects a changed account identity, subsequent work should use the new credentials and limit state without requiring a full T3 restart, while preserving the conversation.
The distinct managed-token-expiry failures on this host are reported under #16132.
Posted by Codex on behalf of the account owner. No token values, emails, workspace/account IDs, local paths, or conversation/session identifiers are included.
Triage on current main b5a226e49c: reviewed the report and all four comments, scanned open issues and PRs, and checked linked work. No exact duplicate or existing fix for the default existing-CLI account-switch path was identified. #16132, #16849, and #21787 concern managed credential renewal, a different path.
No live account-switch reproduction was run here: this environment does not provide two test ChatGPT accounts for the reported sequence. The existing October 19 trace already distinguishes stale live credentials from a stale usage label. Further work requires maintainer handling because it changes authentication/session lifecycle. Leaving this accepted bug open; no additional reporter information is requested and no duplicate PR was opened.