The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: resolve PM stamp reads through installation root
ethernetb207701287a1
diff --git a/pm/environments.py b/pm/environments.pyindex 512fa8192b7..0c6c4afcf38 100644--- a/pm/environments.py+++ b/pm/environments.py@@ -107,8 +107,10 @@ def store_root(project_root: Path) -> Path:if not store.is_relative_to(root.parent):raise RuntimeError("payload store escapes its root")return store+ from hermes_cli.steward import install_stamp_path+for directory in (root, *root.parents):- stamp = directory / "install-stamp.json"+ stamp = install_stamp_path(directory)if stamp.is_file():try:data = json.loads(stamp.read_text(encoding="utf-8-sig"))diff --git a/pm/runtime.py b/pm/runtime.pyindex 0b92d80c6c7..635500c1a27 100644--- a/pm/runtime.py+++ b/pm/runtime.py@@ -61,9 +61,9 @@ def _resident_runtime() -> tuple[Path, Path] | None:if payload is not None:runtime = payload / "pm-runtime"else:- from pm.paths import install_root+ from hermes_cli.steward import install_stamp_path- stamp_path = install_root() / "install-stamp.json"+ stamp_path = install_stamp_path(project)try:stamp = json.loads(stamp_path.read_text(encoding="utf-8-sig"))except FileNotFoundError:diff --git a/tests/hermes_cli/test_source_launcher_publication.py b/tests/hermes_cli/test_source_launcher_publication.pyindex ac416c01637..3f44154b021 100644--- a/tests/hermes_cli/test_source_launcher_publication.py+++ b/tests/hermes_cli/test_source_launcher_publication.py@@ -15,7 +15,7 @@ from pm.environments import install_state_dir, site_packagesROOT = Path(__file__).resolve().parents[2]BOOT_FILES = ("hermes_bootstrap.py", "hermes_constants.py", "hermes_cli/__init__.py", "hermes_cli/_launchers.py",- "pm/environments.py", "hermes_cli/runtime_state.py",+ "pm/environments.py", "pm/paths.py", "hermes_cli/runtime_state.py","hermes_cli/_early_recovery.py", "hermes_cli/_parser.py","hermes_cli/venv_sync.py", "hermes_cli/steward.py","hermes_cli/stderr_timestamp.py",diff --git a/tests/pm/test_runtime_entrypoints.py b/tests/pm/test_runtime_entrypoints.pyindex 606431424ec..fd6d6398fcc 100644--- a/tests/pm/test_runtime_entrypoints.py+++ b/tests/pm/test_runtime_entrypoints.py@@ -55,6 +55,22 @@ def test_ci_dependency_phase_uses_isolated_runtime(tmp_path, monkeypatch):assert all(arguments["explicit"] for _, arguments in calls)+def test_store_root_reads_executing_trees_canonical_install_stamp(tmp_path, monkeypatch):+ from pm import environments, paths++ project = tmp_path / "source"+ project.mkdir()+ package = tmp_path / "package"+ package.mkdir()+ runtime = tmp_path / "packaged-tools"+ (package / "install-stamp.json").write_text(json.dumps({"runtimeDir": str(runtime)}))+ monkeypatch.setattr(paths, "repo_root", lambda: project)+ monkeypatch.setenv("HERMES_INSTALL_ROOT", str(package))+ monkeypatch.delenv("HERMES_RUNTIME_DIR", raising=False)++ assert environments.store_root(project) == runtime++@pytest.mark.parametrize("distribution", ["nix", "docker"])def test_packaged_runtime_uses_explicit_stamp_without_tool_downloads(tmp_path, monkeypatch, distribution):from pm import runtime, paths