mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
Honor advertised WebSocket message size limits (#60841)
## Why Requests that exceed the server's advertised WebSocket message size limit can fall back to HTTP without first uploading the oversized message. ## What changed Read `x-codex-websocket-max-message-bytes` from the handshake response and check the serialized request's byte length before sending. Route oversized requests through the existing HTTP fallback. Ignore missing or invalid limits, and remove the close-code-specific wording from the size-limit error. ## Testing Add a fallback test that advertises a one-byte limit and verifies zero WebSocket generation requests and one HTTP request. GitOrigin-RevId: 03b42012ca77d6b046e937fef8e6335d855a1c10
This commit is contained in:
@@ -15,7 +15,7 @@ pub enum ApiError {
|
||||
Api { status: StatusCode, message: String },
|
||||
#[error("stream error: {0}")]
|
||||
Stream(String),
|
||||
#[error("websocket request exceeds the peer's message size limit (close code 1009)")]
|
||||
#[error("websocket request exceeds the peer's message size limit")]
|
||||
WebsocketMessageTooLarge,
|
||||
#[error("stream error: Incomplete response returned, reason: content_filter")]
|
||||
ContentFilter,
|
||||
|
||||
Reference in New Issue
Block a user