Files
codex/patches/tonic-zstd-level1.patch
T
Chris Ayoub dd5521406a 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
2026-10-26 19:37:58 +00:00

15 lines
613 B
Diff

--- a/src/codec/compression.rs
+++ b/src/codec/compression.rs
@@ -239,8 +239,9 @@
CompressionEncoding::Zstd => {
let mut zstd_encoder = Encoder::new(
&decompressed_buf[0..len],
- // FIXME: support customizing the compression level
- zstd::DEFAULT_COMPRESSION_LEVEL,
+ // Favor CodeModeHost response latency over compression ratio.
+ // Level 1 is the fastest positive level and matches the benchmark.
+ 1,
)?;
std::io::copy(&mut zstd_encoder, &mut out_writer)?;
}