Skip to content

The agent that grows with you

test(e2e/hosts): read-only checkout for update refusal; fold symlinked-home check into per-task cell; order shim-log check first

teknium104b13e3c00e0
diff --git a/tests/e2e/core/upgrade/hosts/test_path_shapes.py b/tests/e2e/core/upgrade/hosts/test_path_shapes.py
index f4b058220a1..42bcb1159fd 100644
--- a/tests/e2e/core/upgrade/hosts/test_path_shapes.py
+++ b/tests/e2e/core/upgrade/hosts/test_path_shapes.py
@@ -155,10 +155,12 @@ def _calls(world) -> list[str]:
def test_user_node_first_on_path_does_not_shadow_the_managed_toolchain(world, provider):
sb, first = world["sb"], world["install"]
- assert first.returncode == 0, "install.sh failed with the user's own node first on PATH:\n" + I.describe(first)
+ # The shim log first: when the user's node is picked up the build usually dies on it, and the
+ # log names that root cause where the exit code alone would not.
used = [c for c in _calls(world) if not re.fullmatch(r"(node|npm|npx) (--version|-v)", c)]
assert not used, ("the installer ran the user's node/npm for real work instead of the managed toolchain:\n"
+ "\n".join(used) + "\n" + I.describe(first))
+ assert first.returncode == 0, "install.sh failed with the user's own node first on PATH:\n" + I.describe(first)
X.ok(sb.cli("--version"))
X.configure(sb, provider)
X.turn(sb, provider, "turn with the user's node first on PATH")
diff --git a/tests/e2e/core/upgrade/hosts/test_paths.py b/tests/e2e/core/upgrade/hosts/test_paths.py
index 47f4d794ec0..b864d4f9c45 100644
--- a/tests/e2e/core/upgrade/hosts/test_paths.py
+++ b/tests/e2e/core/upgrade/hosts/test_paths.py
@@ -12,8 +12,8 @@ Two real installs through HEAD's ``scripts/install.sh``:
``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 must not re-run the source-update completion. Then
- an orchestrator-style per-task HERMES_HOME reaches the same ``tools``/``installs`` through
+ 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).
"""
@@ -115,32 +115,28 @@ def test_install_update_gateway_and_turn_under_a_non_ascii_spaced_home(odd_home,
gw.stop()
-def test_symlinked_hermes_home_launches_without_rerunning_the_completion(linked_home, provider):
+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)
- launches = [X.turn(sb, provider, f"turn {i} through a symlinked HERMES_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} re-ran the source-update completion on a healthy install:\n"
- + I.describe(launches[reruns[0]]))
- assert not _pending_markers(sb), f"a plain launch left source-completion-pending markers: {_pending_markers(sb)}"
-
-
-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."""
- sb = linked_home["sb"]
- assert linked_home["install"].returncode == 0, I.describe(linked_home["install"])
- 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)
- main = X.turn(sb, provider, "control turn in the main home")
- assert not X.reran_completion(main), "control: the main home itself re-ran the completion:\n" + I.describe(main)
+ 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 "
diff --git a/tests/e2e/core/upgrade/hosts/test_permissions.py b/tests/e2e/core/upgrade/hosts/test_permissions.py
index b5cc9387363..bd053ac224c 100644
--- a/tests/e2e/core/upgrade/hosts/test_permissions.py
+++ b/tests/e2e/core/upgrade/hosts/test_permissions.py
@@ -74,6 +74,12 @@ def world(tmp_path_factory, provider):
try:
out["ro_turn"] = sb.run([sb.hermes, "-z", "turn on a read-only install tree"], timeout=900)
out["ro_turn_requests"] = len(provider.main_requests()) - n
+ finally:
+ _chmod_code(sb, writable=True)
+ # Only the checkout read-only: the launch path works (#124635 needs installs/ too), so
+ # this reaches `hermes update`'s own handling of a tree it cannot write.
+ subprocess.run(["chmod", "-R", "a-w", str(sb.checkout)], check=True)
+ try:
out["ro_update"] = sb.cli("update", "--yes", "--branch", "main", timeout=X.UPDATE_TIMEOUT)
out["ro_head"] = I.git("rev-parse", "HEAD", cwd=sb.checkout)
finally: