The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): only the checkout's owner takes the launcher heal path
unsupportedpastels035f85809d01
diff --git a/hermes_cli/_launchers.py b/hermes_cli/_launchers.pyindex f94b70902d8..1566933a4be 100644--- a/hermes_cli/_launchers.py+++ b/hermes_cli/_launchers.py@@ -20,7 +20,7 @@ from pathlib import Pathif __name__ == "__main__":sys.path.insert(0, str(Path(__file__).resolve().parents[1]))-from pm.environments import store_root+from pm.environments import owning_home_root, store_rootdef _inline_string_literal(value: str) -> str:@@ -540,8 +540,11 @@ def ensure_install_launchers(repo_root: Path, out_dir: Path) -> list[str]:home = get_default_hermes_root().resolve()# The data root this checkout was installed into (<home>/hermes-agent with# <home>/tools) always republishes, which also heals an install that an- # earlier foreign launch already rebound.- owner = root.parent == home and store.resolve() == (home / "tools").resolve()+ # earlier foreign launch already rebound. The layout alone is not proof: a+ # root that only borrows the checkout can match it through+ # HERMES_RUNTIME_DIR=<home>/tools, so it must also own the checkout.+ owner = (root.parent == home and store.resolve() == (home / "tools").resolve()+ and owning_home_root(root) is None)written = []for name in WINDOWS_BIN_LAUNCHERS:# ponytail: one guard here covers every caller (launch, sync, repair,diff --git a/tests/hermes_cli/test_borrowed_home_launch.py b/tests/hermes_cli/test_borrowed_home_launch.pyindex f90c0eae24e..4789ee25a99 100644--- a/tests/hermes_cli/test_borrowed_home_launch.py+++ b/tests/hermes_cli/test_borrowed_home_launch.py@@ -97,7 +97,8 @@ def test_a_borrowers_own_dependency_state_never_makes_it_the_owner(tmp_path, mondef test_a_borrower_holding_the_checkout_never_becomes_its_owner(tmp_path, monkeypatch):"""`install.sh --dir <dir>` puts the default root's checkout in <dir>. Launching it with- HERMES_HOME=<dir> borrows, and still borrows after that root's own sync leaves state."""+ HERMES_HOME=<dir> borrows, and still borrows after that root's own sync leaves state --+ even when an explicit sync points HERMES_RUNTIME_DIR at <dir>'s own store."""import osimport pm@@ -126,6 +127,19 @@ def test_a_borrower_holding_the_checkout_never_becomes_its_owner(tmp_path, monkeassert venv_sync.prepare_launch(root, []) == pythonassert {path: Path(path).read_bytes() for path in published} == published+ # An explicit sync publishes outside prepare_launch, and <dir>/tools matches the owner layout.+ borrowed = holder / "tools" / "python-holder"+ (borrowed / ("python.exe" if os.name == "nt" else "bin/python3")).parent.mkdir(parents=True)+ (borrowed / ("python.exe" if os.name == "nt" else "bin/python3")).touch()+ (holder / "tools" / "facts.json").write_text(json.dumps(+ {"schema": 1, "packages": {"python": {"version": "fixture", "entry": borrowed.name}}}), encoding="utf-8")+ monkeypatch.setenv("HERMES_RUNTIME_DIR", str(holder / "tools"))+ monkeypatch.setattr(_launchers, "expose_cli", lambda *args, **kwargs: {"ok": True})+ assert venv_sync.sync(root)["ok"]+ assert {path: Path(path).read_bytes() for path in published} == published+ monkeypatch.delenv("HERMES_RUNTIME_DIR")+ assert owning_home_root(root) == default+def test_a_borrowing_launch_syncs_its_own_dependencies_and_nothing_of_the_checkout(tmp_path, monkeypatch, completion_tail