Materialize codex credentials β auth.json + file-backed cred store - #393
Merged
Conversation
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
marked this pull request as ready for review
August 24, 2026 01:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The codex
AgentCLIadapter only checkedOPENAI_API_KEYin 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
write_credentialsseam on theAgentCLIABC. claude: no-op (it reads its token from the env). codex: pinscli_auth_credentials_store = "file"so codex never uses a keyring, and β whenauth.jsonis absent β renders it fromCODEX_API_KEY/OPENAI_API_KEYin the exact shapecodex login --with-api-keywrites ({"auth_mode": "apikey", "OPENAI_API_KEY": β¦}, mode0600). Idempotent β never clobbers an existing login. The launcher calls it after the auth check, before launch, holding no CLI-specific credential shape.auth_missing_detailfix (correctness bug). It now also takes the config dir and passes when any ofCODEX_API_KEY/OPENAI_API_KEY/CODEX_ACCESS_TOKENis set or a pre-existingauth.jsonsits 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-tokenanalog) is read straight from the env, no file.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.mdartifact for the full plan and the review that shaped it.