codex is the runtime that drives OpenAI’s codex exec CLI: Clawboo installs the codex binary, spawns it per board task in an isolated home, and reshapes its --json event stream into the normalized RuntimeEvent stream every other runtime emits. It is one of the five runtimes, a co-equal peer beside openclaw, clawboo-native, claude-code, and hermes.
Codex differs from the other CLI runtimes in two ways that matter operationally: it authenticates through an interactive ChatGPT OAuth login (codex login), not a pasted API key; and it reports no USD cost, so spend is surfaced as token usage with an explicitly estimated, null dollar figure. Because the credential is a ChatGPT account, Codex is also the runtime a ChatGPT-subscription user without any API key runs their whole team on: the onboarding wizard’s OpenAI card offers Sign in with ChatGPT (Recommended, the economical path), deploys every agent on Codex, and designates a Codex agent as the team’s universal leader. Use this page to understand its capabilities, how to install and connect it, how the driver works, and how a Codex agent leads a team.
Authentication posture. Clawboo only ever drives OpenAI’s official CLI, whether you run
codex login yourself in a terminal or click Sign in with ChatGPT and let Clawboo’s local server spawn that same command for you. It never performs the OAuth exchange itself, never reads or refreshes the token, and never calls the ChatGPT backend directly: the CLI does its own auth and you authorize in your own browser on OpenAI’s page.What it is
Codex is a wrapped one-shot runtime. It is a thin RuntimeAdapter (@clawboo/adapter-codex) constructed with a per-run driver factory; the real driver spawns codex exec --json as a black-box subprocess, parses its stdout JSON-lines stream best-effort into the adapter’s CodexNativeEvent union, and tears it down at the end of the task. The runtime differences live entirely in the mapper and the driver; the adapter’s trait surface is identical to Claude Code’s.
Two properties shape the whole runtime:
- Whole-block text becomes a synthesized stream. Whether Codex emits incremental
output_text.deltaframes or oneagent_messageblock per turn is its choice; the driver maps either form to atextnative event, and the mapper turns that into atext-deltaRuntimeEvent. A block-emitting Codex still surfaces as a (single, synthesized) text-delta; the adapter declaresstreaming: trueregardless. - No USD cost. Codex carries token
usagebut reports no dollar figure. Aresultwith usage therefore yields acostevent withcostUsd: nullandestimated: true, never a concrete USD, the honest signal that the host’s budget kill-switch sees usage but cannot price the run.
Codex is a peer, not a substitute. Clawboo never migrates a
codex agent into any other runtime’s agent (or vice versa); the adapter package ships no cross-runtime agent-file mapping. A team can mix a Codex specialist with agents on any other runtime.Capabilities
The Codex adapter reports the following capabilities. Callers branch on these (never on the runtime id), so they describe what the host may do with a Codex run.
Because
nativeHome is { scope: 'per-identity', persist: true }, the integration planner materializes a persistent managed CODEX_HOME per agent under Clawboo’s own state dir, which is what makes session resume work: Codex writes its session files there, and a later run can resume them. Your real ~/.codex is never the run home; the driver seeds a copy of its auth.json into the managed home (see authentication). The shared plane (board, memory, tools) is reached through MCP.
How to install and connect
The install/connect/disconnect mechanics are shared with the other CLI runtimes and run from the Runtimes panel; see Connecting runtimes for the card UI, the encrypted vault, and the resolution chain. The Codex specifics are below.1. Install the CLI
Codex is installed via npm. From thenot-installed state, the card opens POST /api/runtimes/codex/install, a Server-Sent Events stream that runs:
0.x major so a future 1.0 is never auto-installed. If npm is not found, the stream emits an error event with code NPM_MISSING. The runtime’s health binary is codex, resolved by resolveRuntimeBin over PATH plus the well-known user-install dirs.
2. Authenticate with codex login (OAuth)
This is where Codex departs from the other api-key runtimes. Codex authenticates via an interactive ChatGPT OAuth flow, and it cannot be connected with a pasted API key on current versions. The descriptor declares authKind: 'oauth', envVar: null, and headlessAuth: false; there is no vault slot for a Codex credential.
POST /api/runtimes/codex/connect is therefore a no-op on storage. It probes the login (codex login status) and returns the CURRENT state, plus the terminal login command when one is still needed:
codex login for you (POST /api/auth/cli-login/codex, an SSE stream that relays the CLI’s own user-facing output), the CLI opens your browser and waits on its localhost callback, and you approve there, with nothing to type. When the login lands, the server re-probes the real auth store and the card re-checks itself. If the CLI is missing, the platform is unsupported, or the spawn fails, the card degrades to the copyable codex login command: run it in your own terminal, then click Re-check. The status probe DETECTS an existing login (codex login status is parsed, never the token file), so a user who signed in before ever opening Clawboo reads ready immediately. Once signed in, every spawned run gets a managed CODEX_HOME seeded with a copy of your ~/.codex/auth.json (copy-only, freshness-checked so a rotated refresh token in the managed home is never clobbered; the real ~/.codex is never written). Clawboo never stores a Codex credential in its vault, and disconnect is likewise a no-op for Codex.
The connection state machine reflects this: an installed
oauth runtime reads ready when the login probe detects a signed-in Codex, needs-login otherwise; it never reaches ready from a vault key.3. Run a board task
POST /api/runtimes/codex/run drives a board task on Codex end to end: claim → worktree → run → report-up. The driver:
- Uses the managed per-agent
CODEX_HOME(created0700on first run; a run with no agent identity falls back to a throwawaymkdtemphome). - Seeds a copy of your
~/.codex/auth.jsoninto the managed home if the managed copy is missing, unusable, or older than yours (Codex rotates refresh tokens inside the managed home, so a blind re-copy would break it). No usable auth anywhere and no API key → the run fails fast withno Codex credentials provisionedinstead of sending an unauthenticated request. - Writes a
config.tomlpointing Codex’s MCP client at this server’s hosted Tasks, Memory, Tools, and TeamChat servers (the run’s memory scope is appended to the Memory server’s URL only). - Spawns
codex exec --json --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check [--model <m>] <prompt>— orcodex exec resume <session-id> …when a resume handle is provided — withCODEX_HOMEset and a process-group leader so the whole tree can be killed on abort.
How the driver works
The Codex driver builds on the shared subprocess substrate that all spawned runtimes use. It buffers native events until the adapter subscribes (so frames emitted betweenstart() and the first listener are never dropped), parses stdout line by line, and always synthesizes a terminal result on process exit; so a run’s lifecycle completes even if mid-stream parsing missed the completion event.
Event translation
Each stdout line is JSON-parsed and run through a tolerant translator that handles shape drift.codex exec wraps events as { id, msg: { type, ... } }, so the parser reads the inner msg when present:
The terminal result
If the stream never produced a result, the driver synthesizes one when the process exits, derived from the exit code and signal:
- A clean exit (
code === 0) →resultwithok: true. - A deliberate abort kills the process with
SIGTERM/SIGKILL(exit codenull) →resultwithaborted: true, mapped to a cleandone: abortedterminal rather than a spurious error. - Any other non-zero exit →
resultwithok: falseanderrorMessagefrom stderr (orcodex exited with code <n>).
onClose from both the error and close events, so the driver marks the terminal as synthesized and a second call returns nothing, never two result terminals.
The cost mapping
Codex reports token usage but no USD, so the pure mapper translates aresult with usage into a cost event with costUsd: null and estimated: true. The accompanying done event also carries costUsd: null. This is the deliberate asymmetry versus the runtimes that report real dollars; the host gets honest usage counts and an explicit “not priced” signal instead of a fabricated cost.
Session resume
The adapter defines asessionCodec and the driver captures Codex’s session id from the event stream. On a later run the host passes it back as codex exec resume <session-id>, so the run continues the SAME Codex session (its transcript lives in the managed CODEX_HOME). This is what gives a Codex team LEADER conversation continuity: each leader turn resumes the previous one via a per-agent-per-team resume pointer, exactly like the native leader. A cross-runtime pickup still rides the prose handoff note in the worktree like any other runtime, and a resume attempt against a stale id self-heals (the failed run clears the pointer, the next turn starts fresh).
Leading a team
A Codex agent can be a team’s universal leader, which is what makes the ChatGPT-subscription onboarding work end to end (no native key, no Gateway — nothing else can lead):- Delegation is a tool call. Team-orchestrated Codex runs attach a
team_delegateMCP tool (hosted on the TeamChat server, bound to the run’s team). The orchestration engine observes the tool call by NAME and turns it into a real board task — the same signal path every runtime’s leader uses. The tool is attached ONLY on orchestrator-driven team runs, so it can never silently no-op elsewhere. - The leader is taught per turn. A coding-runtime leader turn carries a coordination block that teaches
team_delegate(answer simple questions directly, delegate real work, one summary after results) — injected in the volatile per-turn context, so it reaches existing agents too. - Designation is explicit. A Codex-preferred deploy designates the lead and promotes it to the universal Boo Zero via
POST /api/boo-zero/override(only when nothing else resolves — an existing native or OpenClaw Boo Zero is never stomped).
Verify it worked
GET /api/runtimesshould show thecodexentry withinstalled: trueonce the CLI resolves,authKind: "oauth",envVar: null, andconnectionState: "ready"when you are signed in (needs-loginotherwise). It never readsreadyfrom a stored vault key.- A successful Sign in with ChatGPT re-checks the card for you. After the manual fallback (
codex loginin your own terminal), click Re-check in the card to re-probe. - Run a board task via
POST /api/runtimes/codex/run. A clean run returnsdoneReason: 'success'withcostUsd: nullandusedWorktree: true.
Troubleshooting
Related
- Connecting runtimes: the install/connect/disconnect lifecycle and the encrypted vault
- Runtimes overview: the capability matrix across all five runtimes
/api/runtimesreference: full request/response shapes for connect, run, and the install SSE stream- The board: the durable task substrate a Codex run drives
- Worktrees and handoff: the isolated world a Codex task carries
- Claude Code · Clawboo Native · Hermes: the sibling runtimes — Hermes and OpenClaw can ALSO run on the same ChatGPT subscription (each via its own
openai-codexlogin) - Environment variables:
CLAWBOO_HOME,CLAWBOO_SECRETS_MASTER_KEY