[FEATURE] CODEX_HOME should support shared auth with isolated config/skills
Resolved 💬 2 comments Opened Mar 21, 2026 by chriscoey Closed Mar 21, 2026
Problem
When using CODEX_HOME to isolate config and skills for programmatic eval/CI use cases, authentication breaks because auth.json cannot be reliably copied or symlinked between the real ~/.codex/ and the custom CODEX_HOME.
The root cause: OAuth refresh tokens in auth.json are single-use. When the real Codex instance refreshes the token, any copy becomes invalid. This makes CODEX_HOME unusable for config isolation while maintaining ChatGPT subscription auth.
Use case
Running eval experiments where each agent run needs:
- Isolated config: no personal MCP servers, hooks, or settings
- Custom skills: only specific skills installed (to A/B test skill effectiveness)
- Shared auth: still uses the user's ChatGPT subscription (no separate API key billing)
- Non-interactive:
codex execin automation
Current behavior
- Set
CODEX_HOME=/tmp/eval_homewith minimalconfig.tomland customskills/ - Copy
auth.jsonfrom~/.codex/auth.json - First run may work (uses cached access token)
- Subsequent runs fail with 401 if the real Codex refreshed the token, invalidating the copy
Proposed solution
Either:
- Auth fallback: when
CODEX_HOMEis set andauth.jsonis missing or invalid, fall back to~/.codex/auth.jsonfor authentication only (not config/skills) - Auth symlink support: detect and follow symlinks for
auth.jsonso both paths read the same file - Separate auth path:
CODEX_AUTH_HOMEor--auth-fromflag to specify where auth is read from, independent ofCODEX_HOME
Related issues
- #14330 (environment isolation — wants fully separate auth per env)
- #3820 (headless auth for ChatGPT plans)
- #6036 (refresh token single-use invalidation)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗