Codex CLI session continues working after API key is deleted, until the process is terminated

Open 💬 1 comment Opened Mar 25, 2026 by jonny030

What version of Codex CLI is running?

0.116.0

What subscription do you have?

API key

Which model were you using?

gpt-5.4

What platform is your computer?

Mac OS

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

iTerm2

What issue are you seeing?

If Codex CLI is already running and authenticated with an API key, deleting that API key does not immediately stop the existing CLI session.

I verified that the deleted key is actually invalid, because fresh requests made outside Codex CLI return 401 Unauthorized. However, the already-running Codex CLI session continues to work and continues generating billable usage until the process is manually terminated.

What steps can reproduce the bug?

  1. Create an API key
  2. Configure Codex CLI to use that key
  3. Start a Codex CLI session and confirm it works
  4. Delete the same API key from the OpenAI platform
  5. Verify the key is revoked by making a fresh external request and confirming it returns 401 Unauthorized
  6. Continue using the already-running Codex CLI session
  7. Observe that the existing session still works
  8. Start a new Codex CLI session
  9. Observe that the new session can no longer authenticate

What is the expected behavior?

Once an API key is deleted/revoked, the existing Codex CLI session should stop working immediately, or at least fail on the next request.

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗