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(memory): annotate _EMBEDDER_CACHE key as 3-tuple (unbreak main lint) (#2153)

Tejas Chopra22af75adaee5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 30ea55978..c7acbe25b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Fixed
+- **memory:** annotate `_EMBEDDER_CACHE` as `dict[tuple[str, str, str], Embedder]` to match the 3-element key (backend, model, ollama_base_url). The stale 2-tuple annotation made `mypy headroom` fail on `main`, which broke the `lint` CI job on every open PR.
- **install:** include `orjson` in the `[proxy]` extra so `uv tool install "headroom-ai[all]"` satisfies LiteLLM OpenRouter/provider backends that import it at runtime ([#2056](https://github.com/headroomlabs-ai/headroom/issues/2056)).
- The dashboard's per-request metadata (the `recent_requests` / `request_logs`
tail and the `config` block with upstream URLs) is gated to loopback callers
diff --git a/headroom/memory/factory.py b/headroom/memory/factory.py
index 94e7153d8..249cfa116 100644
--- a/headroom/memory/factory.py
+++ b/headroom/memory/factory.py
@@ -34,7 +34,7 @@ _MEMORY_TEXT_GROUP = "headroom.memory_text"
# safely serve every per-project ``LocalBackend`` created by the
# BackendRouter. Without this cache, opening N project DBs would load
# the sentence-transformers / ONNX model N times.
-_EMBEDDER_CACHE: dict[tuple[str, str], Embedder] = {}
+_EMBEDDER_CACHE: dict[tuple[str, str, str], Embedder] = {}
_EMBEDDER_CACHE_LOCK = threading.Lock()