Live codex cli session cannot continue on auth refresh (api login)

Open 💬 4 comments Opened Apr 7, 2026 by qmaldon
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.118.0

What subscription do you have?

Corporate (login method is "api")

Which model were you using?

gpt-5.4

What platform is your computer?

Linux 5.15.0-316.196.4.1.el8uek.x86_64

What terminal emulator and version are you using (if applicable)?

Gnome Terminal

What issue are you seeing?

On token expiration (auth.json) an external refresh (login in different process) does not fix existing live sessions.


Reconnecting... 1/5
Reconnecting... 2/5
Reconnecting... 3/5
Reconnecting... 4/5
Reconnecting... 5/5
unexpected status 401 Unauthorized: { "code" : "NotAuthenticated", "message" : "The required information to complete authentication was not provided or was incorrect." }, url: https://<redacted>

What steps can reproduce the bug?

Keep a live session with API-based authentication. Let it expire.
Refresh auth (login) from separate CLI.
Run any prompt on pre-existing live session.

What is the expected behavior?

The pre-existing live sessions should detect the authentication failure and attempt to do an internal refresh if auth.json has mutated.

Additional information

High impact on headless Codex use.

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #15502
  • #15410
  • #15754

Powered by Codex Action

etraut-openai contributor · 4 months ago
jamhb91 · 4 months ago

Partially, this is an enhancement request to make codex to identify when to refresh their internal cache with the new key its available in the auth.json file after a 401 HTTP error. Very relevant for all users which are using codex through different providers.

jamhb91 · 4 months ago

@derrickchoi-openai FYI