`codex login status` should report daemon auth status separately from stored credentials

Open
#64,223 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start by tracing the codex login status command and how it obtains stored credential status, then inspect the app-server daemon status interface and its authentication metadata. Keep diagnostics limited to safe status or account metadata. Done means the command reports stored credentials and daemon auth separately, explains any mismatch, and gives the daemon restart command; add or update tests for matching and differing states.

Written by the indexing model from the issue text.

Description

app-server auth bug CLI
What version of Codex CLI is running?

codex-cli 0.172.0

What subscription do you have?

ChatGPT account (OAuth login)

Which model were you using?

Not model-specific.

What platform is your computer?

macOS, Darwin 27.2.0 arm64

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

tmux

Codex doctor report

Not included. No secrets or token contents are relevant to this report.

What issue are you seeing?

codex login status reports the credentials available to a newly started CLI/app-server process. The regular interactive TUI can instead use an already-running app-server daemon, whose in-memory auth state is authoritative for that session. The command currently does not identify this distinction or report the daemon's auth state.

This makes Logged in using ChatGPT ambiguous: it confirms that credentials are stored for the current CODEX_HOME, but does not tell the user whether the daemon used by the TUI is logged in as well. In my case, with CODEX_HOME="$HOME/.codex1", codex login status reported a ChatGPT login while the TUI showed the sign-in flow. Restarting that daemon made the TUI recognize the account.

This issue is about status and guidance, not a request for the daemon to treat auth.json as a live source of truth. A running daemon may intentionally retain its auth state until it is restarted or explicitly reauthenticated. The CLI should make that lifecycle visible instead of reporting an unqualified status that can disagree with the TUI.

What steps can reproduce the bug?
  1. Start Codex with a CODEX_HOME and let its app-server daemon run.
  2. Copy valid ChatGPT OAuth credentials into that home while the daemon remains running (for example, copy ~/.codex/auth.json to ~/.codex1/auth.json).
  3. Run CODEX_HOME="$HOME/.codex1" codex login status. It reports Logged in using ChatGPT.
  4. Run the regular interactive TUI with the same CODEX_HOME. In this reproduction, it showed the sign-in flow while using the already-running daemon.
  5. Run CODEX_HOME="$HOME/.codex1" codex app-server daemon restart, then launch the TUI again. The sign-in flow disappeared.

No credential values should be included in diagnostics or issue artifacts.

What is the expected behavior?

codex login status should clearly report at least:

  • Whether credentials are present in the active CODEX_HOME for a fresh process.
  • Whether an app-server daemon is running for that home and whether it reports an authenticated account.
  • When those states differ, a clear explanation that the TUI uses the daemon's current in-memory auth state, plus the exact command to reconcile it, such as CODEX_HOME=... codex app-server daemon restart.

The command should compare only safe auth status/account metadata and must not print or expose access or refresh tokens. It should avoid implying that the daemon is broken when it is following its documented process-lifetime auth model; the missing piece is actionable visibility for users.

A daemon auth-reload operation would be a useful follow-up, but it is not required to address the primary diagnostic problem. If reload is unsupported, login status should say so and recommend the restart command.

Additional information

Related issues cover the underlying stale daemon credential behavior: #42771 (closed with the explanation that a running app-server owns its in-memory auth state) and #63304 (API-key rotation). This issue requests a distinct CLI diagnostic: report both the stored credentials and the active daemon state, and explain their mismatch without requiring users to discover the daemon lifecycle themselves.

Dominant language
Rust
Stars
136k
Forks
21.6k
Avg merge
1m
Merged PRs (30d)
997

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.