Live codex cli session cannot continue on auth refresh (api login)
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.
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
May be related to https://github.com/openai/codex/issues/12764.
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.
@derrickchoi-openai FYI