Skip to content

The agent that grows with you

test: terminal child env carries HOME when the host has none

teknium1641679058f7c
diff --git a/tests/tools/test_subprocess_home_isolation.py b/tests/tools/test_subprocess_home_isolation.py
index 70bc05d05c3..09eb6a79149 100644
--- a/tests/tools/test_subprocess_home_isolation.py
+++ b/tests/tools/test_subprocess_home_isolation.py
@@ -62,6 +62,22 @@ class TestGetSubprocessHome:
from hermes_constants import get_subprocess_home
assert get_subprocess_home() == str(real_home)
+ def test_terminal_child_env_carries_home_when_host_has_none(self, tmp_path, monkeypatch):
+ """A host with no HOME at all (systemd system unit without User=) must still hand
+ terminal children a HOME; without it a `set -u` script dies on its first `$HOME` (#116081).
+
+ Drives the production spawn seam, tools.environments.local.build_subprocess_env, not the
+ resolver directly.
+ """
+ self._host_mode(monkeypatch)
+ real_home = tmp_path / "real-home"
+ real_home.mkdir()
+ monkeypatch.delenv("HOME", raising=False)
+ monkeypatch.setenv("HERMES_REAL_HOME", str(real_home))
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+ from tools.environments.local import build_subprocess_env
+ assert build_subprocess_env()["HOME"] == str(real_home)
+
def test_container_auto_uses_profile_home_when_home_dir_exists(self, tmp_path, monkeypatch):
self._container_mode(monkeypatch)
hermes_home = tmp_path / ".hermes"