The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): bind the loop-tick witness under a short HERMES_HOME
Teknium57d305d57f04
diff --git a/tests/gateway/test_shutdown_watchdog.py b/tests/gateway/test_shutdown_watchdog.pyindex 0d8ae926236..6ce870e1720 100644--- a/tests/gateway/test_shutdown_watchdog.py+++ b/tests/gateway/test_shutdown_watchdog.py@@ -12,8 +12,11 @@ import contextlibimport jsonimport loggingimport os+import shutil+import tempfileimport threadingimport time+from pathlib import Pathfrom unittest.mock import patchimport gateway.shutdown_watchdog as shutdown_watchdog_module@@ -103,10 +106,28 @@ async def _run_heartbeat_until_payload(tmp_path, timeout_s=10.0):return payload+def short_home():+ """Short HERMES_HOME for tests that bind a real AF_UNIX socket.++ pytest's tmp_path nests deep enough on CI runners / macOS that+ ``state/gateway.loop-tick.<pid>.sock`` exceeds the sockaddr_un limit and+ bind() raises ``OSError: AF_UNIX path too long`` — which the producer+ swallows into ``loop_tick_socket=False``, falsely failing the POSIX arm+ test. Same pattern as tests/hermes_cli/test_update_wedged_gateway.py.+ """+ path = Path(tempfile.mkdtemp(prefix="hsw-"))+ try:+ yield path+ finally:+ shutil.rmtree(path, ignore_errors=True)++@pytest.mark.asyncioasync def test_loop_tick_witness_skipped_intentionally_on_windows(- tmp_path, caplog, monkeypatch+ short_home, caplog, monkeypatch):+ tmp_path = short_home# Pretend the platform is Windows as seen from the module under test.# A plain monkeypatch of the global os.name would flip pathlib.Path# dispatch (Path.__new__ reads os.name at runtime) and crash pytest's@@ -147,6 +168,6 @@ async def test_loop_tick_witness_skipped_intentionally_on_windows(@pytest.mark.asyncio-async def test_loop_tick_witness_arms_on_posix(tmp_path):- payload = await _run_heartbeat_until_payload(tmp_path)+async def test_loop_tick_witness_arms_on_posix(short_home):+ payload = await _run_heartbeat_until_payload(short_home)assert payload["loop_tick_socket"] is True