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.

style(ci): apply ruff format to bug-3 fix files

JerrettDavis4f654212d597
diff --git a/e2e/wrap/run.py b/e2e/wrap/run.py
index e63d397ab..2c96b3d17 100644
--- a/e2e/wrap/run.py
+++ b/e2e/wrap/run.py
@@ -568,7 +568,9 @@ def verify_codex_wrap(
"requires_openai_auth" not in config,
"Codex wrap must NOT inject requires_openai_auth into the headroom provider block",
)
- assert_true("supports_websockets = true" in config, "Codex wrap missing 'supports_websockets = true'")
+ assert_true(
+ "supports_websockets = true" in config, "Codex wrap missing 'supports_websockets = true'"
+ )
entries = read_jsonl(log_dir / "codex.jsonl")
assert_true(len(entries) > 0, "Codex shim should have been invoked")
diff --git a/headroom/providers/codex/install.py b/headroom/providers/codex/install.py
index c27077273..cfd731b20 100644
--- a/headroom/providers/codex/install.py
+++ b/headroom/providers/codex/install.py
@@ -19,9 +19,7 @@ _CODEX_PATTERN = re.compile(
# Orphan-key patterns: strip any top-level keys that a crashed or partial write
# may have left outside the marker block.
-_ORPHAN_MODEL_PROVIDER = re.compile(
- r'(?m)^[ \t]*model_provider[ \t]*=[ \t]*"headroom"[ \t]*\r?\n'
-)
+_ORPHAN_MODEL_PROVIDER = re.compile(r'(?m)^[ \t]*model_provider[ \t]*=[ \t]*"headroom"[ \t]*\r?\n')
_ORPHAN_OPENAI_BASE_URL = re.compile(
r'(?m)^[ \t]*openai_base_url[ \t]*=[ \t]*"http://127\.0\.0\.1:\d+/v1"[ \t]*\r?\n'
)
diff --git a/tests/test_install/test_providers.py b/tests/test_install/test_providers.py
index e936631d0..862a54e70 100644
--- a/tests/test_install/test_providers.py
+++ b/tests/test_install/test_providers.py
@@ -549,8 +549,7 @@ def test_inject_codex_provider_config_writes_openai_base_url(
assert 'base_url = "http://127.0.0.1:8787/v1"' in content
# requires_openai_auth must also be absent (bug 3 regression guard).
assert "requires_openai_auth" not in content, (
- "requires_openai_auth must be absent from the injected provider block; "
- f"got:\n{content}"
+ f"requires_openai_auth must be absent from the injected provider block; got:\n{content}"
)
# openai_base_url must be in the top-level block, NOT inside [model_providers.*]
lines = content.splitlines()
@@ -591,8 +590,7 @@ def test_unwrap_removes_top_level_openai_base_url(
if config_file.exists():
content = config_file.read_text()
assert "openai_base_url" not in content, (
- "openai_base_url must not remain in config.toml after unwrap; "
- f"got:\n{content}"
+ f"openai_base_url must not remain in config.toml after unwrap; got:\n{content}"
)
# Also verify via _strip_codex_headroom_blocks directly — the orphan-cleanup
# path is exercised when there is no backup file (crash-recovery path).
@@ -603,8 +601,7 @@ def test_unwrap_removes_top_level_openai_base_url(
)
stripped = wrap_mod._strip_codex_headroom_blocks(orphan_content)
assert "openai_base_url" not in stripped, (
- "_strip_codex_headroom_blocks must remove orphaned openai_base_url lines; "
- f"got:\n{stripped}"
+ f"_strip_codex_headroom_blocks must remove orphaned openai_base_url lines; got:\n{stripped}"
)
assert 'model = "gpt-4o"' in stripped
@@ -640,9 +637,7 @@ def test_apply_provider_scope_writes_openai_base_url(monkeypatch, tmp_path: Path
if stripped.startswith("["):
in_provider_section = True
if in_provider_section and stripped.startswith("openai_base_url"):
- raise AssertionError(
- f"openai_base_url appeared inside a section block:\n{content}"
- )
+ raise AssertionError(f"openai_base_url appeared inside a section block:\n{content}")
# Bug 3 regression: requires_openai_auth must NOT appear.
assert "requires_openai_auth" not in content, (
f"requires_openai_auth must not be present in config:\n{content}"