Skip to content

Materialize codex credentials β€” auth.json + file-backed cred store - #393

Merged
tildesrc merged 2 commits into
mainfrom
panopticon/codex-auth-json
Aug 24, 2026
Merged

Materialize codex credentials β€” auth.json + file-backed cred store#393
tildesrc merged 2 commits into
mainfrom
panopticon/codex-auth-json

Conversation

@tildesrc

Copy link
Copy Markdown
Contributor

Problem

The codex AgentCLI adapter only checked OPENAI_API_KEY in the container env and wired nothing. Codex authenticates from $CODEX_HOME/auth.json (and may otherwise reach for an OS keyring the container lacks) β€” a bare env var never logs codex in. This was a launch blocker for the codex CLI.

Change

  • New write_credentials seam on the AgentCLI ABC. claude: no-op (it reads its token from the env). codex: pins cli_auth_credentials_store = "file" so codex never uses a keyring, and β€” when auth.json is absent β€” renders it from CODEX_API_KEY / OPENAI_API_KEY in the exact shape codex login --with-api-key writes ({"auth_mode": "apikey", "OPENAI_API_KEY": …}, mode 0600). Idempotent β€” never clobbers an existing login. The launcher calls it after the auth check, before launch, holding no CLI-specific credential shape.
  • auth_missing_detail fix (correctness bug). It now also takes the config dir and passes when any of CODEX_API_KEY / OPENAI_API_KEY / CODEX_ACCESS_TOKEN is set or a pre-existing auth.json sits on the per-task config volume β€” a container already logged in (e.g. carried across respawn) was previously failed on a bare env check. The failure detail names every accepted var. CODEX_ACCESS_TOKEN (the ChatGPT workspace token, claude setup-token analog) is read straight from the env, no file.
  • Docs + docstrings. A "Codex / OpenAI" section in docs/auth.md; fixed the stale "auth β†’ OPENAI_API_KEY" docstrings.

Out of scope: the shared credential-dir mount for rotating ChatGPT subscription tokens (its own subtask).

See the plan.md artifact for the full plan and the review that shaped it.

Panopticon Agent and others added 2 commits August 24, 2026 01:10
The codex adapter only *checked* OPENAI_API_KEY in the env and wired nothing.
Codex authenticates from $CODEX_HOME/auth.json (and may otherwise reach for an
OS keyring the container lacks), so a bare env var never logged codex in β€” a
launch blocker.

Add a `write_credentials` seam to the AgentCLI ABC (claude: no-op; codex:
render auth.json from CODEX_API_KEY/OPENAI_API_KEY in the exact shape
`codex login --with-api-key` writes, 0600, idempotent β€” never clobbering an
existing login β€” and pin `cli_auth_credentials_store = "file"`). The launcher
calls it after the auth check, before launch β€” it holds no CLI-specific
credential shape.

Fix `auth_missing_detail`: it now takes the config dir and accepts any of
CODEX_API_KEY / OPENAI_API_KEY / CODEX_ACCESS_TOKEN *or* a pre-existing
auth.json on the per-task volume (a container already logged in β€” e.g. carried
across respawn β€” was wrongly failed before). The detail names every option.

Document the codex/OpenAI tiers in docs/auth.md and fix the stale
"auth β†’ OPENAI_API_KEY" docstrings.

Out of scope: the shared credential-dir mount for rotating ChatGPT
subscription tokens (its own subtask).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The page opened "Every task runs claude", which is wrong for tasks whose repo
sets agent_cli=codex. Restructure into per-CLI sections: a generalized intro,
"Claude (the default)" wrapping the existing flow, and a first-class
"Codex (tasks whose agent_cli is codex)" section framed as the parallel
per-repo env-file setup (API key or ChatGPT workspace token), plus a codex
rotating-key gotcha (auth.json is cached on the per-task volume). Shared notes
are retitled "both CLIs" with claude-specific items tagged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tildesrc
tildesrc marked this pull request as ready for review August 24, 2026 01:40
@tildesrc
tildesrc merged commit eb75a8a into main Aug 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant