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.

fix(ci): restore green lint gate on main

Tejas Choprafe50f9daed35
diff --git a/headroom/proxy/helpers.py b/headroom/proxy/helpers.py
index 7c8696f7e..c34ec04ed 100644
--- a/headroom/proxy/helpers.py
+++ b/headroom/proxy/helpers.py
@@ -841,9 +841,7 @@ def decide_compression_failure_action(
frame_bytes=frame_bytes,
)
- if (client or "").strip().lower() == "codex" and isinstance(
- exception, asyncio.TimeoutError
- ):
+ if (client or "").strip().lower() == "codex" and isinstance(exception, asyncio.TimeoutError):
return CompressionFailureAction(
refuse=False,
reason="client_override:codex",
diff --git a/headroom/transforms/code_compressor.py b/headroom/transforms/code_compressor.py
index c7ab74e98..13b4a8e31 100644
--- a/headroom/transforms/code_compressor.py
+++ b/headroom/transforms/code_compressor.py
@@ -117,7 +117,9 @@ def _get_parser(language: str) -> Any:
from tree_sitter_language_pack import get_language
parser = Parser()
- parser.language = get_language(language)
+ # `language` is a validated runtime str; get_language types its arg
+ # as a Literal of supported names, which a dynamic str can't satisfy.
+ parser.language = get_language(language) # type: ignore[arg-type]
parsers[language] = parser
logger.debug(
"Loaded tree-sitter parser for %s (thread %s)",
@@ -163,7 +165,9 @@ def unload_tree_sitter() -> bool:
if parsers:
count = len(parsers)
parsers.clear()
- logger.info("Unloaded %d tree-sitter parsers (thread %s)", count, threading.current_thread().name)
+ logger.info(
+ "Unloaded %d tree-sitter parsers (thread %s)", count, threading.current_thread().name
+ )
return True
return False
diff --git a/tests/repro_unsendable_panic.py b/tests/repro_unsendable_panic.py
index 100843fa9..52296899d 100644
--- a/tests/repro_unsendable_panic.py
+++ b/tests/repro_unsendable_panic.py
@@ -12,8 +12,8 @@ Usage:
python repro_unsendable_panic.py
"""
-import threading
import concurrent.futures
+import threading
CODE = b"def hello():\n return 42\n"