Files
Tomu Hirata d20c465457 fix(codex): serialize stdin writes to prevent parallel tool-call interleaving (#5229)
When Codex emits parallel tool calls, the harness processes them
sequentially but _send_message's write+drain sequence is not atomic:
a concurrent caller can write() between another caller's write() and
drain(), interleaving bytes on the subprocess stdin pipe.  The Codex
app-server then reads a corrupted JSON-RPC line, drops the response,
and the remaining tool outputs never arrive — causing the turn to stall
for minutes before timing out.

Fix: guard _send_message with an asyncio.Lock (_stdin_lock) so that
the write/drain pair is always atomic.  The lock is initialized in
__init__ alongside the other per-session state.

Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
2026-08-21 22:24:09 +00:00
..
2026-06-13 00:37:34 +00:00
2026-06-13 00:37:34 +00:00
2026-06-13 00:37:34 +00:00
2026-06-13 00:37:34 +00:00
2026-06-13 00:37:34 +00:00
2026-06-13 00:37:34 +00:00
2026-06-13 00:37:34 +00:00