fix(core): fall back on oversized websocket requests v2 - #43100
Open
neriousy wants to merge 1 commit into
Open
Conversation
— AI code review (automated) |
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
Fixes #42572
Reproduction
V2 contains the Responses WebSocket transport, but normal OpenAI Sessions currently do not select it: the built-in OpenAI plugin registers
session.http.request, andSessionModelRequesttreats any HTTP hook as WebSocket-ineligible. To exercise the transport on eitherv2or this branch, temporarily make this local-only change inpackages/core/src/session/model-request.ts:Start the development server in one terminal:
In another terminal, generate six valid noisy PNGs and submit them through the raw API. Using the raw API avoids the CLI SSE reader's separate 16 MiB event limit.
Observed against real OpenAI infrastructure with a 20,127,431-byte serialized
response.create:v2: WebSocket closes with code 1009 and the assistant ends withprovider.transport; there is no HTTP recovery.The warm-up test also exposed a separate V2 parser issue: ChatGPT may emit
codex.rate_limitsbeforeresponse.created, which currently producesprovider.invalid-output. That is independent of this fallback change.Testing
bun test test/session-model-transport.test.ts test/session-model-transport-live.test.tsbun typecheck --forcebunx prettier --check src/session/model-transport.ts test/session-model-transport.test.ts