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
test(memory): skip decorators on offline model misses (#2020)
JD Davis4e19bcf6ce0f
diff --git a/tests/test_memory/test_core_operations.py b/tests/test_memory/test_core_operations.pyindex 42686b2d7..8548f8367 100644--- a/tests/test_memory/test_core_operations.py+++ b/tests/test_memory/test_core_operations.py@@ -23,13 +23,13 @@ import functoolsimport tempfilefrom pathlib import Path-import httpximport pytestfrom headroom.memory.config import MemoryConfigfrom headroom.memory.core import HierarchicalMemoryfrom headroom.memory.models import Memory, ScopeLevelfrom headroom.memory.ports import MemoryFilter+from tests._skip_helpers import external_model_skip_reason# Check if hnswlib is available (HierarchicalMemory requires it)try:@@ -43,14 +43,17 @@ pytestmark = pytest.mark.skipif(not HNSW_AVAILABLE, reason="hnswlib not availabldef network_timeout_handler(func):- """Decorator to skip tests on network timeouts (flaky CI)."""+ """Decorator to skip tests on transient/offline model dependency failures."""@functools.wraps(func)async def wrapper(*args, **kwargs):try:return await func(*args, **kwargs)- except httpx.ReadTimeout:- pytest.skip("Skipped due to network timeout (flaky CI)")+ except Exception as exc:+ reason = external_model_skip_reason(exc)+ if reason is not None:+ pytest.skip(reason)+ raisereturn wrapperdiff --git a/tests/test_memory/test_easy.py b/tests/test_memory/test_easy.pyindex 1f775103c..9c2679bd6 100644--- a/tests/test_memory/test_easy.py+++ b/tests/test_memory/test_easy.py@@ -21,10 +21,10 @@ os.environ["TOKENIZERS_PARALLELISM"] = "false"import tempfilefrom pathlib import Path-import httpximport pytestfrom headroom.memory.easy import Memory, MemoryResult+from tests._skip_helpers import external_model_skip_reason# Check if hnswlib is available (local backend requires it)try:@@ -38,15 +38,18 @@ pytestmark = pytest.mark.skipif(not HNSW_AVAILABLE, reason="hnswlib not availabldef network_timeout_handler(func):- """Decorator to skip tests on network timeouts (flaky CI)."""+ """Decorator to skip tests on transient/offline model dependency failures."""import functools@functools.wraps(func)async def wrapper(*args, **kwargs):try:return await func(*args, **kwargs)- except httpx.ReadTimeout:- pytest.skip("Skipped due to network timeout (flaky CI)")+ except Exception as exc:+ reason = external_model_skip_reason(exc)+ if reason is not None:+ pytest.skip(reason)+ raisereturn wrapper