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
@@ -34,6 +34,7 @@ pub(super) async fn run_tcp_listener(bind_address: SocketAddr) -> Result<()> {
let routes = Routes::new(
CodeModeHostServer::new(GrpcCodeModeHost::new())
.send_compressed(tonic::codec::CompressionEncoding::Zstd)
.max_decoding_message_size(MAX_FRAME_BYTES)
.max_encoding_message_size(MAX_FRAME_BYTES),
)