Skip to content

Windows sandboxed sessions cannot access valid gh keyring auth that works in full-access mode #21821

@OnerrotRamo

Description

@OnerrotRamo

Description

On Windows, gh auth status fails in a sandboxed Codex shell session with an invalid token error, but succeeds in a full-access session on the same machine for the same user and the same gh binary.

This appears to be a sandbox/session integration issue with Windows Credential Manager or keyring visibility, not a GitHub CLI auth problem.

Environment

  • OS: Windows
  • Codex CLI: 0.129.0-alpha.15
  • GitHub CLI installed and already authenticated
  • gh binary path in both contexts: C:\Program Files\GitHub CLI\gh.exe

Steps to reproduce

  1. Authenticate GitHub CLI on Windows:

    gh auth login -h github.com
  2. Confirm auth works in a normal or full-access context:

    gh auth status
  3. Run the same command from a sandboxed Codex shell session:

    gh auth status
  4. Compare diagnostics in both contexts:

    where.exe gh
    cmdkey /list

Expected behavior

A sandboxed Codex session should be able to use the same valid GitHub CLI login as a full-access session for the current Windows user.

gh auth status should succeed in both contexts.

Actual behavior

In the sandboxed session:

github.com
  X Failed to log in to github.com account <account> (default)
  - Active account: true
  - The token in default is invalid.

In the full-access session:

github.com
  ? Logged in to github.com account <account> (keyring)

Additional difference:

  • In sandboxed session, cmdkey /list did not show the expected GitHub CLI credential targets.
  • In full-access session, cmdkey /list showed entries like:
    • LegacyGeneric:target=gh:github.com:<account>
    • LegacyGeneric:target=gh:github.com:

Notes

  • The same gh binary was used in both contexts.
  • GitHub CLI host metadata was present at %APPDATA%\GitHub CLI\hosts.yml.
  • This looks like the sandboxed session cannot access the same Windows credential/keyring context that full-access can.

Impact

This breaks GitHub-dependent Codex workflows on Windows in sandboxed mode even when gh auth is valid outside sandbox.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIauthIssues related to authentication and accountsbugSomething isn't workingsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions