DaddyNote

UK, Irish and EU money and travel rules, worked through step by step, with the date each figure was checked.

AI how-to notes · 2026-09-17 · last run 2026-09-17 · 한국어 원문

codex exec hangs at "Reading additional input from stdin..." — Windows field test

One line summary

Run codex exec "your prompt" from a script or from an AI agent's background shell and it can print Reading additional input from stdin... and go no further. When stdin is still attached to a pipe, codex waits for that input to finish. In our runs it exited normally as soon as we closed stdin with < /dev/null, or piped the prompt in and passed -.

Symptom

Why it happens

The answer is in the [PROMPT] description of codex exec --help.

[PROMPT]
  Initial instructions for the agent. If not provided as an argument (or if `-` is used),
  instructions are read from stdin. If stdin is piped and a prompt is also provided, stdin
  is appended as a `<stdin>` block

Even when the prompt is given as an argument, if stdin is connected to a pipe codex reads it so it can append the contents as a <stdin> block. If the other end of that pipe never closes, the read never ends.

Test environment

ItemValue
OSWindows 11 Home (10.0.26200)
ShellsGit Bash, PowerShell 7.6.6
codexcodex-cli 0.153.4
PromptReply with the single word OK. (identical in every condition)
Shared options--skip-git-repo-check -s read-only

Six conditions we ran

ConditionShellState of stdinResultTime
AGit BashPipe held open for 90 seconds (sleep 90 |)Killed at the 60-second limit (exit code 124), output file empty60s
BGit BashClosed (< /dev/null)Exit code 0, OK7s
CGit BashPrompt piped in with - (echo "…" | codex exec … -)Exit code 0, OKnot measured
DGit BashPipe that closes after 15 seconds (sleep 15 |)Exit code 0, OK20s
EPowerShell 7Attached to the null deviceExit code 0, OK8s
FPowerShell 7One string piped in, then the pipe endsExit code 0, OK7s

In D the input does not close until the sleep 15 in front of the pipe finishes, and the whole run took 20 seconds and exited normally. That matches the explanation that codex waits for the input to end and then gets on with the work.

B printed the same Reading additional input from stdin... line. Don't read that line alone as a hang — check whether anything happens after it.

Three fixes

1. Close stdin (condition B)

codex exec --skip-git-repo-check "your prompt" < /dev/null

2. Send the prompt on stdin (the same shape as condition C, convenient for long prompts)

codex exec --skip-git-repo-check -o answer.md - < prompt.md

This also spares you from quoting the prompt body as a shell argument. Taking the result into a file with -o, and what to watch out for, is covered separately in Writing codex exec results to a file.

3. Feed extra context through a command that terminates

cat context.txt | codex exec --skip-git-repo-check "Summarize this"

This exact form is not one we ran. Like condition F, the input closes once the command in front of the pipe finishes, so we expect it to end for the same reason. The problem case is when the front of the pipe never finishes (condition A).

What failed

What we did not test

Related notes