Skip to content

fix(ai): reject WebSocket transport for OpenAI Chat #40655

Closed

Description

@opencode-agent

Problem

The OpenAI Chat provider entrypoint shares Settings with the Responses entrypoint, so it accepts transport: "websocket". However, chatModel() ignores settings.transport and always selects configure(config(settings)).chat(modelID), whose /v1/chat/completions route uses HTTP/SSE.

This makes a WebSocket selection on @opencode-ai/ai/providers/openai/chat silently behave like the default transport. OpenAI documents persistent WebSocket mode for the Responses API, not Chat Completions:

https://developers.openai.com/api/docs/guides/websocket-mode

Relevant code

  • packages/ai/src/providers/openai.ts: shared Settings.transport and chatModel()
  • packages/ai/src/providers/openai/chat.ts: exports chatModel as model
  • packages/ai/src/protocols/openai-chat.ts: HTTP/SSE Chat route

Expected behavior

Make unsupported transport selection impossible or explicit for the Chat entrypoint. Prefer a Chat-specific settings surface that does not expose transport; if runtime input can still contain it, reject transport: "websocket" with a clear error instead of silently ignoring it.

Acceptance criteria

  • The OpenAI Chat package entrypoint no longer silently accepts WebSocket transport.
  • Type-level coverage prevents WebSocket selection at normal TypeScript call sites.
  • Runtime coverage verifies a clear failure for untyped/serialized unsupported input, if that input reaches this boundary.
  • OpenAI Responses keeps its existing "http" | "websocket" setting.

Activity

  1. added
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Aug 5, 2026
  2. opencode-agent commented on Aug 14, 2026

    @opencode-agent
    ContributorAuthor

    Addressed by #41048 and the WebSocket transport stack completed in #42600. OpenAI Chat no longer exposes or silently ignores a provider-level WebSocket setting; Responses now owns the WebSocket capability through a per-call channel executor while retaining HTTP as the default. Chat remains on its HTTP/SSE route, and focused provider-package/export/transport coverage verifies the separated surfaces and runtime paths. Closing as resolved on the v2 branch.

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

Metadata

Metadata

Assignees

Labels

2.0bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions