fix(engine): retry Codex WebSocket transport drops as transient

pi-ai's openai-codex-responses provider surfaces ChatGPT-plan WebSocket
drops as bare "WebSocket error" / "WebSocket closed <code>". The
underlying ErrorEvent.error is dropped by extractWebSocketError (it only
inspects event.message), so the cause is gone by the time we see it.
The engine then propagated these as fatal failures instead of retrying
a transient network blip.

- Add WebSocket patterns to TRANSIENT_ERROR_PATTERNS so the executor's
  existing transient retry path picks them up.
- Tag the model id onto the thrown error and emit a structured warn in
  promptSessionAndCheck so future drops can be triaged by transport.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-04 23:57:40 -07:00
parent f7afe31220
commit e5fc71b6eb
4 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Treat pi-ai Codex WebSocket transport drops (`WebSocket error`, `WebSocket closed …`, `WebSocket stream closed before response.completed`) as transient errors so the engine retries them instead of marking the task failed. Tag the model id onto the thrown error and emit a structured warn so future drops can be triaged by which provider/model is unstable.