The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(terminal): pin the profile-home mode in the background PATH test
Teknium854cef24e9f1
diff --git a/tests/tools/test_login_shell_path_preservation.py b/tests/tools/test_login_shell_path_preservation.pyindex b7c1aa669b3..707b8a99afe 100644--- a/tests/tools/test_login_shell_path_preservation.py+++ b/tests/tools/test_login_shell_path_preservation.py@@ -149,11 +149,16 @@ def test_background_command_keeps_spawn_path_dirs_a_login_profile_resets(tmp_patfor d in (profile_bin, parent_bin):d.mkdir()_exe(parent_bin, "only-in-parent")- (tmp_path / ".profile").write_text(f'PATH="{profile_bin}:/usr/local/bin:/usr/bin:/bin"\n')- monkeypatch.setenv("HOME", str(tmp_path))+ # Spawns re-derive HOME (a host keeps the real one), so pin the profile-home mode: the+ # login shell then reads {HERMES_HOME}/home/.profile on every runner.+ from hermes_constants import get_hermes_home++ login_home = get_hermes_home() / "home"+ login_home.mkdir(parents=True, exist_ok=True)+ (login_home / ".profile").write_text(f'PATH="{profile_bin}:/usr/local/bin:/usr/bin:/bin"\n')+ monkeypatch.setenv("TERMINAL_HOME_MODE", "profile")registry = ProcessRegistry()- # HOME rides in the spawn env: without it the login shell reads the runner's own ~/.profile.- session = _spawn(registry, env=SimpleNamespace(env={"PATH": f"{parent_bin}:/usr/bin:/bin", "HOME": str(tmp_path)}),+ session = _spawn(registry, env=SimpleNamespace(env={"PATH": f"{parent_bin}:/usr/bin:/bin"}),env_type="local", command='only-in-parent; printf "HOME=%s\\nPATH=%s\\n" "$HOME" "$PATH"',cwd=str(tmp_path), effective_task_id="t", task_id="t", session_key="",effective_pty=False)@@ -162,7 +167,7 @@ def test_background_command_keeps_spawn_path_dirs_a_login_profile_resets(tmp_pattime.sleep(0.05)assert session.exited, session.output_bufferassert "parent-bin" in session.output_buffer.split(), session.output_buffer- assert f"HOME={tmp_path}" in session.output_buffer.splitlines(), session.output_buffer+ assert f"HOME={login_home}" in session.output_buffer.splitlines(), session.output_bufferpath_line = next(ln for ln in session.output_buffer.splitlines() if ln.startswith("PATH="))entries = path_line.removeprefix("PATH=").split(":")assert entries[0] == str(profile_bin)