test: patch load_config_readonly alongside load_config in run_agent init tests

agent_init's config reads now go through load_config_readonly(); 8
tests that stubbed only load_config stopped intercepting them. Each of
the 10 patch sites gains a sibling readonly patch with the same
return_value. 461/461 file-local tests green.
This commit is contained in:
teknium1 2026-07-29 11:58:18 -07:00 committed by Teknium
parent d3cd6f4158
commit 97aba01406

View file

@ -1072,6 +1072,10 @@ class TestInit:
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={},
),
):
a = AIAgent(
api_key="test-k...7890",
@ -1093,6 +1097,10 @@ class TestInit:
"hermes_cli.config.load_config",
return_value={"prompt_caching": {"cache_ttl": "1h"}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"prompt_caching": {"cache_ttl": "1h"}},
),
):
a = AIAgent(
api_key="test-k...7890",
@ -1114,6 +1122,10 @@ class TestInit:
"hermes_cli.config.load_config",
return_value={"model": {"max_tokens": 4096}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"model": {"max_tokens": 4096}},
),
):
a = AIAgent(
api_key="test-k...7890",
@ -1140,6 +1152,10 @@ class TestInit:
"hermes_cli.config.load_config",
return_value={"model": {"max_tokens": 4096}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"model": {"max_tokens": 4096}},
),
):
a = AIAgent(
api_key="test-k...7890",
@ -1164,6 +1180,10 @@ class TestInit:
"hermes_cli.config.load_config",
return_value={"prompt_caching": {"cache_ttl": "30m"}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"prompt_caching": {"cache_ttl": "30m"}},
),
):
a = AIAgent(
api_key="test-k...7890",
@ -1498,6 +1518,10 @@ class TestToolUseEnforcementConfig:
"hermes_cli.config.load_config",
return_value={"agent": {"tool_use_enforcement": tool_use_enforcement}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"agent": {"tool_use_enforcement": tool_use_enforcement}},
),
):
a = AIAgent(
model=model,
@ -1644,6 +1668,10 @@ class TestToolUseEnforcementConfig:
"hermes_cli.config.load_config",
return_value={"agent": {"tool_use_enforcement": True}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"agent": {"tool_use_enforcement": True}},
),
):
a = AIAgent(
api_key="test-key-1234567890",
@ -1681,6 +1709,10 @@ class TestTaskCompletionGuidance:
"hermes_cli.config.load_config",
return_value={"agent": agent_cfg},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"agent": agent_cfg},
),
):
a = AIAgent(
model=model,
@ -1738,6 +1770,10 @@ class TestTaskCompletionGuidance:
"hermes_cli.config.load_config",
return_value={"agent": {"task_completion_guidance": True}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"agent": {"task_completion_guidance": True}},
),
):
a = AIAgent(
api_key="test-key-1234567890",
@ -1770,6 +1806,10 @@ class TestEnvironmentProbeIntegration:
"hermes_cli.config.load_config",
return_value={"agent": {"environment_probe": environment_probe}},
),
patch(
"hermes_cli.config.load_config_readonly",
return_value={"agent": {"environment_probe": environment_probe}},
),
):
a = AIAgent(
model=model,