mirror of
https://github.com/openai/codex.git
synced 2026-11-10 21:00:47 +00:00
## Why `write_stdin` inherited serial tool dispatch, so long polls for independent unified-exec sessions blocked each other even when the caller used parallel tool calls or code-mode `Promise.all`. The useful boundary is the terminal process: independent sessions should overlap, while operations sharing one process must not overlap because they mutate stdin, drain one output buffer, and observe the same lifecycle. ## What changed - opt `write_stdin` into parallel tool dispatch - guard each unified-exec process with a process-local interaction mutex while allowing different process IDs to overlap - treat a held interaction mutex as a pruning reservation so parallel `exec_command` calls cannot evict an actively polled process - revalidate process identity after waiting for that mutex so a stale waiter cannot redirect input to a replacement process - add direct non-code and code-mode integration coverage using a symmetric rendezvous: both sessions can finish only if their `write_stdin` calls overlap This does not add a source-order contract for calls targeting the same session. Their interactions are mutually exclusive, but callers must not depend on which concurrent call acquires the process mutex first. ## Testing - `just test -p codex-core write_stdin` (13 passed) - `just fix -p codex-core`