Bound Noise handshakes by the exec server initialization timeout (#42623)

## What changed

- Wait for the authenticated Noise handshake before sending the JSON-RPC
  `initialize` request.
- Share the configured initialization timeout across the handshake and RPC,
  while preserving the configured duration in timeout diagnostics.
- Record the handshake and initialization RPC as child spans of the existing
  initialization span, and terminate transport tasks when handshake readiness
  fails.

## Testing

- Cover stalled handshake timeouts and cleanup of the underlying WebSocket.
- Cover timeout reporting after the handshake has consumed part of the budget.

GitOrigin-RevId: c3eb5f7cfedd8d155fde5b7614fc2eb399ce337c
This commit is contained in:
bkotsopoulos authored and copyberry committed 2026-09-03 22:16:19 +00:00
1 parent 1f7b99922a
commit 781c183c3b
9 files changed
+433 -66

No files matched your search

+4 -2
View File
@@ -476,7 +476,7 @@ impl Inner {
.as_ref()
.ok_or_else(|| ExecServerError::Protocol("missing reconnect strategy".to_string()))?;
let attempt = reconnect_strategy.resume(session_id).await?;
let (connection, options, attempt_permit) = attempt.into_parts();
let (connection, options, attempt_permit, noise_context) = attempt.into_parts();
let (rpc_client, events_rx) = RpcClient::new(connection);
let rpc_client = Arc::new(rpc_client);
let client = ExecServerClient {
@@ -488,7 +488,9 @@ impl Inner {
// burst cannot fill the bounded event channel and block the initialize
// response behind it.
client.spawn_rpc_reader(&rpc_client, events_rx);
client.initialize_rpc(&rpc_client, options).await?;
client
.initialize_rpc(&rpc_client, options, noise_context)
.await?;
self.recover_processes(&rpc_client).await?;
Ok((rpc_client, attempt_permit))