refactor(core): replace websocket flags with a single transport preference - #48423
Open
rekram1-node wants to merge 1 commit into
Open
refactor(core): replace websocket flags with a single transport preference#48423rekram1-node wants to merge 1 commit into
rekram1-node wants to merge 1 commit into
Conversation
…rence Drop Model.capabilities.responsesWebsockets, which provider plugins precomputed from route facts, and replace the websocket booleans on Model.Info, Provider.Info and their config entries with transport?: "http" | "websocket". The route now decides whether it has a WebSocket channel. Omitted uses the channel when offered and HTTP otherwise; "http" never offers the session executor; an explicit "websocket" on a route without a channel logs a warning via the new WebSocketChannelExecutor.unavailable hook and falls back to HTTP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Models had two WebSocket knobs that meant different things:
capabilities.responsesWebsockets(a route fact precomputed by provider plugins, never user-settable) andwebsocket: boolean(user policy, model overrides provider, defaulttrue). Every other plugin-known field onModel.Infouses one pattern — plugin sets a default, user overrides, wrong overrides fail at request time — so this collapses WebSocket to the same shape.Model.capabilities.responsesWebsockets. The route already knows whether it has a channel (open-responses-channel.tsfalls back to HTTP whenprepared.channelis absent; Azure'senabled(url)gate in@opencode/aicovers the URL/api-version checks the core plugin duplicated).websocket?: booleanonModel.Info,Provider.Info, and their config entries withtransport?: "http" | "websocket"(newProvider.Transportliteral). Inherits model → provider likecompaction.Request-time semantics
transport"http""websocket"The warning is delivered via a new optional
WebSocketChannelExecutor.unavailable: Effect<void>hook.HttpTransport.httpJson, the Open Responses channel transport's HTTP path, and the AI SDK adapter route incore/src/aisdk.tsall run it when handed an executor they cannot use, so every route type reports consistently. Core attaches it only when the user explicitly chose"websocket".Notes
websocketconfig key landed in feat(core): enable the responses websocket by default #48140 and is not in any release tag, so no config-normalizer migration diagnostic is added.packages/clienttypes andpackages/protocol/openapi.json.Testing
bun typecheckclean inschema,ai,core,server,protocol,client.ai: 1290 pass.schema: pass.core: 5374 pass; the 8 remaining failures are bash/shell-environment tests that fail identically on the base commit.unavailablefires; updated the config inheritance and model-request policy tests to the three-waytransportbehavior.