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(install): stop baking the host memory DB path into a container deployment (#2845)
Abhay Singh14c4c9d5b78c
diff --git a/headroom/install/planner.py b/headroom/install/planner.pyindex 79c11ed31..9b6d26fdd 100644--- a/headroom/install/planner.py+++ b/headroom/install/planner.py@@ -15,6 +15,7 @@ from .models import (DeploymentManifest,InstallPreset,ProviderSelectionMode,+ RuntimeKind,SupervisorKind,ToolTarget,)@@ -181,7 +182,19 @@ def build_manifest(]proxy_args.append("--telemetry" if telemetry_enabled else "--no-telemetry")if memory_enabled:- proxy_args.extend(["--memory", "--memory-db-path", str(_paths.memory_db_path())])+ proxy_args.append("--memory")+ # `_paths.memory_db_path()` resolves against the HOST home. A container+ # runtime cannot use it: the container's HOME is /tmp/headroom-home and+ # the host's ~/.headroom is bind-mounted there, so a host path like+ # /home/<user>/.headroom/memory.db does not exist inside the container,+ # SQLite fails to open the DB, /readyz stays 503, and the deployment+ # times out and rolls back (#2803). Omit the flag for a container runtime:+ # the proxy then resolves the DB under its own cwd (.headroom/memory.db),+ # which is the container's workdir and therefore the bind mount, landing+ # in the same host file the explicit path intended. On the host (python)+ # runtime the resolved host path is correct, so keep passing it.+ if runtime_kind != RuntimeKind.DOCKER.value:+ proxy_args.extend(["--memory-db-path", str(_paths.memory_db_path())])if anyllm_provider:proxy_args.extend(["--anyllm-provider", anyllm_provider])if region:diff --git a/tests/test_install/test_planner.py b/tests/test_install/test_planner.pyindex ffb559149..15c7de6fc 100644--- a/tests/test_install/test_planner.py+++ b/tests/test_install/test_planner.py@@ -46,6 +46,33 @@ def test_build_manifest_for_persistent_docker_sets_expected_defaults() -> None:assert manifest.tool_envs["claude"]["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:8787"assert manifest.tool_envs["copilot"]["COPILOT_PROVIDER_TYPE"] == "anthropic"assert "--memory" in manifest.proxy_args+ # A container runtime must NOT carry the host memory DB path: it does not+ # exist inside the container and would keep /readyz at 503 (#2803). The proxy+ # resolves the DB under its own cwd, which is the bind-mounted ~/.headroom.+ assert "--memory-db-path" not in manifest.proxy_args+++def test_build_manifest_python_runtime_keeps_explicit_memory_db_path() -> None:+ manifest = build_manifest(+ profile="default",+ preset=InstallPreset.PERSISTENT_SERVICE.value,+ runtime_kind="python",+ scope="user",+ provider_mode="manual",+ targets=["claude"],+ port=8787,+ backend="anthropic",+ anyllm_provider=None,+ region=None,+ proxy_mode="token",+ memory_enabled=True,+ telemetry_enabled=False,+ image="ghcr.io/headroomlabs-ai/headroom:latest",+ )++ # On the host the resolved path is correct, so it is still passed explicitly.+ assert "--memory" in manifest.proxy_args+ assert "--memory-db-path" in manifest.proxy_argsdef test_build_manifest_uses_provider_slice_env_builders_for_all_supported_targets() -> None: