Enable zstd compression for code-mode gRPC responses (#57212)

## What changed

- Configure the code-mode host to send zstd-compressed responses when clients advertise support, and enable both client transports to accept them.
- Preserve uncompressed responses for clients that do not advertise zstd support.
- Patch `tonic` in Bazel builds to use zstd compression level 1, favoring response latency over compression ratio.

## Testing

Extend the TCP session integration test to check response encoding and successful session opening for both zstd-capable and uncompressed-only clients.

GitOrigin-RevId: b6cf0da51dd30fc2ac9a1b0af11bec26555c559d
This commit is contained in:
Chris Ayoub
2026-10-26 19:37:58 +00:00
committed by copyberry
parent 5e3496e0ad
commit dd5521406a
9 changed files with 62 additions and 21 deletions
@@ -42,6 +42,7 @@ impl SharedTransport {
let transport = channel.map_err(|error| Status::from_error(Box::new(error)));
Self::Connected(
CodeModeHostClient::new(BoxCloneSyncService::new(transport))
.accept_compressed(tonic::codec::CompressionEncoding::Zstd)
.max_decoding_message_size(MAX_FRAME_BYTES)
.max_encoding_message_size(MAX_FRAME_BYTES),
)
@@ -132,6 +133,7 @@ impl SharedTransport {
CodeModeHostClient::with_origin(BoxCloneSyncService::new(transport), origin)
};
let client = client
.accept_compressed(tonic::codec::CompressionEncoding::Zstd)
.max_decoding_message_size(MAX_FRAME_BYTES)
.max_encoding_message_size(MAX_FRAME_BYTES);
*cached = Some((bound_factory, client.clone()));