mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +00:00
Support request IDs in exec-server WebSocket handshakes (#52234)
## What changed - Add optional `websocketRequestId` to `environment/add` and send it as `X-Request-ID` on direct WebSocket upgrades, including reconnects. It requires a secure transport or a loopback destination. - Echo a supplied `X-Request-ID` in the exec-server WebSocket upgrade response. ## Testing Add coverage for `websocketRequestId` serialization and for handshake header forwarding and echoing, both with and without a request ID. GitOrigin-RevId: 235303ff7e1150405b7e1158d6024223144e0cc3
This commit is contained in:
@@ -247,7 +247,7 @@ async fn websocket_upgrade_handler(
|
||||
return (err.status_code(), err.message()).into_response();
|
||||
}
|
||||
info!(%peer_addr, "exec-server websocket client connected");
|
||||
websocket
|
||||
let mut response = websocket
|
||||
.on_upgrade(move |stream| async move {
|
||||
state
|
||||
.processor
|
||||
@@ -260,7 +260,13 @@ async fn websocket_upgrade_handler(
|
||||
)
|
||||
.await;
|
||||
})
|
||||
.into_response()
|
||||
.into_response();
|
||||
if let Some(request_id) = headers.get("x-request-id") {
|
||||
response
|
||||
.headers_mut()
|
||||
.insert("x-request-id", request_id.clone());
|
||||
}
|
||||
response
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user