Codex CLI 0.124.0 misreports `gh auth status` as invalid inside Codex session
Open 💬 18 comments Opened Apr 24, 2026 by skshim-reco
💡 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.124.0
What subscription do you have?
Unknown
Which model were you using?
gpt-5.4 xhigh
What platform is your computer?
Darwin 25.3.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
tmux (TERM=tmux-256color)
What issue are you seeing?
Inside Codex CLI 0.124.0, running gh auth status incorrectly reported that the active GITHUB_TOKEN and the saved skshim-reco account were invalid.
On the same machine and same repo, running gh auth status in a normal terminal session succeeded.
The failing Codex output was effectively:
Failed to log in to github.com using token (GITHUB_TOKEN)The token in GITHUB_TOKEN is invalid.- the saved default account was also reported as invalid
After downgrading to 0.122.0, gh auth status succeeded again.
What steps can reproduce the bug?
- Start Codex CLI
0.124.0. - Use Full Access mode.
- Run
gh auth statusinside the Codex session. - Observe that Codex reports the active
GITHUB_TOKENand saved account as invalid. - Run
gh auth statusin a normal terminal on the same machine and repo. - Observe that GitHub auth succeeds there.
- Downgrade Codex CLI to
0.122.0and rerungh auth status. - Observe that it succeeds again.
Uploaded thread: 019dbd61-a8a7-78d0-8444-322d2b838a42
What is the expected behavior?
gh auth status inside Codex should match the normal terminal result on the same machine and report valid authentication.
Additional information
- The active GitHub account was
skshim-reco. - The
GITHUB_TOKENvalue was unchanged between the successful and failing checks. - This looked like a Codex runtime/environment regression rather than an actually invalid GitHub token.
18 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I have a related Windows data point.
In my case, GitHub auth is valid outside the Codex tool-call environment:
0.125.0gh:C:\Program Files\GitHub CLI\gh.exeGH_TOKEN/GITHUB_TOKENenvironment variables are setExternal checks succeed:
The same account also works from Git Bash and from Claude Code using both PowerShell and Git Bash.
However, inside a Codex sandbox/tool-call context I previously saw
gh auth statusreport the saved account as invalid. After switching/running outside that restricted context, the sameghinstallation and same Windows account report valid auth again.So this looks consistent with the issue being a Codex runtime / sandbox / spawned-process environment problem rather than an actually invalid GitHub token.
One distinction from the original report: this happened without
GITHUB_TOKEN; auth is coming from the Windows keyring. That suggests the problem may affect keyring-backedghauth as well, not only env-token auth.MacOS 26.4 here and having the same issue.
Same issue here...
<img width="249" height="85" alt="Image" src="https://github.com/user-attachments/assets/5547b61c-be30-459b-af73-17d1ae9ff734" />
<img width="391" height="158" alt="Image" src="https://github.com/user-attachments/assets/e613fefe-5f5a-443b-a856-010a94e01671" />
<img width="139" height="107" alt="Image" src="https://github.com/user-attachments/assets/da581701-9f22-4154-9690-90cdee7bf637" />
also having the same issue CLI reports invalid but outside in any terminal reports valid account and logged in
Ubuntu 24.04, same issue.
Codex VS Code Extension: 26.519.32039
Note: Change permission from "Default permissions" to "Full access" solved this issue, and
gh auth statusreported success when ran by Codex. Seems like a sandbox-related issue.Confirmed another macOS data point while investigating #27740:
26.608.122170.138.0-alpha.7Darwin 25.3.0 arm64 arm2.93.0Inside a network-restricted Codex tool sandbox,
gh auth statusreported the saved account/token as invalid. Running the same command outside that sandbox immediately succeeded:The credential was valid. The misleading “invalid token” result was caused by GitHub CLI being unable to verify it from the restricted execution context.
This was separate from #27740’s sidebar bug, which failed earlier at
gh --versionbecause shell-environment loading timed out and leftghabsent fromPATH.Potential workarounds, in increasing scope:
~/.codex/rules/default.rules:``
python
``prefix_rule(
pattern = ["gh", "auth", "status"],
decision = "allow",
justification = "Allow GitHub CLI authentication checks",
)
Restart Codex after editing the rule. This allows the exact command to run outside the sandbox without repeated prompts. It does not grant network access inside the sandbox, so Codex must still request escalation when networking is restricted.
~/.codex/config.toml:```toml
default_permissions = "github-workspace"
[permissions.github-workspace]
extends = ":workspace"
[permissions.github-workspace.network]
enabled = true
[permissions.github-workspace.network.domains]
"github.com" = "allow"
"api.github.com" = "allow"
```
Restart Codex, then select/use the
github-workspaceprofile. This preserves workspace-level filesystem access while limiting network access to GitHub. Additional domains may be required for someghoperations.~/.codex/config.toml:``
toml
``[sandbox_workspace_write]
network_access = true
Restart Codex afterward. This is less desirable because it grants unrestricted outbound network access to all commands in
workspace-write, rather than only GitHub-related commands.The product should ideally distinguish an unreachable authentication endpoint from an actually rejected credential instead of presenting both as “token invalid.” Managed runtime policy may also override local network settings, so the effective permission profile should be visible in diagnostics.
This also happens in the desktop app on Windows. It completely breaks the built-in Github skill for pushing, CI, etc.
Edit: actually, when using the `
@Githubplugin, it works. But when Codex usesgh` it doesn't authenticate, although gh is authed on the host. Sorry for the confusion.still an issue
Same for me, this is big issue,
gh version:I thought maybe this was related to sandbox settings but i set my global user settings for sandbox to full access and I am still seeing this fail every single time. I have to then followup with "escalate to run outside the sandbox" and then it works
Bumping this just hit the same issue codex CLI version codex-cli 0.145.0
Same for me, gh version -
gh version 2.89.0 (2026-03-26)They fixed it in the ChatGPT non-classic desktop app; all git stuff, including diff, just removed with the Codex name.
Same issue here.
Same issue here on Mac Codex (chatGPT) Desktop v 26.727.40816
Same issue here with macOS Codex(ChatGPT) Desktop app Version 26.727.51351
Workaround: add this to global
~/.codex/AGENTS.md:This makes Codex automatically retry commands like
gh auth statusoutside the sandbox instead of misreporting valid credentials as invalid.