Summary
Handle a Codex WebSocket failure that occurs mid-stream (after the first token) by degrading gracefully instead of erroring. Today a WS failure before streaming falls back to HTTP transparently, but a failure mid-stream surfaces as an error SSE event to the client.
Why
The pre-stream fallback already proves the HTTP path is a valid backstop. A socket that drops mid-turn (idle eviction race, backend hiccup, network blip) currently turns a recoverable transport failure into a user-visible error, even though the request could be retried over HTTP (or the WS reconnected and continued via previous_response_id). This is the one WS failure mode that isn't yet covered.
See docs/comparison.md §6 item C.
Tasks
Evidence
src/adapters/responses.rs:92-135 (pre-stream fallback; mid-stream surfaces as error SSE at :554)
src/adapters/codex_ws.rs:110-112 (pool invalidation on error)
Related
- Comparison:
docs/comparison.md
- Sibling WS items: live-probe normalization, speculative prewarm
Summary
Handle a Codex WebSocket failure that occurs mid-stream (after the first token) by degrading gracefully instead of erroring. Today a WS failure before streaming falls back to HTTP transparently, but a failure mid-stream surfaces as an error SSE event to the client.
Why
The pre-stream fallback already proves the HTTP path is a valid backstop. A socket that drops mid-turn (idle eviction race, backend hiccup, network blip) currently turns a recoverable transport failure into a user-visible error, even though the request could be retried over HTTP (or the WS reconnected and continued via
previous_response_id). This is the one WS failure mode that isn't yet covered.See
docs/comparison.md§6 item C.Tasks
previous_response_idwhen the turn is resumable, or (b) restart the turn over HTTP. Note that tokens already emitted to the client constrain (b) — spec out the correct behavior (e.g. only fall back if nothing was streamed yet, else surface a clean error).invalidate_pool_keyis hit on this path).Evidence
src/adapters/responses.rs:92-135(pre-stream fallback; mid-stream surfaces as error SSE at:554)src/adapters/codex_ws.rs:110-112(pool invalidation on error)Related
docs/comparison.md