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.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
Fix macOS install-native CI failure from stale restart manifest test stub (#3779)
Copilot2e2758de9520
diff --git a/tests/test_beacon_gzip.py b/tests/test_beacon_gzip.pyindex 9d2c5ca2b..14e4fbf5d 100644--- a/tests/test_beacon_gzip.py+++ b/tests/test_beacon_gzip.py@@ -18,6 +18,7 @@ import gzipimport itertoolsimport jsonimport threading+import urllib.errorfrom http.server import BaseHTTPRequestHandler, HTTPServerfrom typing import Any@@ -199,15 +200,26 @@ def test_the_wire_contract_worker_js_must_satisfy():assert len(compressed) < 64 * 1024-def test_a_413_must_not_trigger_the_uncompressed_retry(collector):+def test_a_413_must_not_trigger_the_uncompressed_retry(monkeypatch):"""413 means the body was too big. Answering that by re-sending the SAMEpayload uncompressed — six times larger — is guaranteed to 413 again, andwould permanently switch off the compression that was the only thingkeeping the request under the cap. Only "I cannot read this encoding"(400/415) may fall back."""- collector["too_large"] = True+ monkeypatch.setenv("HEADROOM_BEACON_GZIP", "1")+ monkeypatch.setattr(S, "_gzip_supported", True)+ attempted: list[bool] = []++ def _always_413(+ endpoint: str, body: bytes, agent: str, timeout: float, *, compress: bool+ ) -> None:+ del body, agent, timeout+ attempted.append(compress)+ raise urllib.error.HTTPError(endpoint, 413, "Request Entity Too Large", hdrs=None, fp=None)++ monkeypatch.setattr(S, "_send", _always_413)S._post_blocking(sample_payload())- assert collector["over"] == 1, "it should not have retried at all"+ assert attempted == [True], "it should not have retried at all"assert S._gzip_enabled() is True, "a 413 disabled compression"diff --git a/tests/test_cli/test_install_cli.py b/tests/test_cli/test_install_cli.pyindex b12184bc6..1fd12c251 100644--- a/tests/test_cli/test_install_cli.py+++ b/tests/test_cli/test_install_cli.py@@ -568,7 +568,11 @@ def _restart_race_manifest():runtime_kind = "python"supervisor_kind = "service"scope = "user"+ port = 8787health_url = "http://127.0.0.1:8787/readyz"+ backend = "anthropic"+ targets: list[str] = []+ tool_envs: dict[str, dict[str, str]] = {}mutations: list = []return Manifest()diff --git a/tests/test_telemetry_warning.py b/tests/test_telemetry_warning.pyindex 96f70dc99..2b78fd535 100644--- a/tests/test_telemetry_warning.py+++ b/tests/test_telemetry_warning.py@@ -243,7 +243,7 @@ class TestProxyCLITelemetryBanner:result = runner.invoke(main, ["proxy", "--no-telemetry"])assert "Telemetry:" in result.output- assert "compression stats" in result.output+ assert "usage counters" in result.outputassert "HEADROOM_BEACON=off" in result.output# The old banner's bare "DISABLED" claim must not appear on the# Telemetry line specifically (the banner has an unrelated