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
refactor(cli): remove test-only and dead helpers from wrap, proxy and mcp (#4118)
Tejas Chopra73f59a32ccda
diff --git a/headroom/cli/mcp.py b/headroom/cli/mcp.pyindex 52d04cf45..801330293 100644--- a/headroom/cli/mcp.py+++ b/headroom/cli/mcp.py@@ -5,78 +5,16 @@ Claude Code subscription users to use CCR (Compress-Cache-Retrieve) withoutneeding API key access."""-import json-from pathlib import Path-from typing import Any-import clickfrom .main import main-# Default paths-CLAUDE_CONFIG_DIR = Path.home() / ".claude"-MCP_CONFIG_PATH = CLAUDE_CONFIG_DIR / "mcp.json"-# Servers registered via `claude mcp add` (user scope) live in ~/.claude.json,-# NOT in ~/.claude/mcp.json. Status must check both to avoid a false negative.-CLAUDE_JSON_PATH = Path.home() / ".claude.json"DEFAULT_PROXY_URL = "http://127.0.0.1:8787"DEFAULT_HTTP_HOST = "127.0.0.1"DEFAULT_HTTP_PORT = 8788DEFAULT_HTTP_PATH = "/mcp"-def get_headroom_command() -> list[str]:- """Get the command to run headroom MCP server.-- Returns the CLI invocation used by Claude Code config.- """- return ["headroom", "mcp", "serve"]---def load_mcp_config() -> dict[str, Any]:- """Load existing MCP config or return empty structure."""- if MCP_CONFIG_PATH.exists():- try:- with open(MCP_CONFIG_PATH, encoding="utf-8") as f:- result: dict[str, Any] = json.load(f)- return result- except (json.JSONDecodeError, OSError):- return {"mcpServers": {}}- return {"mcpServers": {}}---def save_mcp_config(config: dict) -> None:- """Save MCP config, creating directory if needed."""- CLAUDE_CONFIG_DIR.mkdir(parents=True, exist_ok=True)- with open(MCP_CONFIG_PATH, "w", encoding="utf-8") as f:- json.dump(config, f, indent=2)- f.write("\n") # Trailing newline---def find_headroom_registration() -> tuple[Path, dict[str, Any]] | None:- """Locate an existing 'headroom' MCP server registration.-- Claude Code stores servers registered with `claude mcp add` (user scope) in- ~/.claude.json under "mcpServers". Headroom's own `mcp install` fallback- writes ~/.claude/mcp.json, and a project may define ./.mcp.json. Check all of- them so `status` reflects reality instead of only looking at mcp.json.-- Returns (config_path, server_config) for the first match, else None.- """- for path in (CLAUDE_JSON_PATH, MCP_CONFIG_PATH, Path.cwd() / ".mcp.json"):- if not path.exists():- continue- try:- with open(path) as f:- data = json.load(f)- except (json.JSONDecodeError, OSError):- continue- servers = data.get("mcpServers", {})- if isinstance(servers, dict) and "headroom" in servers:- return path, servers["headroom"]- return None--@main.group()def mcp() -> None:"""MCP server for Claude Code integration.diff --git a/headroom/cli/proxy.py b/headroom/cli/proxy.pyindex a04d7fd18..918397577 100644--- a/headroom/cli/proxy.py+++ b/headroom/cli/proxy.py@@ -195,16 +195,6 @@ def _get_env_int(name: str, default: int) -> int:return default if value is None else value-def _get_env_float_optional(name: str) -> float | None:- val = os.environ.get(name)- if val is None or val == "":- return None- try:- return float(val)- except ValueError:- raise click.ClickException(f"{name} must be a number, got {val!r}") from None--@main.command()@click.option("--port",diff --git a/headroom/cli/wrap.py b/headroom/cli/wrap.pyindex 5f6f04df5..be1886852 100644--- a/headroom/cli/wrap.py+++ b/headroom/cli/wrap.py@@ -87,7 +87,6 @@ from headroom.providers.antigravity import (render_setup_lines as _render_antigravity_setup_lines,)from headroom.providers.claude import (- CONTEXT_1M_SUFFIX,DEFAULT_1M_MODEL,HEADROOM_1M_MODEL_ENV,REMOTE_CONTROL_BASE_URL_ENV,@@ -193,9 +192,6 @@ from headroom.providers.openclaw import (from headroom.providers.openclaw import (decode_entry_json as _decode_openclaw_entry_json_impl,)-from headroom.providers.openclaw import (- normalize_gateway_provider_ids as _normalize_openclaw_gateway_provider_ids_impl,-)from headroom.providers.opencode import build_launch_env as _build_opencode_launch_envfrom headroom.providers.opencode.config import (_MCP_MARKER_END, # noqa: F401@@ -331,15 +327,6 @@ def _append_text(path: Path, content: str) -> None:fsutil.append_text(path, content)-_AGENT_SAVINGS_TARGET_AGENTS = {- "antigravity",- "claude",- "codex",- "cursor",- "grok",- "grok_build",- "opencode",-}_WRAP_PROXY_TIMEOUT_ENV = "HEADROOM_WRAP_PROXY_TIMEOUT"_WRAP_PROXY_TIMEOUT_DEFAULT_SECONDS = 45_WRAP_PROXY_TIMEOUT_ML_DEFAULT_SECONDS = 90@@ -373,10 +360,8 @@ _CLAUDE_PROJECT_SETTINGS_ENV = "HEADROOM_CLAUDE_PROJECT_SETTINGS"_ANTHROPIC_MODEL_ENV = "ANTHROPIC_MODEL"# Private aliases preserve the standalone wrapper's existing test and import# surface while the provider runtime owns the 1M selection contract.-_CONTEXT_1M_SUFFIX = CONTEXT_1M_SUFFIX_1M_MODEL_ENV = HEADROOM_1M_MODEL_ENV_DEFAULT_1M_MODEL = DEFAULT_1M_MODEL-_OPENCLAUDE_INSTRUCTIONS_FILE = "CONVENTIONS.md"_resolve_1m_model = resolve_1m_model@@ -1703,25 +1688,6 @@ def _wrap_proxy_alive(port: int, *, attempts: int = 3, delay: float = 0.25) -> breturn False-def _wrap_marker_proxy_is_dead(marker: dict[str, Any]) -> bool:- """True if ``marker`` records a proxy ``port`` that no longer accepts- connections.-- Port liveness is the authoritative signal for a wrap session that vanished- without running its cleanup (hard reboot / SIGKILL, issue #2221): the- recorded PID is unreliable because a reboot can recycle it onto an- unrelated live process, so a PID that still looks alive does not prove the- proxy is up. A marker with no recorded port returns False here (fall back- to PID-based staleness); a marker whose port IS responding is a live- session and must never be treated as dead. Uses the retry-hardened- ``_wrap_proxy_alive`` so a momentary blip never reads as dead.- """- port = marker.get("port")- if not isinstance(port, int):- return False- return not _wrap_proxy_alive(port)--def _clear_wrap_marker(settings_path: Path, *, key: str) -> None:marker = _read_wrap_marker(settings_path)if marker is not None and marker.get("key") == key:@@ -4069,76 +4035,6 @@ def _env_bool_value(value: str) -> bool:return value.strip().lower() in {"1", "true", "yes", "on"}-def _agent_savings_config_mismatches(- running_config: dict[str, Any],- agent_type: str,-) -> list[str]:- """Return restart reasons when a running proxy lacks target agent savings."""-- if agent_type not in _AGENT_SAVINGS_TARGET_AGENTS:- return []-- if _wrap_agent_savings_profile(agent_type) is None:- return []-- desired_env = os.environ.copy()- apply_agent_savings_env_defaults(desired_env)- checks: tuple[tuple[str, str, str, str], ...] = (- ("HEADROOM_SAVINGS_PROFILE", "savings_profile", "savings-profile", "str"),- ("HEADROOM_TARGET_RATIO", "target_ratio", "target-ratio", "float"),- (- "HEADROOM_COMPRESS_USER_MESSAGES",- "compress_user_messages",- "compress-user-messages",- "bool",- ),- (- "HEADROOM_COMPRESS_SYSTEM_MESSAGES",- "compress_system_messages",- "compress-system-messages",- "bool",- ),- ("HEADROOM_PROTECT_RECENT", "protect_recent", "protect-recent", "int"),- (- "HEADROOM_PROTECT_ANALYSIS_CONTEXT",- "protect_analysis_context",- "protect-analysis-context",- "bool",- ),- ("HEADROOM_MIN_TOKENS", "min_tokens_to_crush", "min-tokens", "int"),- ("HEADROOM_MAX_ITEMS", "max_items_after_crush", "max-items", "int"),- (- "HEADROOM_SMART_CRUSHER_COMPACTION",- "smart_crusher_with_compaction",- "smart-crusher-compaction",- "bool",- ),- ("HEADROOM_ACCURACY_GUARD", "accuracy_guard", "accuracy-guard", "str"),- )-- mismatches: list[str] = []- for env_key, config_key, label, value_type in checks:- expected = desired_env.get(env_key)- if expected is None:- continue- actual = running_config.get(config_key)- try:- if value_type == "float":- matches = actual is not None and abs(float(actual) - float(expected)) < 1e-9- elif value_type == "int":- matches = actual is not None and int(actual) == int(expected)- elif value_type == "bool":- matches = actual is not None and bool(actual) is _env_bool_value(expected)- else:- matches = str(actual or "").strip().lower() == expected.strip().lower()- except (TypeError, ValueError):- matches = False- if not matches:- mismatches.append(label)-- return mismatches--def _proxy_active_session_count(payload: dict[str, Any] | None) -> int:"""Return active session count from /health runtime metadata."""if payload is None:@@ -5642,11 +5538,6 @@ def _resolve_openclaw_extensions_dir(openclaw_bin: str) -> Path:return config_path.parent / "extensions"-def _normalize_openclaw_gateway_provider_ids(provider_ids: tuple[str, ...] | None) -> list[str]:- """Normalize configured OpenClaw provider ids, defaulting to openai-codex."""- return _normalize_openclaw_gateway_provider_ids_impl(provider_ids)--def _read_openclaw_config_value(openclaw_bin: str, path: str) -> Any | None:"""Read an OpenClaw config value when present, returning None on missing paths."""result = run(@@ -8738,14 +8629,6 @@ def opencode(_opencode_proxy.kill()-def _opencode_home_dir() -> Path:- """Return the OpenCode home/config directory."""- env_path = os.environ.get("OPENCODE_HOME", "").strip()- if env_path:- return Path(env_path).expanduser()- return Path.home() / ".config" / "opencode"--# =============================================================================# OpenCode (unwrap)# =============================================================================diff --git a/tests/test_agent_savings.py b/tests/test_agent_savings.pyindex 11e8b049d..d419db24a 100644--- a/tests/test_agent_savings.py+++ b/tests/test_agent_savings.py@@ -333,12 +333,6 @@ def test_wrap_agent_savings_profile_is_opt_in(monkeypatch) -> None:assert wrap_module._wrap_agent_savings_profile("codex") == AGENT_90_PROFILE-def test_agent_savings_config_mismatches_requires_explicit_profile(monkeypatch) -> None:- monkeypatch.delenv("HEADROOM_SAVINGS_PROFILE", raising=False)-- assert wrap_module._agent_savings_config_mismatches({}, "claude") == []--def test_start_proxy_does_not_inject_agent_savings_by_default(monkeypatch, tmp_path) -> None:captured_env: dict[str, str] = {}@@ -389,77 +383,6 @@ def test_start_proxy_injects_explicit_agent_savings_profile(monkeypatch, tmp_patassert captured_env["HEADROOM_TARGET_RATIO"] == "0.10"-def test_agent_savings_config_mismatches_returns_specific_labels(monkeypatch) -> None:- monkeypatch.setenv("HEADROOM_SAVINGS_PROFILE", AGENT_90_PROFILE)- profile = get_agent_savings_profile(AGENT_90_PROFILE)- running_config = {- "savings_profile": profile.name,- "target_ratio": 0.20,- "compress_user_messages": profile.compress_user_messages,- "compress_system_messages": profile.compress_system_messages,- "protect_recent": profile.protect_recent,- "protect_analysis_context": profile.protect_analysis_context,- "min_tokens_to_crush": profile.min_tokens_to_compress,- "max_items_after_crush": profile.max_items_after_crush,- "smart_crusher_with_compaction": profile.smart_crusher_with_compaction,- "accuracy_guard": profile.accuracy_guard,- }-- assert wrap_module._agent_savings_config_mismatches(running_config, "codex") == ["target-ratio"]---def test_agent_savings_config_mismatches_ignores_non_target_agents() -> None:- assert wrap_module._agent_savings_config_mismatches({}, "openhands") == []---def test_agent_savings_config_mismatches_accepts_matching_runtime_config(monkeypatch) -> None:- monkeypatch.setenv("HEADROOM_SAVINGS_PROFILE", AGENT_90_PROFILE)- profile = get_agent_savings_profile(AGENT_90_PROFILE)- running_config = {- "savings_profile": profile.name,- "target_ratio": "0.10",- "compress_user_messages": True,- "compress_system_messages": True,- "protect_recent": "2",- "protect_analysis_context": True,- "min_tokens_to_crush": "120",- "max_items_after_crush": "8",- "smart_crusher_with_compaction": False,- "accuracy_guard": "strict",- }-- assert wrap_module._agent_savings_config_mismatches(running_config, "cursor") == []---def test_agent_savings_config_mismatches_reports_unparseable_values(monkeypatch) -> None:- monkeypatch.setenv("HEADROOM_SAVINGS_PROFILE", AGENT_90_PROFILE)- running_config = {- "savings_profile": None,- "target_ratio": "not-a-float",- "compress_user_messages": None,- "compress_system_messages": None,- "protect_recent": "not-an-int",- "protect_analysis_context": None,- "min_tokens_to_crush": object(),- "max_items_after_crush": object(),- "smart_crusher_with_compaction": None,- "accuracy_guard": None,- }-- assert wrap_module._agent_savings_config_mismatches(running_config, "claude") == [- "savings-profile",- "target-ratio",- "compress-user-messages",- "compress-system-messages",- "protect-recent",- "protect-analysis-context",- "min-tokens",- "max-items",- "smart-crusher-compaction",- "accuracy-guard",- ]--def test_agent_90_profile_applies_to_proxy_config_runtime_kwargs() -> None:config = ProxyConfig(savings_profile="agent-90")diff --git a/tests/test_cli/test_mcp.py b/tests/test_cli/test_mcp.pyindex 6d2d29ac8..3a3b3e81f 100644--- a/tests/test_cli/test_mcp.py+++ b/tests/test_cli/test_mcp.py@@ -6,7 +6,6 @@ These are real tests that:- Test MCP server initialization (when MCP SDK is available)"""-import jsonimport sysfrom unittest.mock import AsyncMock, MagicMock, patch@@ -14,11 +13,6 @@ import pytestfrom click.testing import CliRunnerfrom headroom.cli.main import main-from headroom.cli.mcp import (- get_headroom_command,- load_mcp_config,- save_mcp_config,-)from headroom.mcp_registry.base import ServerSpec# Check if MCP SDK is available@@ -30,23 +24,6 @@ except ImportError:MCP_AVAILABLE = False-def temp_claude_dir(tmp_path):- """Create a temporary .claude directory for testing."""- claude_dir = tmp_path / ".claude"- claude_dir.mkdir()- return claude_dir---def mock_claude_config_path(temp_claude_dir):- """Patch the MCP config path to use temp directory."""- config_path = temp_claude_dir / "mcp.json"- with patch("headroom.cli.mcp.MCP_CONFIG_PATH", config_path):- with patch("headroom.cli.mcp.CLAUDE_CONFIG_DIR", temp_claude_dir):- yield config_path--@pytest.fixturedef mock_mcp_available():"""Mock MCP SDK as available for testing install/uninstall commands."""@@ -79,70 +56,10 @@ class FakeRegistrar:return False-class TestMCPConfigFunctions:- """Test config file handling functions."""-- def test_get_headroom_command_returns_list(self):- """Command should be a list suitable for subprocess."""- cmd = get_headroom_command()- assert isinstance(cmd, list)- assert len(cmd) >= 1- # Should end with mcp serve args- assert "mcp" in cmd or "-m" in cmd-- def test_load_mcp_config_empty_when_no_file(self, mock_claude_config_path):- """Loading non-existent config returns empty structure."""- config = load_mcp_config()- assert config == {"mcpServers": {}}-- def test_save_and_load_config(self, mock_claude_config_path):- """Config can be saved and loaded back."""- test_config = {- "mcpServers": {- "headroom": {- "command": "headroom",- "args": ["mcp", "serve"],- }- }- }- save_mcp_config(test_config)-- # File should exist- assert mock_claude_config_path.exists()-- # Load it back- loaded = load_mcp_config()- assert loaded == test_config-- def test_save_config_creates_directory(self, tmp_path):- """save_mcp_config creates parent directory if needed."""- claude_dir = tmp_path / "new_dir" / ".claude"- config_path = claude_dir / "mcp.json"-- with patch("headroom.cli.mcp.MCP_CONFIG_PATH", config_path):- with patch("headroom.cli.mcp.CLAUDE_CONFIG_DIR", claude_dir):- save_mcp_config({"mcpServers": {}})-- assert config_path.exists()-- def test_load_config_preserves_other_servers(self, mock_claude_config_path):- """Loading preserves other MCP servers in config."""- # Write config with another server- existing_config = {- "mcpServers": {- "other-server": {"command": "other", "args": []},- }- }- mock_claude_config_path.write_text(json.dumps(existing_config))-- loaded = load_mcp_config()- assert "other-server" in loaded["mcpServers"]--## Note: Tests for the 'mcp install' command's writes/idempotency/CLI-vs-file# fallback used to live here, but they were tightly coupled to private-# globals (MCP_CONFIG_PATH, shutil.which) and exercised the same surface+# module globals (config paths, shutil.which) and exercised the same surface# already covered by:# - tests/test_mcp_registry/test_claude_registrar.py (file/CLI behavior# with proper constructor injection — no patches)@@ -179,7 +96,7 @@ class TestMCPUninstallCommand:assert result.exit_code == 0assert registrar.removed == ["headroom"]- def test_uninstall_no_config_file(self, mock_claude_config_path):+ def test_uninstall_no_config_file(self):"""Uninstall with no config file exits cleanly."""runner = CliRunner()with patch("headroom.mcp_registry.get_all_registrars", return_value=[]):@@ -188,7 +105,7 @@ class TestMCPUninstallCommand:assert result.exit_code == 0assert "nothing to uninstall" in result.output.lower()- def test_uninstall_not_configured(self, mock_claude_config_path):+ def test_uninstall_not_configured(self):"""Uninstall when headroom not in config exits cleanly."""registrar = FakeRegistrar(configured=False)@@ -230,7 +147,7 @@ class TestMCPUninstallCommand:class TestMCPStatusCommand:"""Test 'headroom mcp status' command."""- def test_status_not_configured(self, mock_claude_config_path):+ def test_status_not_configured(self):"""Status shows not configured when no config."""runner = CliRunner()registrar = FakeRegistrar(configured=False)@@ -246,7 +163,7 @@ class TestMCPStatusCommand:or "No config" in result.output)- def test_status_configured(self, mock_claude_config_path, mock_mcp_available):+ def test_status_configured(self, mock_mcp_available):"""Status reports configured when a registrar has headroom."""registrar = FakeRegistrar(configured=True)diff --git a/tests/test_cli/test_mcp_status.py b/tests/test_cli/test_mcp_status.pydeleted file mode 100644index 7f50d8f51..000000000--- a/tests/test_cli/test_mcp_status.py+++ /dev/null@@ -1,89 +0,0 @@-from __future__ import annotations--import json-from pathlib import Path--import pytest--from headroom.cli import mcp as mcp_cli---def _write_servers(path: Path, servers: dict) -> None:- path.parent.mkdir(parents=True, exist_ok=True)- path.write_text(json.dumps({"mcpServers": servers}), encoding="utf-8")---def test_find_registration_in_claude_json(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:- claude_json = tmp_path / ".claude.json"- _write_servers(- claude_json,- {- "headroom": {- "command": "headroom",- "args": ["mcp", "serve"],- "env": {"HEADROOM_PROXY_URL": "http://x:1"},- }- },- )- monkeypatch.setattr(mcp_cli, "CLAUDE_JSON_PATH", claude_json)- monkeypatch.setattr(mcp_cli, "MCP_CONFIG_PATH", tmp_path / ".claude" / "mcp.json")- monkeypatch.chdir(tmp_path)-- found = mcp_cli.find_headroom_registration()- assert found is not None- path, cfg = found- assert path == claude_json- assert cfg["env"]["HEADROOM_PROXY_URL"] == "http://x:1"---def test_find_registration_falls_back_to_mcp_json(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch-) -> None:- mcp_json = tmp_path / "mcp.json"- _write_servers(mcp_json, {"headroom": {"command": "headroom"}})- monkeypatch.setattr(mcp_cli, "CLAUDE_JSON_PATH", tmp_path / ".claude.json") # absent- monkeypatch.setattr(mcp_cli, "MCP_CONFIG_PATH", mcp_json)- monkeypatch.chdir(tmp_path)-- found = mcp_cli.find_headroom_registration()- assert found is not None and found[0] == mcp_json---def test_find_registration_prefers_claude_json(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch-) -> None:- claude_json = tmp_path / ".claude.json"- mcp_json = tmp_path / "mcp.json"- _write_servers(claude_json, {"headroom": {"command": "a"}})- _write_servers(mcp_json, {"headroom": {"command": "b"}})- monkeypatch.setattr(mcp_cli, "CLAUDE_JSON_PATH", claude_json)- monkeypatch.setattr(mcp_cli, "MCP_CONFIG_PATH", mcp_json)- monkeypatch.chdir(tmp_path)-- found = mcp_cli.find_headroom_registration()- assert found is not None and found[0] == claude_json # ~/.claude.json takes precedence---def test_find_registration_none_when_absent(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch-) -> None:- monkeypatch.setattr(mcp_cli, "CLAUDE_JSON_PATH", tmp_path / ".claude.json")- monkeypatch.setattr(mcp_cli, "MCP_CONFIG_PATH", tmp_path / "mcp.json")- monkeypatch.chdir(tmp_path)-- assert mcp_cli.find_headroom_registration() is None---def test_find_registration_skips_malformed_json(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch-) -> None:- claude_json = tmp_path / ".claude.json"- claude_json.write_text("{ not valid json", encoding="utf-8")- mcp_json = tmp_path / "mcp.json"- _write_servers(mcp_json, {"headroom": {"command": "ok"}})- monkeypatch.setattr(mcp_cli, "CLAUDE_JSON_PATH", claude_json)- monkeypatch.setattr(mcp_cli, "MCP_CONFIG_PATH", mcp_json)- monkeypatch.chdir(tmp_path)-- found = mcp_cli.find_headroom_registration()- assert found is not None and found[0] == mcp_json # malformed file skipped, next match useddiff --git a/tests/test_cli/test_wrap_dead_marker_selfheal.py b/tests/test_cli/test_wrap_dead_marker_selfheal.pyindex a93c8ca9f..5faf5bc22 100644--- a/tests/test_cli/test_wrap_dead_marker_selfheal.py+++ b/tests/test_cli/test_wrap_dead_marker_selfheal.py@@ -49,23 +49,6 @@ def _listening_port() -> Iterator[int]:s.close()-# --- _wrap_marker_proxy_is_dead ----------------------------------------------def test_proxy_is_dead_when_port_not_listening() -> None:- assert wrap_cli._wrap_marker_proxy_is_dead({"port": _closed_port()}) is True---def test_proxy_is_not_dead_when_port_listening() -> None:- with _listening_port() as port:- assert wrap_cli._wrap_marker_proxy_is_dead({"port": port}) is False---def test_proxy_is_not_dead_when_no_port_recorded() -> None:- # No port → fall back to PID-based staleness, so not "dead" by port here.- assert wrap_cli._wrap_marker_proxy_is_dead({}) is False--# --- _check_and_clear_dead_wrap_marker ------------------------------------diff --git a/tests/test_cli/test_wrap_openclaw.py b/tests/test_cli/test_wrap_openclaw.pyindex 0d4e4671b..b8b765a28 100644--- a/tests/test_cli/test_wrap_openclaw.py+++ b/tests/test_cli/test_wrap_openclaw.py@@ -432,13 +432,6 @@ def test_wrap_openclaw_accepts_repeatable_gateway_provider_ids(runner: CliRunnerassert payload["config"]["gatewayProviderIds"] == ["openai-codex", "anthropic"]-def test_normalize_openclaw_gateway_provider_ids_dedupes_blanks_and_defaults() -> None:- assert wrap_cli._normalize_openclaw_gateway_provider_ids(- (" openai-codex ", "", "anthropic", "openai-codex", " ")- ) == ["openai-codex", "anthropic"]- assert wrap_cli._normalize_openclaw_gateway_provider_ids(None) == ["openai-codex"]--def test_read_openclaw_config_value_handles_missing_and_raw_strings() -> None:missing = MagicMock(returncode=1, stdout="", stderr="missing")raw_string = MagicMock(returncode=0, stdout="plain-text-value\n", stderr="")