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:
mattj-openai
2026-10-08 19:13:52 +00:00
committed by copyberry
parent 5505a80f38
commit 54685110a7
8 changed files with 82 additions and 14 deletions
+8 -2
View File
@@ -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)]