Skip to content

Run a Command's sessions on Codex #394

Closed

Description

@JacobStephens2

Parent

#136

What to build

harness codex runs a Command's sessions on Codex. A Run on Codex can go from the implement session through Repairs to a pull request that is ready for review, or merged in a Merge run, just as it does on Claude. See ADR 0012 and docs/research/codex-headless-harness.md.

  • Starting a session. Each session runs codex exec --json --dangerously-bypass-approvals-and-sandbox in the Run's worktree, with stdin set to null (Codex waits for stdin to close).
    • It gets -m <model> and the reasoning-effort config setting when those are set.
    • It also gets the config setting that makes Codex read CLAUDE.md when a repository has no AGENTS.md.
  • Skills. The Factory skills are linked into the worktree under .agents/skills/, hidden through .git/info/exclude, as for Claude. Each Session prompt's first line invokes its skill as $thirdshift-<skill>. The prompts/ page keeps the Claude rendering, with a one-line note on Codex.
  • Reading the stream. Codex's JSONL stream feeds the same behaviour a Claude stream does:
    • the session id comes from thread.started
    • progress lines on stderr come from item.* events (commands, file changes, tool calls), with a session-ended summary
    • the full stream is kept as the Session log
    • the final message is the last agent_message
    • a failed session (turn.failed, or a non-zero exit) fails as a Claude session does, with Codex's error in the cause. A retryable error event alone isn't fatal.
  • Checks before work. The Model and Effort are checked against codex debug models, which costs no tokens.
    • Names match regardless of case, and a display name turns into its slug: GPT-6.1-Sol becomes gpt-6.1-sol, and Max becomes max.
    • The Effort must be one of the levels that Model supports.
    • A failure happens before the Claim, the worktree and any log, and lists the valid choices.
    • The "not supported yet" refusal from the Harness, Model and Effort Ticket goes away.
  • Recording. Recording works as for Claude, with the translated names.

Acceptance criteria

  • With harness codex, a fresh Run's implement session, its Repairs, and a Spec run's Ticket Runs and Spec review all run on codex exec with the bypass flag, the Model and Effort, the CLAUDE.md fallback, and stdin set to null. An Architect run's Architecture review does too.
  • Every thirdshift-* skill is found in the worktree's .agents/skills/, none appears in git status, and each prompt's first line uses $thirdshift-<skill>.
  • Progress lines, the session-ended summary, the Session log and the final message come from Codex's stream.
  • A session that ends in turn.failed or exits non-zero fails the Run with Codex's error in the cause.
  • model GPT-6.1-Sol effort Max reaches Codex as gpt-6.1-sol and max. An unknown Model, or an Effort that Model doesn't support, fails before the Claim, the worktree and any log, naming the valid choices.
  • The fake gains a codex personality: exec --json, debug models from a fixed catalog, and per-test scripts like the fake claude.
  • prompts/ is regenerated, with the Codex note.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions