Codex shell sees invalid GitHub CLI auth while same machine/tooling works elsewhere

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

What version of Codex CLI is running?

any

What subscription do you have?

Enterprise

Which model were you using?

gpt-5.5, gpt-5.6-sol

What platform is your computer?

macOS

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

_No response_

Codex doctor report

What issue are you seeing?

Component: Codex CLI / local shell tool execution
Codex version: codex-cli 0.145.0
gh version: gh version 2.96.0 (2026-07-02)
Platform: macOS Darwin 25.5.0 arm64

Issue:
When Codex runs gh auth status, it reports that the default GitHub token is invalid. Another local coding agent/
session on the same machine is able to see the expected GitHub auth state.

Command run in Codex:
gh auth status

Actual output:
github.com
X Failed to log in to github.com account <my_account> (default)

  • Active account: true
  • The token in default is invalid.
  • To re-authenticate, run: gh auth login -h github.com
  • To forget about this account, run: gh auth logout -h github.com -u <my_account>

Expected:
Codex should either:

  • access the same valid GitHub CLI credential context as the host environment, or
  • clearly document/explain why gh auth differs inside Codex sandbox/tool execution.

What steps can reproduce the bug?

just make him return the output of gh auth status

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 1 month ago

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

  • #35633

Powered by Codex Action

lambegraham · 22 days ago

This is due to being run in sandbox mode. Known issue (to us, maybe not the devs)

ipcjs · 22 days ago

Codex CLI still shows “Failed to log in...” after switching to Full Access mode, while the Codex app does not have this issue in Full
Access mode.