Skip to content

The agent that grows with you

test: trim salvaged multiplex tests to the invariant pair per fix

Teknium72cc96578af1
diff --git a/tests/gateway/test_discord_allow_bots_yaml_config.py b/tests/gateway/test_discord_allow_bots_yaml_config.py
index 7ef5d03cd25..06f32bf679e 100644
--- a/tests/gateway/test_discord_allow_bots_yaml_config.py
+++ b/tests/gateway/test_discord_allow_bots_yaml_config.py
@@ -47,21 +47,3 @@ def test_adapter_reads_allow_bots_from_extra_without_env(adapter_mod, monkeypatc
adapter = _fake_adapter(adapter_mod, {"allow_bots": "mentions"})
assert adapter._get_allow_bots() == "mentions"
-
-
-def test_env_still_wins_over_yaml_for_allow_bots(adapter_mod, monkeypatch):
- monkeypatch.setattr(adapter_mod, "_scoped_gate_env", lambda name, default="": default)
-
- adapter = _fake_adapter(
- adapter_mod, {"allow_bots": "mentions"}, {"DISCORD_ALLOW_BOTS": "all"}
- )
-
- assert adapter._get_allow_bots() == "all"
-
-
-def test_allow_bots_defaults_to_none_when_unconfigured(adapter_mod, monkeypatch):
- monkeypatch.setattr(adapter_mod, "_scoped_gate_env", lambda name, default="": default)
-
- adapter = _fake_adapter(adapter_mod, {})
-
- assert adapter._get_allow_bots() == "none"
diff --git a/tests/tools/test_file_write_safety.py b/tests/tools/test_file_write_safety.py
index 40951361f49..c9c49a43ad2 100644
--- a/tests/tools/test_file_write_safety.py
+++ b/tests/tools/test_file_write_safety.py
@@ -728,25 +728,6 @@ class TestMultiplexProfileWriteGuardsAreProfileScoped:
finally:
reset_hermes_home_override(tok)
- def test_config_getter_tracks_active_profile_after_a_prior_scope(self, tmp_path):
- import tools.file_tools_write_guards as ft
- from hermes_constants import (
- reset_hermes_home_override,
- set_hermes_home_override,
- )
-
- a, b = self._profiles(tmp_path)
- tok = set_hermes_home_override(str(a))
- try:
- assert ft._get_hermes_config_resolved() == str((a / "config.yaml").resolve())
- finally:
- reset_hermes_home_override(tok)
- tok = set_hermes_home_override(str(b))
- try:
- assert ft._get_hermes_config_resolved() == str((b / "config.yaml").resolve())
- finally:
- reset_hermes_home_override(tok)
-
def test_config_hard_block_refuses_beta_config_even_after_alpha_turn(self, tmp_path):
"""End-to-end: the ``config.yaml`` hard-block must fire for beta's own
config under beta's scope, regardless of alpha having run first."""
@@ -770,85 +751,3 @@ class TestMultiplexProfileWriteGuardsAreProfileScoped:
reset_hermes_home_override(tok)
assert err is not None
assert "Refusing to write to Hermes config file" in err
-
- def test_config_resolver_failure_stays_bound_to_active_profile(
- self, tmp_path, monkeypatch
- ):
- """Opposite-side regression (PR #107335 review): when the primary config
- resolver raises, the fallback must derive beta's config from beta's own
- ``HERMES_HOME`` key — never the subprocess/default home — so beta's
- ``config.yaml`` stays hard-blocked instead of failing open against an
- unrelated config, and alpha's config is not spuriously protected under
- beta's scope."""
- import tools.file_tools_write_guards as ft
- from hermes_constants import (
- reset_hermes_home_override,
- set_hermes_home_override,
- )
-
- a, b = self._profiles(tmp_path)
- # alpha runs first (would poison a process memo), then the primary
- # resolver breaks and beta's turn must fall back to beta's own home key.
- tok = set_hermes_home_override(str(a))
- try:
- ft._get_hermes_config_resolved()
- finally:
- reset_hermes_home_override(tok)
-
- def boom():
- raise RuntimeError("config path unavailable")
-
- monkeypatch.setattr(ft, "_config_path_resolved", boom)
-
- tok = set_hermes_home_override(str(b))
- try:
- assert ft._get_hermes_config_resolved() == str(
- (b / "config.yaml").resolve()
- )
- err = ft._check_sensitive_path(str(b / "config.yaml"), "default")
- # beta scope must NOT protect alpha's unrelated config (no wrong-home
- # compare in either direction).
- alpha_err = ft._check_sensitive_path(str(a / "config.yaml"), "default")
- finally:
- reset_hermes_home_override(tok)
- assert err is not None
- assert "Refusing to write to Hermes config file" in err
- assert alpha_err is None
-
- def test_home_resolver_failure_keeps_exemption_on_active_profile(
- self, tmp_path, monkeypatch
- ):
- """Opposite-side regression (PR #107335 review): when the primary home
- resolver raises, the protected-instruction exemption must still resolve
- against beta's own home (not the process/default home)."""
- import tools.file_tools_write_guards as ft
- from hermes_constants import (
- reset_hermes_home_override,
- set_hermes_home_override,
- )
-
- a, b = self._profiles(tmp_path)
-
- def boom():
- raise RuntimeError("home unavailable")
-
- monkeypatch.setattr(ft, "_hermes_home_real", boom)
-
- tok = set_hermes_home_override(str(b))
- try:
- assert ft._get_real_hermes_home() == os.path.realpath(str(b))
- # beta's own ~/.hermes tree is exempt from the project-local
- # instruction gate (governed by its config-level guards instead),
- # resolved against beta — not alpha or the default home.
- assert (
- ft._check_protected_instruction_write(
- [str(b / "AGENTS.md")], "default"
- )
- is None
- )
- finally:
- reset_hermes_home_override(tok)
-
-
-if __name__ == "__main__":
- pytest.main([__file__, "-v"])