fix: pipe and close stdin for codex to prevent hang on stdin read

When codex exec receives a prompt as a positional argument, it still
tries to read additional input from stdin (prints 'Reading additional
input from stdin...'). With stdio stdin set to 'ignore' or default,
codex blocks indefinitely waiting for stdin that never comes.

Fix: use stdio ['pipe', 'pipe', 'pipe'] and immediately close stdin
via child.stdin.end() in both execute.ts (sync) and jobs.ts (async).
This signals EOF to codex so it proceeds with the positional prompt.
This commit is contained in:
2026-05-20 13:47:32 -05:00
parent afac143cb3
commit 017eb1b410
2 changed files with 8 additions and 1 deletions
+4
View File
@@ -77,8 +77,12 @@ export async function executePrompt(
const child = spawnImpl(command, args, {
shell: false,
stdio: ["pipe", "pipe", "pipe"],
});
// Close stdin immediately so clients like codex don't hang waiting for input
child.stdin?.end();
child.stdout?.on("data", (chunk: Buffer | string) => {
stdout += chunk.toString();
});