[Bug]: Cancelling or failing ChatGPT sign-in leaves Codex in managed mode, so a later CLI login is ignored #29090
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/web
Steps to reproduce#
- Start T3 Code with a fresh base directory, with the Codex CLI installed but not signed in.
- Open
/welcomeand continue to the Agents step. Codex offers Continue with ChatGPT and Use existing CLI. - Click Continue with ChatGPT.
providerInstances.codex.config.setupModeinsettings.jsonis now"managed", about 240 ms later and before any sign-in has happened. - Click Cancel.
setupModestays"managed". - Sign the Codex CLI in using the same home.
codex login statusreports that it's signed in. - Open Settings → Providers → Codex.
I ran steps 1 to 4 as written. For steps 5 and 6 I used a separate run on the same versions, with setupMode: "managed" already in settings.json and an API key saved with codex login --with-api-key.
Expected behavior#
The mode changes only once ChatGPT sign-in succeeds, or goes back to what it was if sign-in is cancelled or fails. A CLI login made afterward is then recognized.
Actual behavior#
Codex stays in managed mode. Settings shows Not authenticated · Sign in with ChatGPT to use Codex. while codex login status reports a valid login.
The click saves the mode before sign-in starts:
CodexSetupSection.tsxL163-L164 callsonModeChange("managed").WelcomeWizard.tsxL926-L946 writes it to settings.
Impact#
Minor bug or occasional failure
Use existing CLI in Settings recovers from this since #23160, but nothing tells you that a working CLI login is being ignored. We hit this in dizys/t3code-docker#82, where a failed ChatGPT sign-in left someone with a working CLI and a provider that said it was signed out.
Version or commit#
Ran on v0.1.6. The same code is on main at 333f7a6f6e6b074ba28aca662ff4052c99280d15.
Environment#
Linux arm64 in Docker, Codex CLI 0.166.0, Chromium.
Logs or stack traces#
None. This doesn't produce an error.
Screenshots, recordings, or supporting files#
None.
Workaround#
Click Use existing CLI under Settings → Providers → Codex (v0.1.6 or newer), or set setupMode to "existing" in settings.json. Either one applies without a restart.
tanstack-source added labelsbug
Sign in to join this conversation.