The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(goals): patch the registry construction seam, not hermes_state.SessionDB
Teknium915c0f806d8e
diff --git a/tests/hermes_cli/test_goals_db_bootstrap_off_loop.py b/tests/hermes_cli/test_goals_db_bootstrap_off_loop.pyindex 5bc8cae5bfe..e9650645c87 100644--- a/tests/hermes_cli/test_goals_db_bootstrap_off_loop.py+++ b/tests/hermes_cli/test_goals_db_bootstrap_off_loop.py@@ -33,7 +33,7 @@ class _RecordingDB:constructed_on: list = []- def __init__(self):+ def __init__(self, db_path=None):_RecordingDB.constructed_on.append(threading.get_ident())def get_meta(self, key):@@ -47,10 +47,12 @@ def _clean_cache(monkeypatch):yield-def _patch_sessiondb(monkeypatch):- import hermes_state+def _patch_sessiondb(monkeypatch, cls=_RecordingDB):+ # goals.py acquires through hermes_state_registry (shared writer per home); patch its+ # construction seam, and keep every acquired fake out of the registry so tests don't share.+ import hermes_state_registry- monkeypatch.setattr(hermes_state, "SessionDB", _RecordingDB)+ monkeypatch.setattr(hermes_state_registry, "_open_session_db", lambda path: cls(db_path=path))def test_loop_thread_cache_miss_constructs_off_loop(monkeypatch):@@ -119,13 +121,12 @@ def test_slow_construction_does_not_block_the_loop(monkeypatch):1.5s window plus margins; the two-window CONTRACT is what's undertest, not the production constants."""- import hermes_statemonkeypatch.setattr(goals, "_DB_BOOTSTRAP_INIT_WAIT_S", 0.3)monkeypatch.setattr(goals, "_DB_BOOTSTRAP_LOOP_WAIT_S", 0.05)class _BlockingDB:- def __init__(self):+ def __init__(self, db_path=None):# Far past both (shrunk) wait windows. The margin keeps the# "still None" assertions from racing the bootstrap thread on# a loaded runner (negative-timing race, flake policy).@@ -134,7 +135,7 @@ def test_slow_construction_does_not_block_the_loop(monkeypatch):def get_meta(self, key):return None- monkeypatch.setattr(hermes_state, "SessionDB", _BlockingDB)+ _patch_sessiondb(monkeypatch, _BlockingDB)elapsed = Noneelapsed2 = Noneresult = "UNSET"