Skip to content

The agent that grows with you

test: pair load_config_readonly stubs at pruned-file sites (post-merge with main's readonly sweep)

Teknium3913ac2ba04f
diff --cc tests/agent/test_auxiliary_client.py
index 3fbca37e0cd,c700408c4cb..1ba43dd0313
--- a/tests/agent/test_auxiliary_client.py
+++ b/tests/agent/test_auxiliary_client.py
@@@ -4005,7 -6748,8 +4008,7 @@@ class TestCustomEndpointApiKeyInheritan
with patch.object(ac, "_RUNTIME_MAIN_API_KEY", "sk-runtime-key"), \
patch.object(ac, "_RUNTIME_MAIN_BASE_URL", "https://gw.example.com/v1"), \
-- patch("hermes_cli.config.load_config", return_value={"model": {}}), \
- patch("hermes_cli.config.load_config_readonly", return_value={"model": {}}), \
++ patch("hermes_cli.config.load_config", return_value={"model": {}}), patch("hermes_cli.config.load_config_readonly", return_value={"model": {}}), \
patch.object(ac, "_create_openai_client", side_effect=_capture_create):
client, model = resolve_provider_client(
"custom",
diff --cc tests/agent/test_curator.py
index 5b6840a27e2,3f0f360d92d..e18888771a0
--- a/tests/agent/test_curator.py
+++ b/tests/agent/test_curator.py
@@@ -637,6 -1332,14 +637,10 @@@ def test_review_fork_forwards_runtime_p
"hermes_cli.config.load_config",
lambda: {"model": {"provider": "custom:hyper-charm", "default": "glm-5.2"}},
)
+ monkeypatch.setattr(
+ "hermes_cli.config.load_config_readonly",
+ lambda: {"model": {"provider": "custom:hyper-charm", "default": "glm-5.2"}},
+ )
- monkeypatch.setattr(
- "hermes_cli.config.load_config_readonly",
- lambda: {"model": {"provider": "custom:hyper-charm", "default": "glm-5.2"}},
- )
monkeypatch.setattr(
"hermes_cli.runtime_provider.resolve_runtime_provider",
_fake_resolve_runtime_provider,
@@@ -660,6 -1363,14 +664,10 @@@ def test_review_fork_uses_runtime_model
"hermes_cli.config.load_config",
lambda: {"model": {"provider": "custom:gateway", "default": "gateway"}},
)
+ monkeypatch.setattr(
+ "hermes_cli.config.load_config_readonly",
+ lambda: {"model": {"provider": "custom:gateway", "default": "gateway"}},
+ )
- monkeypatch.setattr(
- "hermes_cli.config.load_config_readonly",
- lambda: {"model": {"provider": "custom:gateway", "default": "gateway"}},
- )
monkeypatch.setattr(
"hermes_cli.runtime_provider.resolve_runtime_provider",
lambda **_kwargs: {
diff --cc tests/agent/test_openrouter_response_cache.py
index 755a7e0f300,4bae25c7cea..3544fd07161
--- a/tests/agent/test_openrouter_response_cache.py
+++ b/tests/agent/test_openrouter_response_cache.py
@@@ -52,7 -128,8 +52,7 @@@ class TestBuildOrHeaders
"""When load_config() fails, build_or_headers still returns base headers."""
from agent.auxiliary_client import build_or_headers
- with patch("hermes_cli.config.load_config", side_effect=RuntimeError("boom")):
- with patch("hermes_cli.config.load_config", side_effect=RuntimeError("boom")), \
- patch("hermes_cli.config.load_config_readonly", side_effect=RuntimeError("boom")):
++ with patch("hermes_cli.config.load_config", side_effect=RuntimeError("boom")), patch("hermes_cli.config.load_config_readonly", side_effect=RuntimeError("boom")):
headers = build_or_headers(or_config=None)
# Should have base attribution but no cache headers
assert "HTTP-Referer" in headers
diff --cc tests/agent/test_prompt_builder.py
index c8aac026331,7dad71bcadb..19505a887ba
--- a/tests/agent/test_prompt_builder.py
+++ b/tests/agent/test_prompt_builder.py
@@@ -98,8 -137,16 +98,9 @@@ class TestTruncateContent
return {}
monkeypatch.setattr("hermes_cli.config.load_config", default_load_config)
-
+ monkeypatch.setattr("hermes_cli.config.load_config_readonly", default_load_config)
- def test_context_file_max_chars_default_matches_upstream_limit(self):
- assert CONTEXT_FILE_MAX_CHARS == 20_000
- def test_short_content_unchanged(self):
- content = "Short content"
- result = _truncate_content(content, "test.md")
- assert result == content
def test_long_content_truncated(self):
content = "x" * (CONTEXT_FILE_MAX_CHARS + 1000)
@@@ -116,6 -203,8 +117,7 @@@
return {"context_file_max_chars": 120}
monkeypatch.setattr("hermes_cli.config.load_config", fake_load_config)
-
+ monkeypatch.setattr("hermes_cli.config.load_config_readonly", fake_load_config)
_truncate_content("x" * 180, "warning.md")
@@@ -133,6 -222,8 +135,7 @@@
return {"context_file_max_chars": 120}
monkeypatch.setattr("hermes_cli.config.load_config", fake_load_config)
-
+ monkeypatch.setattr("hermes_cli.config.load_config_readonly", fake_load_config)
# Generate a warning in a fresh child context, then assert it did NOT
# leak into the parent context's accumulator.
@@@ -161,7 -252,11 +164,8 @@@ class TestDynamicContextFileCap
def _no_explicit_config(self, monkeypatch):
# No explicit context_file_max_chars → dynamic path is eligible.
monkeypatch.setattr("hermes_cli.config.load_config", lambda: {})
+ monkeypatch.setattr("hermes_cli.config.load_config_readonly", lambda: {})
- def test_dynamic_floor_for_small_window(self):
- # A small context window never drops below the historical 20K floor.
- assert _dynamic_context_file_max_chars(8_000) == CONTEXT_FILE_MAX_CHARS
def test_dynamic_scales_above_floor_for_large_window(self):
# 200K-token window → ~48K (200000 * 4 * 0.06), well above the floor
@@@ -179,6 -284,14 +183,10 @@@
"hermes_cli.config.load_config",
lambda: {"context_file_max_chars": 1_000},
)
+ monkeypatch.setattr(
+ "hermes_cli.config.load_config_readonly",
+ lambda: {"context_file_max_chars": 1_000},
+ )
- monkeypatch.setattr(
- "hermes_cli.config.load_config_readonly",
- lambda: {"context_file_max_chars": 1_000},
- )
assert _get_context_file_max_chars(200_000) == 1_000
def test_large_window_avoids_truncation_of_midsize_doc(self):
diff --cc tests/run_agent/test_memory_provider_init.py
index ad7f9d26004,13dd366608d..ff647a3ae63
--- a/tests/run_agent/test_memory_provider_init.py
+++ b/tests/run_agent/test_memory_provider_init.py
@@@ -31,7 -31,8 +31,7 @@@ def test_blank_memory_provider_does_not
honcho_cfg = SimpleNamespace(enabled=True, api_key="stale-key", base_url=None)
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("hermes_cli.config.save_config") as save_config,
patch(
"plugins.memory.honcho.client.HonchoClientConfig.from_global_config",
@@@ -64,7 -65,8 +64,7 @@@ def test_aiagent_forwards_user_id_alt_t
cfg = {"memory": {"provider": "recording"}, "agent": {}}
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("plugins.memory.load_memory_provider", return_value=provider),
patch("agent.model_metadata.get_model_context_length", return_value=204_800),
patch("run_agent.get_tool_definitions", return_value=[]),
diff --cc tests/run_agent/test_per_model_threshold_init_ordering.py
index e930a8ebcdb,67a482311bf..92811fe6c24
--- a/tests/run_agent/test_per_model_threshold_init_ordering.py
+++ b/tests/run_agent/test_per_model_threshold_init_ordering.py
@@@ -59,7 -59,8 +59,7 @@@ def test_plugin_engine_gets_model_thres
}
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("plugins.context_engine.load_context_engine", return_value=engine),
patch("agent.model_metadata.get_model_context_length", return_value=1_000_000),
patch("run_agent.get_tool_definitions", return_value=[]),
diff --cc tests/run_agent/test_plugin_context_engine_init.py
index 91e698e7c3f,3eeca020268..797e0b406e1
--- a/tests/run_agent/test_plugin_context_engine_init.py
+++ b/tests/run_agent/test_plugin_context_engine_init.py
@@@ -45,7 -45,8 +45,7 @@@ def test_plugin_engine_gets_context_len
cfg = {"context": {"engine": "stub"}, "agent": {}}
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("plugins.context_engine.load_context_engine", return_value=engine),
patch("agent.model_metadata.get_model_context_length", return_value=204_800),
patch("run_agent.get_tool_definitions", return_value=[]),
@@@ -82,7 -83,8 +82,7 @@@ def test_active_context_engine_tools_su
assert "context_engine" in enabled_toolsets
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("plugins.context_engine.load_context_engine", return_value=engine),
patch("agent.model_metadata.get_model_context_length", return_value=204_800),
patch("run_agent.get_tool_definitions", return_value=[]),
@@@ -115,7 -117,8 +115,7 @@@ def test_plugin_engine_update_model_arg
cfg = {"context": {"engine": "stub"}, "agent": {}}
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("plugins.context_engine.load_context_engine", return_value=engine),
patch("agent.model_metadata.get_model_context_length", return_value=131_072),
patch("run_agent.get_tool_definitions", return_value=[]),
@@@ -168,7 -171,8 +168,7 @@@ def test_codex_gpt55_autoraise_suppress
}
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("plugins.context_engine.load_context_engine", return_value=engine),
patch("agent.model_metadata.get_model_context_length", return_value=272_000),
patch("run_agent.get_tool_definitions", return_value=[]),
@@@ -194,7 -198,8 +194,7 @@@ def test_codex_gpt55_autoraise_still_ap
}
with (
-- patch("hermes_cli.config.load_config", return_value=cfg),
- patch("hermes_cli.config.load_config_readonly", return_value=cfg),
++ patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg),
patch("agent.context_compressor.get_model_context_length", return_value=272_000),
patch("run_agent.get_tool_definitions", return_value=[]),
patch("run_agent.check_toolset_requirements", return_value={}),
diff --cc tests/run_agent/test_run_agent.py
index d5993c26e8d,364fbf23c90..01225f241ec
--- a/tests/run_agent/test_run_agent.py
+++ b/tests/run_agent/test_run_agent.py
@@@ -704,7 -1071,11 +704,7 @@@ class TestInit
patch("run_agent.get_tool_definitions", return_value=[]),
patch("run_agent.check_toolset_requirements", return_value={}),
patch("run_agent.OpenAI"),
-- patch("hermes_cli.config.load_config", return_value={}),
- patch(
- "hermes_cli.config.load_config_readonly",
- return_value={},
- ),
++ patch("hermes_cli.config.load_config", return_value={}), patch("hermes_cli.config.load_config_readonly", return_value={}),
):
a = AIAgent(
api_key="test-k...7890",
@@@ -727,6 -1151,10 +727,9 @@@
patch(
"hermes_cli.config.load_config",
return_value={"model": {"max_tokens": 4096}},
- ),
- patch(
++ ), patch(
+ "hermes_cli.config.load_config_readonly",
+ return_value={"model": {"max_tokens": 4096}},
),
):
a = AIAgent(
@@@ -898,6 -1517,10 +901,9 @@@ class TestToolUseEnforcementConfig
patch(
"hermes_cli.config.load_config",
return_value={"agent": {"tool_use_enforcement": tool_use_enforcement}},
- ),
- patch(
++ ), patch(
+ "hermes_cli.config.load_config_readonly",
+ return_value={"agent": {"tool_use_enforcement": tool_use_enforcement}},
),
):
a = AIAgent(
@@@ -943,6 -1667,10 +949,9 @@@
patch(
"hermes_cli.config.load_config",
return_value={"agent": {"tool_use_enforcement": True}},
- ),
- patch(
++ ), patch(
+ "hermes_cli.config.load_config_readonly",
+ return_value={"agent": {"tool_use_enforcement": True}},
),
):
a = AIAgent(
@@@ -980,6 -1708,10 +989,9 @@@ class TestTaskCompletionGuidance
patch(
"hermes_cli.config.load_config",
return_value={"agent": agent_cfg},
- ),
- patch(
++ ), patch(
+ "hermes_cli.config.load_config_readonly",
+ return_value={"agent": agent_cfg},
),
):
a = AIAgent(
@@@ -1016,6 -1769,10 +1028,9 @@@
patch(
"hermes_cli.config.load_config",
return_value={"agent": {"task_completion_guidance": True}},
- ),
- patch(
++ ), patch(
+ "hermes_cli.config.load_config_readonly",
+ return_value={"agent": {"task_completion_guidance": True}},
),
):
a = AIAgent(
@@@ -1048,6 -1805,10 +1063,9 @@@ class TestEnvironmentProbeIntegration
patch(
"hermes_cli.config.load_config",
return_value={"agent": {"environment_probe": environment_probe}},
- ),
- patch(
++ ), patch(
+ "hermes_cli.config.load_config_readonly",
+ return_value={"agent": {"environment_probe": environment_probe}},
),
):
a = AIAgent(