Skip to content

The agent that grows with you

fix(tests): the settled-host-record fixture holds the host lock like a live gateway

Tekniumffe1ae883b0a
diff --git a/tests/gateway/test_host_gateway_profile_env.py b/tests/gateway/test_host_gateway_profile_env.py
index 2e1ab65431f..28cac970f30 100644
--- a/tests/gateway/test_host_gateway_profile_env.py
+++ b/tests/gateway/test_host_gateway_profile_env.py
@@ -162,6 +162,10 @@ class TestSettledHostRecordDecidesRestart:
lock_dir = tmp_path / "locks"
lock_dir.mkdir(parents=True, exist_ok=True)
monkeypatch.setenv("HERMES_GATEWAY_LOCK_DIR", str(lock_dir))
+ # A live owner holds the host lock for its lifetime (run.py claims before it publishes).
+ # The handle lives in a per-test copy of the registry (and a per-test lock dir), so undo drops it.
+ monkeypatch.setattr(hr, "_lock_handles", dict(hr._lock_handles))
+ assert hr.claim_host_lock(hr.ROLE_GATEWAY)[0] is hr.HostLockOutcome.ACQUIRED
record = hr.publish_record(
hr.ROLE_GATEWAY, profiles=tuple(profiles), home=str(home),
)