Skip to content

feat(compose): persist the Codex (ChatGPT subscription) login across recreates - #155

Merged
cryptolir merged 2 commits into
mainfrom
feat/codex-home-persist
Sep 7, 2026
Merged

cryptolir merged 2 commits into
mainfrom
feat/codex-home-persist

Conversation

@cryptolir

Copy link
Copy Markdown
Owner

Why

openclaw reads the OpenAI Codex OAuth credential from $CODEX_HOME/auth.json (default ~/.codex, see src/agents/cli-credentials.ts resolveCodexHomePath). In a gateway container that path is not a mount — only /home/node/.openclaw and its workspace are bound — so a login done inside the container is gone on the next recreate or redeploy.

Change

One env entry in both service blocks (same rule as every other allowlisted key):

CODEX_HOME: /home/node/.openclaw/.codex

Inside the config-dir bind, so the login persists on the host with the agent's other state. Hardcoded rather than ${CODEX_HOME:-} because it is not a secret and is the same for every agent — and because that keeps it out of docker.env, so the daily OB-22 drift check (docker.env key ⇄ container env) has nothing to compare.

Verified

  • docker compose config renders CODEX_HOME in both services.
  • No other file touched. .codex/ is created by the login itself, under uid 1000, which owns the config dir.

Rollout

Owner merge → git pull /opt/openclaw on 2ndClaw → docker compose -p projectmanager --env-file … up -d --force-recreate openclaw-gateway (plain up -d is a no-op) → owner runs the login inside the container. Other agents pick it up at their next recreate; it is inert until someone logs in.

Context

Found moving projectmanager to openai-codex/*: no login present, both gpt-5.1-codex-mini and gpt-5.3-codex refused by OpenAI, and the Venice fallback did not engage — the refusal comes back as a 200-shaped reply body, which the failover path does not treat as a failure. That second point is a separate finding, not addressed here.

🤖 Generated with Claude Code

Liran Peretz and others added 2 commits September 7, 2026 17:42
…recreates

openclaw reads the OpenAI Codex OAuth credential from $CODEX_HOME/auth.json,
defaulting to ~/.codex. Inside a gateway container that path is not a mount,
so a login done via `openclaw models auth login` disappears on the next
recreate or redeploy and the operator has to sign in again.

Set CODEX_HOME to /home/node/.openclaw/.codex in both service blocks, inside
the config-dir bind, so the login lives on the host with the rest of the
agent state. Not a secret and identical for every agent, so it is hardcoded
rather than routed through docker.env — which also keeps it out of the
OB-22 docker.env-vs-container drift check.

Found while moving projectmanager to openai-codex/*: no login was present,
both gpt-5.1-codex-mini and gpt-5.3-codex were refused by OpenAI, and the
Venice fallback did not engage because the refusal arrives as a normal
reply body, not a failed request.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@cryptolir
cryptolir merged commit a7ada83 into main Sep 7, 2026
15 of 20 checks passed
@cryptolir
cryptolir deleted the feat/codex-home-persist branch September 7, 2026 17:46
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