Skip to content

OpenAI Responses WebSocket hangs after a top-level error event #50848

Closed

Description

@sdivyanshu90

Description

The native OpenAI Responses WebSocket route emits a provider-error for a top-level error event but never completes the response stream. The same transport completes normally for response.failed.

packages/llm/src/protocols/openai-responses.ts handles both event types, but TERMINAL_TYPES only includes response.completed, response.incomplete, and response.failed. Because a Responses WebSocket remains open between requests, waiting for the socket to close leaves LLMClient.stream() and LLMClient.generate() pending indefinitely after an API error.

Expected: a top-level error event emits its provider-error and terminates the current response stream.

Plugins

None

OpenCode version

dev (18ef3cc7c5, package version 1.18.32)

Steps to reproduce

  1. Configure the OpenAI Responses WebSocket route with an in-memory socket.

  2. After response.create, send this frame and keep the socket open:

    {"type":"error","code":"rate_limit_exceeded","message":"Rate limit reached"}
  3. Collect LLMClient.stream() with a timeout.

  4. Observe provider-error(rate_limit_exceeded: Rate limit reached), followed by a timeout because the stream remains open.

  5. Replace the frame with {"type":"response.failed","response":{"error":{"code":"server_error","message":"boom"}}} and observe that the stream ends immediately.

This reproduces without a network request.

Screenshot and/or share link

N/A

Operating System

Linux

Terminal

N/A (in-process reproduction)

Activity

  1. rekram1-node commented on Oct 14, 2026

    @rekram1-node
    Contributor

    This would only happen in the experimental protocol for v1, if u update to v2 it is fixxed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions