Skip to content

Stabilize websocket response.failed error delivery#14017

Merged
aibrahim-oai merged 11 commits intomainfrom
dev/ws-terminal-error-split
Mar 11, 2026
Merged

Stabilize websocket response.failed error delivery#14017
aibrahim-oai merged 11 commits intomainfrom
dev/ws-terminal-error-split

Conversation

@aibrahim-oai
Copy link
Collaborator

What changed

  • Drop failed websocket connections immediately after a terminal stream error instead of awaiting a graceful close handshake before forwarding the error to the caller.
  • Keep the success path and the closed-connection guard behavior unchanged.

Why this fixes the flake

  • The failing integration test waits for the second websocket stream to surface the model error before issuing a follow-up request.
  • On slower runners, the old error path awaited ws_stream.close().await before sending the error downstream. If that close handshake stalled, the test kept waiting for an error that had already happened server-side and nextest timed it out.
  • Dropping the failed websocket immediately makes the terminal error observable right away and marks the session closed so the next request reconnects cleanly instead of depending on a best-effort close handshake.

Code or test?

  • This is a production logic fix in codex-api. The existing websocket integration test already exercises the regression path.

@aibrahim-oai aibrahim-oai requested a review from pakrym-oai March 9, 2026 00:59
@aibrahim-oai aibrahim-oai merged commit 3f7cb03 into main Mar 11, 2026
31 checks passed
@aibrahim-oai aibrahim-oai deleted the dev/ws-terminal-error-split branch March 11, 2026 00:59
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants