OpenAI Codex CLI
Operating Codex on workers — sign-in, the workspace-write sandbox, thread resume, add-on models through the Responses API, and troubleshooting.
Sign-in
Sign in to Codex once as the worker's user, with its ChatGPT login or an API key as Codex supports.
How it runs
codex exec --json --sandbox workspace-write --skip-git-repo-check, with -m <model> when a model is chosen.
The runtime closes stdin after start, because Codex reads extra input from a piped stdin. After a crash the task
resumes the recorded thread with codex exec resume <thread_id>.
Add-on models
Codex reaches add-on models through a custom model_provider that points at the worker's model gateway, using
the Responses API (Codex no longer supports wire_api = "chat").
Troubleshooting
- "unexpected argument '--full-auto'" comes from older adapters; current workers use
--sandbox workspace-write. - Shell commands "blocked by policy": Codex's own sandbox refused them (seen in a Windows test through the gateway). Check Codex's sandbox settings for the worker user.
- Multi-repository projects never reach Codex: Codex cannot work in several directories.