The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(tools): exercise real reaction acquisition and refusal boundaries
funky-xamarind7b120f05691
diff --git a/tests/tools/test_reaction_session_identity.py b/tests/tools/test_reaction_session_identity.pyindex 7551cce7c6b..74b8dbf2ffc 100644--- a/tests/tools/test_reaction_session_identity.py+++ b/tests/tools/test_reaction_session_identity.py@@ -22,7 +22,8 @@ def test_reaction_uses_durable_session_with_routing_key(tmp_path, monkeypatch, rdb.append_message("chat-b", "user", "Other conversation")foreign = db.latest_message_row_id("chat-b", role="user")emitted = []- monkeypatch.setattr(reactions, "_open_session_db", lambda: SessionDB(db_path=path))+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ monkeypatch.setattr("hermes_state.DEFAULT_DB_PATH", path) # conftest pins this per testmonkeypatch.setattr(reactions.desktop_ui, "emit", lambda *args: emitted.append(args))tokens = set_session_vars(session_key=routing_key, session_id="chat-a")try:@@ -43,8 +44,10 @@ def test_reaction_uses_durable_session_with_routing_key(tmp_path, monkeypatch, rassert reopened.get_message_reactions("chat-a", latest)[0]["emoji"] == "π"assert reopened.get_message_reactions("chat-a", earlier) == []assert reopened.get_message_reactions("chat-b", foreign) == []- assert len(emitted) == 4+ assert [payload["row_id"] for _, payload in emitted] == [latest, earlier, earlier, earlier]assert all(name == "message.reaction" for name, _ in emitted)+ assert emitted[0][1]["reactions"][0]["emoji"] == "π"+ assert emitted[-1][1]["reactions"] == []def test_reaction_keeps_legacy_key_fallback_and_empty_session(tmp_path, monkeypatch):@@ -52,8 +55,20 @@ def test_reaction_keeps_legacy_key_fallback_and_empty_session(tmp_path, monkeypawith SessionDB(db_path=path) as db:db.create_session("legacy", "local")db.append_message("legacy", "user", "Legacy message")- monkeypatch.setattr(reactions, "_open_session_db", lambda: SessionDB(db_path=path))- monkeypatch.setattr(reactions.desktop_ui, "emit", lambda *_args: None)+ row = db.latest_message_row_id("legacy", role="user")+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ monkeypatch.setattr("hermes_state.DEFAULT_DB_PATH", path) # conftest pins this per test+ emitted = []+ monkeypatch.setattr(reactions.desktop_ui, "emit", lambda *args: emitted.append(args))+ tokens = set_session_vars(session_key="legacy", session_id="missing")+ try:+ result = json.loads(reactions.registry.dispatch("react_to_message", {"emoji": "π"}))+ assert "No user message" in result["error"]+ assert emitted == []+ finally:+ clear_session_vars(tokens)+ with SessionDB(db_path=path) as db:+ assert db.get_message_reactions("legacy", row) == []tokens = set_session_vars(session_key="legacy", session_id="")try:assert json.loads(reactions.registry.dispatch("react_to_message", {"emoji": "π"}))["success"]