Urgent.News

What's breaking now, across thousands of outlets.

Tech

Works in the Terminal, Hangs When Called by an Agent: The codex exec stdin Trap

I called codex exec from an AI agent's tool runner, and no response ever came back. The hang I observed lasted more than 10 minutes. The prompt was passed as an argument, and there was nothing wrong with the command itself. When you type the command by hand, stdin is connected to your terminal, so the wait never happens. The difference is how the caller connects stdin. This post is for anyone who…

I attempted to use codex exec from an AI agent's tool runner, but the process never responded. The delay lasted over ten minutes, even though the command itself was correct. When the command is entered manually, stdin is connected to the terminal, so there is no wait. The difference lies in how the caller connects stdin. This guide is for anyone running codex exec from scripts, CI, other programs, or AI agents. If you only use it from a terminal, you can skip it.

The cause of the issue lies in the way stdin is handled. In my environment (Codex CLI 0.164.0), the agent's execution environment was passing codex exec a pipe as stdin. The official documentation specifies that when stdin is piped and a prompt argument is provided, the argument is treated as the instruction, and the piped input is considered additional context. To ensure the entire stdin is the prompt, omit the argument or use codex exec -.

The hang occurs when EOF never arrives, and Codex thinks additional context is still coming. This results in the process waiting indefinitely. There is no mention of this hang or workaround in the official documentation.

To resolve the issue, the stdin must return EOF immediately. In my environment, I redirected stdin from /dev/null, and a high-effort consultation task finished in about 13 seconds. Now, I append /dev/null to every call from this environment. Codex will then decide there is no additional context and move on. Piping input is not inherently problematic; the issue arises when stdin remains open when no input is intended.

The solution varies depending on the caller:

1. For direct terminal input, no additional changes are needed.

2. For scripts, check how stdin is connected. If no input is planned, add /dev/null. If input is planned, explicitly use a pipe.

3. When launching codex exec as a child process, check the stdin setting of the API used. If no input is planned, point stdin at /dev/null or close it immediately after launch. If input is passed, ensure it is closed after writing.

4. For AI agents' tool runners, always append /dev/null to any codex exec call that does not pass input on stdin. Include this in runbooks or instructions to prevent forgetting.

5. If input is intentionally supplied on stdin, distinguish between providing an instruction + additional context and using the entire stdin as the prompt. Omit the argument or use codex exec - to make the whole of stdin the prompt.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Loopscale: Pricing Misconfig and NAV Loan Exploit

Originally published at Loopscale: Pricing Misconfig and NAV Loan Exploit On 5 November 2026 , Loopscale — a Solana order-book lending protocol built around fixed-rate, overcollateralized credit…

  • Loopscale halted operations due to malicious API traffic campaign
  • Pricing misconfiguration in SOL Genesis Vault led to $412K undercollateralized loan
  • USDC Genesis Vault NAV inflation attempt prevented $521K disproportionate redemption

Wie man in Python Stille aus einer Aufnahme entfernt, ohne Wörter abzuschneiden

Pausen aus einer Sprachaufnahme zu entfernen, läuft auf vier Zahlen hinaus: einen Pegel, unter dem Audio als still gilt, wie lange ein leiser Abschnitt mindestens dauern muss, bevor er entfernt wird…

  • Sound Editor app displays these values with default settings of −48 dB, 50 ms, 5 ms, and 20 ms
  • ffmpeg's silenceremove tool behaves differently at hard-to-notice spots, requiring careful handling

Emit an isometric cube as three SVG polygons and test its shared edges

First published on Homingo Learn . An isometric cube is three polygons that have to meet along identical edges, and a vertex that is off by even one user unit can leave a gap or an overlap. This script emits the three faces with integer coordinates and checks the edges before you trust the SVG.

  • Three SVG polygons construct isometric cube
  • Points labeled C, T, B, UR, LR, LL, UL
  • Script validates shared edges before output

More from Friday 6 November →