codex-handler-doesn

Codex handler doesn't pipe prompt to stdin: every codex agent dies with 'No prompt provided via stdin'

Metadata

Statusdone
Assignedagent-911
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Modelclaude:opus
Created2026-04-28T20:05:48.752478128+00:00
Started2026-04-28T20:06:06.585870720+00:00
Completed2026-04-28T20:35:46.261187319+00:00
Tagseval-scheduled
Eval score0.86
└ blocking impact0.85
└ completeness0.85
└ constraint fidelity0.85
└ coordination overhead0.90
└ correctness0.85
└ downstream usability0.85
└ efficiency0.90
└ intent fidelity0.91
└ style adherence0.95

Description

Description

Every wg task dispatched with --model codex:* fails immediately. Reproduced today on create-agents-md (agent-908): codex CLI was spawned, sat reading stdin, got nothing, exited 1.

Verbatim from /home/erik/workgraph/.wg/agents/agent-908/output.log:

Reading prompt from stdin...
No prompt provided via stdin.
[wrapper] Agent exited with code 1, marking task failed

The prompt file IS being written by the dispatcher (see /home/erik/workgraph/.wg/agents/agent-908/prompt.txt — confirm it has content). The bug is between prompt.txt and the codex subprocess: the handler is launching codex without redirecting prompt.txt onto its stdin, OR codex needs a different invocation shape (-p <file>, --prompt-file, or pasted as argv) that the handler isn't using.

This is the FIRST live test of the codex handler — it appears the handler was wired in but never exercised against a real task. Whatever the gap is, it's been latent.

Suggested investigation order

  1. Look at src/dispatch/handler_for_model.rs and whichever module implements the codex handler (likely src/dispatch/handlers/codex.rs or similar — grep for codex CLI invocation).
  2. Compare to the claude handler (which works): how does it pass the prompt to claude CLI? stdin redirect? arg? Mirror that pattern.
  3. Check codex CLI's actual invocation contract — codex --help on the user's installed binary will show whether it expects stdin, -p, or argv.
  4. Wire the prompt through whichever channel codex actually wants.
  5. Live smoke against a fresh tiny task on codex:gpt-5.5 — agent must read the prompt, do the work, exit 0.

Bonus (probably trivial once the main fix lands)

After fixing, run wg retry create-agents-md to unblock the existing smoke pipeline (smoke-test-confirm is queued behind it and will run automatically once create-agents-md goes done).

Out of scope

  • Fixing AGENTS.md content / formatting (that's the smoke task itself, will run after this lands)
  • Adding new codex-only features (model resolution, env vars, etc) beyond what's needed for the prompt to reach the agent
  • Codex tier mapping / profile switching (separate design discussion in flight)

Validation

  • Reproduce: dispatch a trivial task with --model codex:gpt-5.5 against current main, confirm 'No prompt provided via stdin' in output.log
  • Failing test first: a unit/integration test that exercises the codex handler's prompt-passing path; asserts the prompt content reaches the subprocess (mock the subprocess, assert what stdin/argv it was given)
  • Implementation makes the test pass
  • Live smoke: wg add 'echo hello in a comment' --model codex:gpt-5.5 (or similar trivial task), agent runs to completion, exits 0, prompt content was visible to the agent
  • wg retry create-agents-md succeeds end-to-end, AGENTS.md is created, smoke-test-confirm runs and reports the AGENTS.md content correctly
  • cargo build + cargo test pass with no regressions
  • No regression on claude handler — wg add ... --model claude:opus still works

Depends on

Required by

Log