Skip to content

The agent that grows with you

fix(tests): goal-verdict tests stop flaking when SessionDB init overruns the loop-thread grace window

Tekniumc70e15251dc2
diff --git a/tests/gateway/test_goal_verdict_send.py b/tests/gateway/test_goal_verdict_send.py
index 9c24526c510..08b4ec1c7bb 100644
--- a/tests/gateway/test_goal_verdict_send.py
+++ b/tests/gateway/test_goal_verdict_send.py
@@ -30,6 +30,15 @@ def hermes_home(tmp_path, monkeypatch):
from hermes_cli import goals
goals._DB_CACHE.clear()
+ # Pre-warm the SessionDB cache from this SYNC context. The tests call
+ # GoalManager.set() on the event-loop thread, where _get_session_db()
+ # refuses to construct SessionDB inline (loop-liveness guard) and only
+ # waits _DB_BOOTSTRAP_LOOP_WAIT_S for a background bootstrap. On a loaded
+ # CI runner the init overruns that window, the goal write is silently
+ # dropped by design, and the continuation path no-ops — the recurring
+ # sends == [] flake. Warming here uses the direct construction path, so
+ # the loop-thread set() always finds a cached DB.
+ goals._get_session_db()
yield home
goals._DB_CACHE.clear()