The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(memory): collapse the PLG-11 and RT-32 parametrizations onto their invariants
unsupportedpastelsa7e4317ca52a
diff --git a/tests/agent/test_memory_provider_caller_profile.py b/tests/agent/test_memory_provider_caller_profile.pyindex 00f09a59a6a..019f3d01e0b 100644--- a/tests/agent/test_memory_provider_caller_profile.py+++ b/tests/agent/test_memory_provider_caller_profile.py@@ -161,13 +161,13 @@ def multiplexed():reset_multiplex_context(token)[email protected]("dispatch", [_sequential, _concurrent])-def test_call_from_another_profiles_scope_is_refused(homes, dispatch, caplog):+def test_call_from_another_profiles_scope_is_refused(homes, caplog):alpha_home, beta_home = homesalpha = _agent(alpha_home, "agent:alpha:api_server:dm:1")- with _Scope(beta_home): # the turn's scope names a profile this manager never served- result = json.loads(dispatch(alpha, "stray"))- _assert_generic_refusal(result, caplog, alpha_home, beta_home)+ for dispatch in (_sequential, _concurrent):+ with _Scope(beta_home): # the turn's scope names a profile this manager never served+ result = json.loads(dispatch(alpha, "stray"))+ _assert_generic_refusal(result, caplog, alpha_home, beta_home)assert _ProcessWideProvider.stores == {}@@ -180,20 +180,20 @@ def test_multiplexed_call_with_no_known_profile_is_refused(homes, multiplexed, cassert _ProcessWideProvider.stores == {}[email protected]("dispatch", [_sequential, _concurrent])def test_multiplexed_call_without_a_caller_scope_is_refused_even_for_the_process_profile(- homes, dispatch, multiplexed, monkeypatch, caplog):+ homes, multiplexed, monkeypatch, caplog):# The manager serves the process's own (launch) profile, but on a multiplexed process a call that# names no profile is not proof it came from that profile's turn.alpha_home, _ = homesmonkeypatch.setenv("HERMES_HOME", str(alpha_home))alpha = _agent(alpha_home, "agent:alpha:api_server:dm:1")- token = set_hermes_home_override(None)- try:- result = json.loads(dispatch(alpha, "unscoped"))- finally:- reset_hermes_home_override(token)- _assert_generic_refusal(result, caplog, alpha_home)+ for dispatch in (_sequential, _concurrent):+ token = set_hermes_home_override(None)+ try:+ result = json.loads(dispatch(alpha, "unscoped"))+ finally:+ reset_hermes_home_override(token)+ _assert_generic_refusal(result, caplog, alpha_home)assert _ProcessWideProvider.stores == {}@@ -313,24 +313,31 @@ _HOOKS = {}[email protected]("hook", sorted(_HOOKS))-def test_lifecycle_hook_from_another_profiles_scope_is_refused(homes, hook, caplog):+def _refused_hooks(caplog) -> set:+ return {r.args[0].removeprefix("hook ") for r in caplog.records+ if r.name == "agent.memory_caller_scope" and _REFUSAL_CODE in r.getMessage()}+++def test_lifecycle_hooks_from_another_profiles_scope_are_refused(homes, caplog):+ # Every hook has its own guard: each one is driven, and each must log its own refusal.alpha_home, beta_home = homesalpha = _manager(alpha_home)with _Scope(beta_home):- _HOOKS[hook](alpha)+ for hook in _HOOKS.values():+ hook(alpha)assert _InstanceScopedProvider.events == []- logged = "\n".join(r.getMessage() for r in caplog.records if r.name == "agent.memory_caller_scope")- assert _REFUSAL_CODE in logged and str(beta_home) in logged, logged+ assert _refused_hooks(caplog) == set(_HOOKS)+ assert all(str(beta_home) in r.getMessage() for r in caplog.records if r.name == "agent.memory_caller_scope")[email protected]("hook", sorted(_HOOKS))-def test_multiplexed_lifecycle_hook_without_a_caller_scope_is_refused(homes, hook, multiplexed, monkeypatch):+def test_multiplexed_lifecycle_hooks_without_a_caller_scope_are_refused(homes, multiplexed, monkeypatch, caplog):alpha_home, _ = homesmonkeypatch.setenv("HERMES_HOME", str(alpha_home))alpha = _manager(alpha_home)- _HOOKS[hook](alpha)+ for hook in _HOOKS.values():+ hook(alpha)assert _InstanceScopedProvider.events == []+ assert _refused_hooks(caplog) == set(_HOOKS)def test_tool_calls_reuse_what_initialize_bound(homes, monkeypatch):diff --git a/tests/gateway/test_legacy_stamped_bot_chat.py b/tests/gateway/test_legacy_stamped_bot_chat.pyindex c5b6a917332..edf8f53cff8 100644--- a/tests/gateway/test_legacy_stamped_bot_chat.py+++ b/tests/gateway/test_legacy_stamped_bot_chat.py@@ -70,7 +70,7 @@ async def _bot_chat_lookup(tmp_path, monkeypatch, source, user_id):@pytest.mark.asyncio[email protected]('source', ['cli', 'tui', 'gui', 'desktop'])[email protected]('source', ['cli', 'desktop'])async def test_bot_chat_stamped_with_the_callers_own_subject_opens(tmp_path, monkeypatch, source):replies = await _bot_chat_lookup(tmp_path, monkeypatch, source, _OWN)for prof, reply in replies.items():@@ -81,9 +81,8 @@ async def test_bot_chat_stamped_with_the_callers_own_subject_opens(tmp_path, mon@pytest.mark.asyncio@pytest.mark.parametrize('user_id', _FOREIGN)[email protected]('source', ['cli', 'tui', 'gui'])-async def test_bot_chat_stamped_with_another_principal_stays_refused(tmp_path, monkeypatch, source, user_id):- replies = await _bot_chat_lookup(tmp_path, monkeypatch, source, user_id)+async def test_bot_chat_stamped_with_another_principal_stays_refused(tmp_path, monkeypatch, user_id):+ replies = await _bot_chat_lookup(tmp_path, monkeypatch, 'cli', user_id)for prof, reply in replies.items():assert reply.get('error', {}).get('message') == 'not_found', (prof, reply)