Manual Approval Mode (Full Access) is required to authenticate using `GH_TOKEN`

Resolved 💬 4 comments Opened Sep 18, 2025 by kylesnowschwartz Closed Jan 13, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.38.0

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

Configure codex like so:

# config.toml

model = "gpt-5-codex"
approval_policy = "on-request"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]
network_access = true

[tui]
notifications = true

[shell_environment_policy]
inherit = "all"
ignore_default_excludes = true   # I don't necessarily want to set this, but I did for debugging

Run codex and ask it run gh auth status

What is the expected behavior?

I expect to be able to ask Codex to run github cli commands (like viewing pull request diffs for context) using gh without Full Access which I assume is essentially the dangerous "--yolo" mode. And if Full Access _is_ required I would like to configure it in config.toml not have to manually configure it every codex session.

What do you see instead?

Github fails to login suggesting the token is invalid.

Additional information

Using gh works in the terminal, works in Claude Code, and I tried manually refreshing my authentication and token permissions using gh auth refresh ... and gh auth login ... but that did not help.

The workaround that does work:

  • run /approvals in codex
  • Change the approval mode to Full Access

Then, Github authentication works as expected:

<img width="964" height="330" alt="Image" src="https://github.com/user-attachments/assets/fab5ef43-d06a-4102-b2ae-285e852d2cc3" />

View original on GitHub ↗

4 Comments

jounih · 9 months ago

still seeing this

gennaro-tedesco · 9 months ago

I have the same problem.

This is yet another fundamental and manifestly evident argument in favour of permissions at tool/command level rather than "always allow" vs "never allow". I still find it hard to believe that codex cannot granularise permissions: this should be a non-problem and a non-argument (and yet there are dozens of similar open issues and discussions on the project).

Configuration must be of the form:

[approval_policy]
grep = "always"
read_files = "always"
gh = "always"
git = "on request"
edit = "never"

and so forth. On the long run lack of such control will set codex miles behind the competition (for example this is a simple reason why I am preferring other vendors to this one, if I cannot even view pull requests without having to find workarounds).

etraut-openai contributor · 7 months ago

If you'd like to allow specific environment variables (like GH_TOKEN) to be visible to tools run by the agent, you can use the shell environment policy config settings.

kylesnowschwartz · 7 months ago

Thanks for your reply @etraut-openai - I don't use Codex anymore, but I feel obligated to point out that my issue specifically outlines that I added

[shell_environment_policy]
inherit = "all"
ignore_default_excludes = true

to the config.toml and I still saw this issue. So your reply of 'Read the docs' isn't the most helpful. Since this issue is from September, perhaps these settings no longer exist or even never existed. At the time the docs were pretty sparse.

I'll leave it to somebody else who still Codex's to push back if they're still seeing this.