From a16fd675df2850a63a7d550c645d3485e0af5bdc Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 29 Jul 2026 12:29:24 -0700 Subject: [PATCH] test: pair attribute-form load_config stubs with readonly siblings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second stub shape the first sweep missed: monkeypatch.setattr(config_mod, "load_config", ...) — attribute-form instead of string-form. Four files (compression_max_attempts, preflight_compression_cap_e2e, codex_gpt55_autoraise_notice, proactive_prune_config) stub agent_init config reads that now go through load_config_readonly(). Swept the whole tree for the attribute form; remaining hits stub modules that still use the mutable loader. 1,210 tests green across the 19-file re-sweep. --- tests/agent/test_codex_gpt55_autoraise_notice.py | 2 ++ tests/agent/test_compression_max_attempts_config.py | 3 +++ tests/agent/test_proactive_prune_config.py | 2 ++ tests/run_agent/test_preflight_compression_cap_e2e.py | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/tests/agent/test_codex_gpt55_autoraise_notice.py b/tests/agent/test_codex_gpt55_autoraise_notice.py index 2638407fea6..743a8e4a62a 100644 --- a/tests/agent/test_codex_gpt55_autoraise_notice.py +++ b/tests/agent/test_codex_gpt55_autoraise_notice.py @@ -59,6 +59,8 @@ def _make_codex_agent(monkeypatch, tmp_path: Path, *, show_notice: bool): from hermes_cli import config as config_mod monkeypatch.setattr(config_mod, "load_config", lambda: _config(show_notice=show_notice)) + + monkeypatch.setattr(config_mod, "load_config_readonly", lambda: _config(show_notice=show_notice)) db = SessionDB(db_path=tmp_path / "state.db") stdout = io.StringIO() diff --git a/tests/agent/test_compression_max_attempts_config.py b/tests/agent/test_compression_max_attempts_config.py index 8fb23f89d0a..f56d927e4fb 100644 --- a/tests/agent/test_compression_max_attempts_config.py +++ b/tests/agent/test_compression_max_attempts_config.py @@ -46,6 +46,9 @@ def _make_agent(monkeypatch, tmp_path: Path, *, max_attempts=None): monkeypatch.setattr( config_mod, "load_config", lambda: _config(max_attempts=max_attempts) ) + monkeypatch.setattr( + config_mod, "load_config_readonly", lambda: _config(max_attempts=max_attempts) + ) db = SessionDB(db_path=tmp_path / "state.db") with contextlib.redirect_stdout(io.StringIO()): agent = AIAgent( diff --git a/tests/agent/test_proactive_prune_config.py b/tests/agent/test_proactive_prune_config.py index 104dfb020c2..66ad0369ea1 100644 --- a/tests/agent/test_proactive_prune_config.py +++ b/tests/agent/test_proactive_prune_config.py @@ -39,6 +39,8 @@ def _make_agent(monkeypatch, tmp_path: Path, **prune_keys): from hermes_cli import config as config_mod monkeypatch.setattr(config_mod, "load_config", lambda: _config(**prune_keys)) + + monkeypatch.setattr(config_mod, "load_config_readonly", lambda: _config(**prune_keys)) db = SessionDB(db_path=tmp_path / "state.db") with contextlib.redirect_stdout(io.StringIO()): agent = AIAgent( diff --git a/tests/run_agent/test_preflight_compression_cap_e2e.py b/tests/run_agent/test_preflight_compression_cap_e2e.py index e29b1ecc44f..fe7512dffb8 100644 --- a/tests/run_agent/test_preflight_compression_cap_e2e.py +++ b/tests/run_agent/test_preflight_compression_cap_e2e.py @@ -60,6 +60,11 @@ def _make_agent(monkeypatch, tmp_path: Path, *, max_attempts) -> AIAgent: monkeypatch.setattr( config_mod, "load_config", lambda: _config(max_attempts) ) + + monkeypatch.setattr( + config_mod, "load_config_readonly", lambda: _config(max_attempts) + + ) db = SessionDB(db_path=tmp_path / "state.db") with ( contextlib.redirect_stdout(io.StringIO()),