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:
@@ -121,8 +121,8 @@ pub enum CodexErrorDetails {
|
||||
/// The Session loop treats this as a transient error and will automatically retry the turn.
|
||||
#[error("stream disconnected before completion: {0}")]
|
||||
Stream(String),
|
||||
/// Retry the rejected request over HTTP instead of sending it on another socket.
|
||||
#[error("websocket request exceeds the peer's message size limit (close code 1009)")]
|
||||
/// The peer's WebSocket message size limit requires sending this request over HTTP.
|
||||
#[error("websocket request exceeds the peer's message size limit")]
|
||||
WebsocketMessageTooLarge,
|
||||
/// A response stopped by the content filter. Sampling retries need developer guidance.
|
||||
#[error(
|
||||
|
||||
Reference in New Issue
Block a user