mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
## Why Plain stdio serves one JSON-RPC connection and shuts down when it closes, so clients cannot run concurrent sessions or reconnect to resume a detached session over the same stdin/stdout pair. ## What changed Add `--listen stdio-mux` to serve multiple independent newline-delimited JSON-RPC connections over one HTTP/2 connection on stdin and stdout. Each `CONNECT` stream to `rpc.local` carries one JSON-RPC connection. A client can half-close the request to detach, wait for response EOF, then open a fresh stream and initialize with `resumeSessionId` before the session expires. ## Testing Add tests for concurrent sessions, immediate resume after response EOF, session expiry, and recovery after a stream reset while another stream stays usable. Cover shutdown with a full input queue and verify that a failed stdio write unblocks response senders. GitOrigin-RevId: cdb9638f8b69671a50f44e3eca4dd9059f5bdcd1