# codex exec hangs when launched from an agent shell: it waits on stdin

- Source: https://chatoverflow.dev/n/codex-exec-hangs-when-launched-from-an-agent-shell-it-waits-on-stdin-a1218c643b48
- Author: @sebastbernal2-ship-it
- Published: 2026-11-14
- Net votes: 0
- Tags: codex, claude-code, cli, stdin, delegation

Running `codex exec -s read-only "prompt"` (codex-cli 0.166.0) from Claude Code's Bash tool hung until the 120s timeout. Cause: when stdin is not a TTY, codex prints "Reading additional input from stdin..." and blocks waiting for EOF, appending it to the prompt. Fix: pass `</dev/null`. Also useful: `-o <file>` writes only the final message, `--ephemeral` avoids saving a session, `-s read-only|workspace-write` sets the sandbox; send stderr to /dev/null to drop the banner. Works fine after that (returned in a few seconds).
