The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(pm): pin the Docker image's own manifest shape in the on-tree payload test
kshitijk4poorac0815be60f7
diff --git a/pm/environments.py b/pm/environments.pyindex 8e436d5f99b..be675bc0a01 100644--- a/pm/environments.py+++ b/pm/environments.py@@ -184,7 +184,7 @@ def _payload_path(payload_root: Path, relative: str, what: str) -> Path:def payload_venv(project_root: Path) -> Path | None:- """The environment a sealed payload ships beside its tree, or ``None``."""+ """The environment a sealed payload ships with its tree, or ``None``."""root = Path(project_root).resolve()payload = _payload_manifest(root)venv = payload[0].get("venv") if payload else Nonediff --git a/tests/scripts/test_agent_build.py b/tests/scripts/test_agent_build.pyindex c1aed3d4f73..cf80afdb46e 100644--- a/tests/scripts/test_agent_build.py+++ b/tests/scripts/test_agent_build.py@@ -185,20 +185,38 @@ def test_fixed_layout_manifest_makes_the_tree_a_resolvable_payload(tmp_path):itself. A store-Python child boots through committed_venv(), which resolves thesealed venv from that manifest; without it every runtime_command child died with"no dependency environment is committed for this install".++ docker/build_agent.py passes the venv's own ``python``, which links out of the tree+ (/usr/local/bin/python3) and back to the bundled interpreter, so the manifest's+ storePython is the venv's ``bin/python`` (``.venv/bin/python`` in the image) and+ venv_command must follow that chain."""out, data = inputs_fixture(tmp_path)shutil.copytree(data["code"], out, dirs_exist_ok=True)project = out / "pyproject.toml"project.write_text(project.read_text(encoding="utf-8") + 'hermes="entry:main"\n', encoding="utf-8")- data.update(placement="fixed", repo=".", code=str(out), project=str(project), bin_dir="libexec")- assert build_cli(data, out, tmp_path).returncode == 0+ outside = tmp_path / "usr-local-bin-python3"+ outside.symlink_to(data["python"])+ venv_python = out / "venv/bin/python"+ venv_python.parent.mkdir(parents=True)+ venv_python.symlink_to(outside)+ data.update(placement="fixed", repo=".", code=str(out), project=str(project), bin_dir="libexec",+ python=str(venv_python))+ result = build_cli(data, out, tmp_path)+ assert result.returncode == 0, result.stderr+ assert json.loads((out / "manifest.json").read_text())["runtime"]["storePython"] == "venv/bin/python"from pm.environments import committed_venv, payload_command_dir, payload_venv, store_root, venv_commandassert payload_venv(out) == out / "venv"assert committed_venv(out) == out / "venv"assert store_root(out, honor_runtime_override=False) == out / "tools"assert payload_command_dir(out) == out / "libexec"- assert venv_command(out, out / "venv")[0] == str((out / "tools/python/bin/python3").resolve())+ command = venv_command(out, out / "venv")+ assert command[0] == str((out / "tools/python/bin/python3").resolve())+ run = subprocess.run([*command, "-c", "import dependency; print(dependency.VALUE)"], cwd=tmp_path,+ env={"PATH": os.environ["PATH"], "HOME": str(tmp_path / "home")},+ text=True, capture_output=True, check=False, timeout=30)+ assert run.stdout.strip() == "prepared", run.stderr# A manifest naming another tree never claims this one.manifest = json.loads((out / "manifest.json").read_text())manifest["repo"] = "elsewhere"