Skip to main content

Install a Codex worker

Status: Ready

Article ID: 043

Truth label: Limited

Audience: Fleet operator

Reader outcome: Register a Codex CLI worker and account for its current output, cost, and session-resume limits.

Related articles: 041, 042, 044

Target week: 17

Last verified: 2026-09-13

Technical reviewer: Codex source audit

Editorial reviewer: Codex editorial audit

Prepare Codex authentication​

Install the Codex CLI and complete its login as the worker account. Confirm the binary is visible to the same non-interactive environment that launches Forge. The adapter uses the CLI's own authentication, not a provider key distributed by Brain.

Start the worker with --engine codex, a stable instance name, and explicit permission defaults and ceiling. Confirm registration advertises codex.

Know the invocation​

The adapter runs codex exec with JSONL output. Safe maps to a read-only sandbox, write maps to workspace-write, and yolo bypasses approvals and the sandbox. Forge folds the persona hint into the prompt because this adapter has no separate system-prompt flag.

Only model names owned by the Codex family are forwarded. Other model names are dropped so the CLI can use its own default instead of receiving an invalid flag.

Read normalized results​

The parser reads thread, item, completion, usage, and failure events. The last agent message becomes the summary. Token counts enter run metadata, but the CLI does not report dollar cost through this contract, so Forge does not invent one.

The returned thread id is the resume handle. A follow-up on the same worker continues the recorded thread with codex exec resume, which takes no sandbox flag of its own, so the permission mapping of the original run is what the resumed turn inherits. The adapter accepts a reasoning effort from minimal to xhigh.

Prove the boundary​

Run one safe task that reads a synthetic file and executes a platform-correct verification command. Confirm JSONL parsing, token metadata, zero fabricated cost, changed-file reporting, and a successful fenced result.

Current limits​

A resumed thread exists only on the worker that recorded it, so keep follow-ups pinned there. Cost is unavailable rather than measured as zero. Read-only and workspace-write are CLI sandbox policies, not full host isolation. CLI versions can add event types, which the parser counts or ignores unless they change the terminal contract; the version each worker reports at registration tells you which contract you are on.

Next lesson​

Continue with Run Codex OSS through Ollama.

Derivative map​

  • Weekly package: WEEK-17
  • Long video: VIDEO-W17-LONG
  • Shorts: SHORT-W17-PROBLEM, SHORT-W17-MECHANISM, SHORT-W17-WARNING
  • Email: EMAIL-W17
  • LinkedIn: LI-W17-A, LI-W17-B
  • X: X-W17-A, X-W17-B
  • Visual: VISUAL-W17

Review record​

  • Authentication, invocation, permission, model, JSONL, usage, cost, and resume behavior checked against current source.
  • Sandbox, version, cost, and fresh-follow-up limits reviewed.
  • Proof task uses safe permission and synthetic data.
  • Internal links and repository voice reviewed.

Review completed: 2026-08-27

Re-audited against the running product: 2026-09-13