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(codex): preserve remote compaction in init config (#3410)

宇宙的山峰6df4a963ae4c
diff --git a/headroom/cli/init.py b/headroom/cli/init.py
index d623014ff..048c5e826 100644
--- a/headroom/cli/init.py
+++ b/headroom/cli/init.py
@@ -363,7 +363,10 @@ def _ensure_codex_provider(path: Path, port: int) -> None:
'model_provider = "headroom"\n'
f'openai_base_url = "http://127.0.0.1:{port}/v1"\n\n'
"[model_providers.headroom]\n"
- 'name = "Headroom init proxy"\n'
+ # Codex derives remote-compaction support from the provider display
+ # name. Keep the proxy's provider id as ``headroom`` for routing, but
+ # use the built-in OpenAI name so the capability is preserved.
+ 'name = "OpenAI"\n'
f'base_url = "http://127.0.0.1:{port}/v1"\n'
"supports_websockets = true\n"
f"{requires_openai_auth}"
diff --git a/tests/test_cli/test_init_cli.py b/tests/test_cli/test_init_cli.py
index 42008ca5a..352d6341c 100644
--- a/tests/test_cli/test_init_cli.py
+++ b/tests/test_cli/test_init_cli.py
@@ -231,6 +231,7 @@ def test_init_codex_creates_hooks_feature_flag_on_first_init(
parsed = tomllib.loads(content)
assert parsed["model_provider"] == "headroom"
assert parsed["features"]["hooks"] is True
+ assert parsed["model_providers"]["headroom"]["name"] == "OpenAI"
assert "codex_hooks" not in content