Skip to content

The agent that grows with you

fix(gateway): the unmanaged daemon drops systemd's notify socket and watchdog too

Tekniumb5168b7f7e37
diff --git a/hermes_cli/gateway_runtime_start.py b/hermes_cli/gateway_runtime_start.py
index 3df3113815f..f5ebfb49908 100644
--- a/hermes_cli/gateway_runtime_start.py
+++ b/hermes_cli/gateway_runtime_start.py
@@ -35,6 +35,8 @@ DAEMON_STRIPPED_ENV = (
# HERMES_S6_SUPERVISED_CHILD stays: without it `gateway run` in an s6 container redirects to s6.
"XPC_SERVICE_NAME", "LAUNCHD_SOCKET", "HERMES_LAUNCHD_LABEL",
"HERMES_GATEWAY_EXTERNAL_SUPERVISOR", "HERMES_SUPERVISED_CHILD",
+ # systemd's notify socket and watchdog name the unit's main process: the daemon would feed them.
+ "NOTIFY_SOCKET", "WATCHDOG_USEC", "WATCHDOG_PID",
)
diff --git a/tests/hermes_cli/test_daemon_launch_env_strip.py b/tests/hermes_cli/test_daemon_launch_env_strip.py
index 034850b8035..eb616c9826d 100644
--- a/tests/hermes_cli/test_daemon_launch_env_strip.py
+++ b/tests/hermes_cli/test_daemon_launch_env_strip.py
@@ -21,7 +21,9 @@ LEAKS = {**SUPERVISOR_LEAKS, 'HERMES_ACCEPT_HOOKS': '1', 'HERMES_KANBAN_TASK': '
'HERMES_SESSION_ID': 'launching-turn', 'HERMES_SESSION_KEY': 'agent:main:tui:x',
'HERMES_SESSION_PLATFORM': 'tui', 'HERMES_SESSION_CHAT_ID': 'c1', 'HERMES_CRON_SESSION': '1',
# A terminal running under a systemd service: not the daemon's own supervisor.
- 'INVOCATION_ID': 'terminal-scope', 'JOURNAL_STREAM': '8:1'}
+ 'INVOCATION_ID': 'terminal-scope', 'JOURNAL_STREAM': '8:1',
+ # A process below a Type=notify gateway: the unit's notify socket and watchdog are its main PID's.
+ 'NOTIFY_SOCKET': '/run/user/1000/systemd/notify', 'WATCHDOG_USEC': '30000000', 'WATCHDOG_PID': '4242'}
@pytest.mark.platforms("linux")