The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(e2e/hosts): split symlinked-home cell into its own file; gate #123424 on the PATH count only
teknium1b7990b6f7e83
diff --git a/tests/e2e/core/upgrade/hosts/test_path_shapes.py b/tests/e2e/core/upgrade/hosts/test_path_shapes.pyindex 42bcb1159fd..ca1fd43ffa6 100644--- a/tests/e2e/core/upgrade/hosts/test_path_shapes.py+++ b/tests/e2e/core/upgrade/hosts/test_path_shapes.py@@ -4,7 +4,8 @@ Failure class: PATH shapes. Two things users report once the install "works":* the installer's PATH wiring duplicates ``~/.local/bin`` when the distro's own startup filesalready put it on PATH with a bare ``PATH=...`` assignment (Fedora ``.bashrc``, Debian- ``.profile``), and a re-run appends again (gated on #123424);+ ``.profile``), so a login shell carries it more than once (gated on #123424); a re-run of the+ installer must not edit the startup files again;* a node/npm the user already has, earlier on PATH, either shadows the managed toolchain whereHermes needs the managed one (the TUI/web builds), or the managed node is forced onto an MCPserver the user configured with their own ``node`` (gated on #124264).@@ -175,16 +176,15 @@ def test_login_shell_has_local_bin_once_with_stock_fedora_startup_files(world):assert rerun.returncode == 0, "re-running install.sh failed:\n" + I.describe(rerun)rc_after_rerun = {n: (sb.home / n).read_text(encoding="utf-8") for n in FEDORA_SKEL}count_rerun, line_rerun = _local_bin_count(sb)- with known_failure(r"~/\.local/bin (appears [2-9]\d* times|was appended to stock startup files)",+ assert rc_after_rerun == world["rc_after_install"], (+ "re-running the installer edited the startup files again: "+ f"{[n for n in FEDORA_SKEL if rc_after_rerun[n] != world['rc_after_install'][n]]}")+ with known_failure(r"~/\.local/bin appears [2-9]\d* times","gated on #123424: wire_shell_path's existing-setup regex misses bare PATH= assignments"):- assert rc_after_rerun == world["rc_after_install"], (- "re-running the installer edited the startup files again: "- f"{[n for n in FEDORA_SKEL if rc_after_rerun[n] != world['rc_after_install'][n]]}")changed = [n for n, text in FEDORA_SKEL.items() if world["rc_after_install"][n] != text]assert count == 1 and count_rerun == 1, (f"~/.local/bin appears {count} times on a login shell's PATH after install ({count_rerun} after a re-run):\n"f"{line_rerun}\n(startup files the installer changed: {changed})")- assert not changed, f"~/.local/bin was appended to stock startup files that already set it: {changed}"def test_mcp_server_configured_with_the_users_node_runs_on_the_users_node(world, provider):diff --git a/tests/e2e/core/upgrade/hosts/test_paths.py b/tests/e2e/core/upgrade/hosts/test_paths.pyindex b864d4f9c45..ce6ed7cf500 100644--- a/tests/e2e/core/upgrade/hosts/test_paths.py+++ b/tests/e2e/core/upgrade/hosts/test_paths.py@@ -1,20 +1,15 @@-"""Install, update, gateway and a turn on homes whose paths are not plain ASCII.+"""Install, update, gateway and a turn in a home whose path has spaces and non-ASCII bytes.Failure class: path handling. Users run Hermes from homes like ``/home/José Müller`` or a-CJK-named directory, and keep ``~/.hermes`` (or just its ``tools`` store) on another disk behind a-symlink. Every path the installer and updater write (clone target, uv/python/node store, PM-generation, the ``~/.local/bin/hermes`` launcher, the rc-file PATH line, sys.path) must survive a-space, non-ASCII bytes and a symlink hop, and must stay stable from one launch to the next.--Two real installs through HEAD's ``scripts/install.sh``:--* ``odd_home``: the whole sandbox (HOME, HERMES_HOME, TMPDIR) lives under- ``José Müller 漢字 dir``. Then a one-shot turn, a new login shell resolving ``hermes``, an- upstream release and ``hermes update``, a turn on the new commit and ``hermes gateway run``.-* ``linked_home``: ``~/.hermes`` is a symlink to a directory on "another volume" (a path with a- space and a non-ASCII char); plain launches through it must not re-run the source-update- completion. An orchestrator-style per-task HERMES_HOME reaches the same ``tools``/``installs`` through- symlinks, which must not change the PM runtime's identity either (gated on #123798).+CJK-named directory. Every path the installer and updater write (clone target, uv/python/node+store, PM generation, the ``~/.local/bin/hermes`` launcher, the rc-file PATH line, sys.path) must+survive a space and non-ASCII bytes.++One real install through HEAD's ``scripts/install.sh`` with the whole sandbox (HOME, HERMES_HOME,+TMPDIR) under ``José Müller 漢字 dir``; then a one-shot turn, a new login shell resolving+``hermes``, an upstream release and ``hermes update``, a turn on the new commit and+``hermes gateway run``. The symlinked-home shapes live in ``test_paths_symlinked.py`` so the two+installs run in parallel."""from __future__ import annotations@@ -24,7 +19,6 @@ import shutilimport pytest-from tests.e2e.core._pending_fixes import known_failurefrom tests.e2e.core.upgrade import _helpers as Hfrom tests.e2e.core.upgrade import _install_helpers as Ifrom tests.e2e.core.upgrade.hosts import _hosts as X@@ -39,7 +33,6 @@ pytestmark = []ODD_DIR = "José Müller 漢字 dir"-VOLUME_DIR = "external volume ü"@pytest.fixture(scope="module")@@ -59,22 +52,6 @@ def odd_home(tmp_path_factory, provider):return {"sb": sb, "origin": origin, "root": root, "install": first}[email protected](scope="module")-def linked_home(tmp_path_factory, provider):- root = tmp_path_factory.mktemp("paths-linked")- origin = X.make_origin(root)- sb = X.new_sandbox(root / "sb", origin)- real = root / "sb" / VOLUME_DIR / "hermes-data"- real.mkdir(parents=True)- os.symlink(real, sb.hermes_home)- first = I.run_installer(sb)- return {"sb": sb, "origin": origin, "root": root, "real": real, "install": first}---def _pending_markers(sb: I.Sandbox) -> list[str]:- return sorted(str(p) for p in (sb.hermes_home / "installs").glob("*/source-completion-pending"))--def test_install_update_gateway_and_turn_under_a_non_ascii_spaced_home(odd_home, provider):sb, first = odd_home["sb"], odd_home["install"]assert ODD_DIR in str(sb.home), "harness: sandbox HOME is not under the odd directory"@@ -113,34 +90,3 @@ def test_install_update_gateway_and_turn_under_a_non_ascii_spaced_home(odd_home,assert st.get("pid") and gw.proc.poll() is None, f"gateway state says running but the process is gone: {st}\n{gw.tail()}"finally:gw.stop()---def test_per_task_home_sharing_the_tools_store_by_symlink_is_current(linked_home, provider):- """An orchestrator's per-task HERMES_HOME whose ``tools``/``installs`` link back to the main home.-- Precondition (not gated): the main home is itself a symlink, and plain launches through it are- current; only the per-task home's launch is the #123798 gap.- """- sb, first = linked_home["sb"], linked_home["install"]- assert sb.hermes_home.is_symlink(), "harness: ~/.hermes is not a symlink"- assert first.returncode == 0, "install.sh failed with ~/.hermes behind a symlink:\n" + I.describe(first)- assert (linked_home["real"] / "hermes-agent" / ".git").exists(), "install did not land on the symlink's target"- X.configure(sb, provider)- alt = linked_home["root"] / "per-task home ü"- alt.mkdir()- for name in ("tools", "installs"):- os.symlink(sb.hermes_home / name, alt / name)- for name in ("config.yaml", ".env"):- shutil.copy(sb.hermes_home / name, alt / name)- launches = [X.turn(sb, provider, f"turn {i} through the symlinked main home") for i in range(2)]- reruns = [i for i, cp in enumerate(launches) if X.reran_completion(cp)]- assert not reruns, (f"plain launches {reruns} through a symlinked ~/.hermes re-ran the source-update completion:\n"- + I.describe(launches[reruns[0]]))- assert not _pending_markers(sb), f"a plain launch left source-completion-pending markers: {_pending_markers(sb)}"- task = X.turn(sb, provider, "turn in a per-task home", env=dict(sb.env, HERMES_HOME=str(alt)))- with known_failure(r"per-task HERMES_HOME .* re-ran the source-update completion",- "gated on #123798: store_root() returns the unresolved $HERMES_HOME/tools, so the same "- "store through a symlink is a different PM runtime identity"):- assert not X.reran_completion(task), (- "a per-task HERMES_HOME whose tools/installs symlink to the main home re-ran the source-update "- "completion on a current install:\n" + I.describe(task))diff --git a/tests/e2e/core/upgrade/hosts/test_paths_symlinked.py b/tests/e2e/core/upgrade/hosts/test_paths_symlinked.pynew file mode 100644index 00000000000..140b252ed12--- /dev/null+++ b/tests/e2e/core/upgrade/hosts/test_paths_symlinked.py@@ -0,0 +1,87 @@+"""Launches through a symlinked ``~/.hermes`` and a per-task home that links back to it.++Failure class: path handling. Users keep ``~/.hermes`` on another disk behind a symlink, and+orchestrators give each task its own HERMES_HOME whose ``tools``/``installs`` link back to the+main home. The PM runtime identity must not depend on which spelling of the path a launch used,+or every launch re-runs the source-update completion.++One real install through HEAD's ``scripts/install.sh`` with ``~/.hermes`` a symlink to a directory+on "another volume" (a path with a space and a non-ASCII char). Plain launches through it must be+current (a precondition), and so must a launch from the per-task home (gated on #123798).+"""++from __future__ import annotations++import os+import shutil++import pytest++from tests.e2e.core._pending_fixes import known_failure+from tests.e2e.core.upgrade import _helpers as H+from tests.e2e.core.upgrade import _install_helpers as I+from tests.e2e.core.upgrade.hosts import _hosts as X+from tests.fakes.fake_llm_provider import FakeLLMServer++pytestmark = [+ pytest.mark.platforms("linux"),+ pytest.mark.live_system_guard_bypass,+ pytest.mark.skipif(H.sandbox_required_reason() is not None, reason=str(H.sandbox_required_reason())),+ pytest.mark.skipif(shutil.which("git") is None, reason="git required"),+ pytest.mark.skipif(I.real_uv() is None, reason="uv required"),+]++VOLUME_DIR = "external volume ü"++[email protected](scope="module")+def provider():+ with FakeLLMServer(default_text="fake reply for the host-paths suite") as srv:+ yield srv++[email protected](scope="module")+def linked_home(tmp_path_factory, provider):+ root = tmp_path_factory.mktemp("paths-linked")+ origin = X.make_origin(root)+ sb = X.new_sandbox(root / "sb", origin)+ real = root / "sb" / VOLUME_DIR / "hermes-data"+ real.mkdir(parents=True)+ os.symlink(real, sb.hermes_home)+ first = I.run_installer(sb)+ return {"sb": sb, "origin": origin, "root": root, "real": real, "install": first}+++def _pending_markers(sb: I.Sandbox) -> list[str]:+ return sorted(str(p) for p in (sb.hermes_home / "installs").glob("*/source-completion-pending"))+++def test_per_task_home_sharing_the_tools_store_by_symlink_is_current(linked_home, provider):+ """An orchestrator's per-task HERMES_HOME whose ``tools``/``installs`` link back to the main home.++ Precondition (not gated): the main home is itself a symlink, and plain launches through it are+ current; only the per-task home's launch is the #123798 gap.+ """+ sb, first = linked_home["sb"], linked_home["install"]+ assert sb.hermes_home.is_symlink(), "harness: ~/.hermes is not a symlink"+ assert first.returncode == 0, "install.sh failed with ~/.hermes behind a symlink:\n" + I.describe(first)+ assert (linked_home["real"] / "hermes-agent" / ".git").exists(), "install did not land on the symlink's target"+ X.configure(sb, provider)+ alt = linked_home["root"] / "per-task home ü"+ alt.mkdir()+ for name in ("tools", "installs"):+ os.symlink(sb.hermes_home / name, alt / name)+ for name in ("config.yaml", ".env"):+ shutil.copy(sb.hermes_home / name, alt / name)+ launches = [X.turn(sb, provider, f"turn {i} through the symlinked main home") for i in range(2)]+ reruns = [i for i, cp in enumerate(launches) if X.reran_completion(cp)]+ assert not reruns, (f"plain launches {reruns} through a symlinked ~/.hermes re-ran the source-update completion:\n"+ + I.describe(launches[reruns[0]]))+ assert not _pending_markers(sb), f"a plain launch left source-completion-pending markers: {_pending_markers(sb)}"+ task = X.turn(sb, provider, "turn in a per-task home", env=dict(sb.env, HERMES_HOME=str(alt)))+ with known_failure(r"per-task HERMES_HOME .* re-ran the source-update completion",+ "gated on #123798: store_root() returns the unresolved $HERMES_HOME/tools, so the same "+ "store through a symlink is a different PM runtime identity"):+ assert not X.reran_completion(task), (+ "a per-task HERMES_HOME whose tools/installs symlink to the main home re-ran the source-update "+ "completion on a current install:\n" + I.describe(task))