Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

test(proxy): warm up TestClient before measuring /livez backpressure latency

Garmbde780742132
diff --git a/tests/test_anthropic_pre_upstream_backpressure.py b/tests/test_anthropic_pre_upstream_backpressure.py
index 8747cdbf6..1b63a4f5e 100644
--- a/tests/test_anthropic_pre_upstream_backpressure.py
+++ b/tests/test_anthropic_pre_upstream_backpressure.py
@@ -564,6 +564,14 @@ def test_livez_unaffected_under_anthropic_backpressure():
latencies: list[float] = []
with TestClient(app) as client:
+ # Warm up: the first few requests pay one-time costs (TestClient
+ # ASGI lifespan, route resolution, import side effects) that are
+ # unrelated to what this test measures. Without warm-up, the
+ # single cold-start sample dominates `max(latencies)` (which is
+ # what the p99 fallback below reduces to for small N) and causes
+ # flakes on slow CI runners.
+ for _ in range(3):
+ client.get("/livez")
for _ in range(20):
t0 = time.perf_counter()
resp = client.get("/livez")