From 7bc3d55daec0ca9ab26e66694f803a82956d6bec Mon Sep 17 00:00:00 2001 From: man4ish Date: Sun, 4 Oct 2026 15:40:26 -0500 Subject: [PATCH] Isolate micromamba runtime cache in temporary storage --- draft/progress.md | 19 +++++++++++++++++++ scripts/contract_native_validation.py | 7 +++++-- tests/test_contract_native_validation.py | 21 +++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/draft/progress.md b/draft/progress.md index cb668fc..7c508c7 100644 --- a/draft/progress.md +++ b/draft/progress.md @@ -210,3 +210,22 @@ - Run reached terminal FAILURE before plan generation or any build. Checkout credential removal failed with `fatal: No url found for submodule path 'omnibioai-tool-runtime' in .gitmodules`, Git exit 128. Selection job `111517949752`; native matrix skipped, zero actual native entries/OCI/SIF builds. Reconciliation checkout failed for the same cause. Zero GHCR writes/publications. - Deterministically reproduced the exact `git submodule foreach --recursive true` failure locally. Existing gitlink is already pinned to `a4f3da56c2e6e9fd85e54ba009f6f3456de3b5b5`; the frozen workflow independently identifies its repository as OmniBioAI/omnibioai-tool-runtime. Added only the missing `.gitmodules` path/URL registration; gitlink SHA and frozen factory are unchanged. The same command now exits zero, without fetching or executing submodule code. - Added static checkout registration regression. Full suite **8,393 PASS / 13 SKIP / 0 FAIL**, Ruff/actionlint/diff checks PASS. This source-metadata repair must pass fresh remote CI before a fresh-source validation run; failed run history is not rewritten or rerun. Evidence retained at `~/omnibioai-native-validation-evidence/run-37230154387.json`. + +### Fresh-source native validation — 2026-10-04 + +- PR #13 exact head `6cf5af6698abe16d22c70431ee80620f90f3316d` passed remote CI `37230480205` and merged as `df4db5ffaa5022354bf68d737569213d98671370`. +- Native-only run [37230822914](https://github.com/OmniBioAI/omnibioai-tool-images/actions/runs/37230822914) is running at that exact source. Checkout and plan generation passed; all fourteen native matrix entries are present. Initial amd64/arm64 jobs are installing tooling; no native PASS claimed yet. +- Scope remains seven static-ready tools; 594 contracts blocked. Zero publications/GHCR writes. All fourteen entries plus reconciliation must pass before publication eligibility. + +### Native run 37230822914 terminal result — status audit + +- Run completed FAILURE. Selection/checkout passed; all fourteen native matrix jobs reached terminal FAILURE, and reconciliation correctly failed closed. Zero successful native entries. +- Downloaded all run artifacts outside the repositories to `~/omnibioai-native-validation-evidence/run-37230822914/`. Every entry failed command 007: the first OCI runtime architecture probe through micromamba. +- Shared exact cause in all fourteen stderr files: micromamba attempts to create `/root/.cache/mamba/proc` under the intentionally read-only container filesystem, then exits with a filesystem error. This is a validation-runtime cache configuration blocker, not evidence that scientific smoke or version gates passed or failed. +- No publication/GHCR write path exists in this workflow. Publication remains blocked; frozen factory unchanged. Next engineering step is a narrowly scoped writable ephemeral cache configuration, preserving read-only rootfs and network isolation, followed by regression testing before any fresh-source validation. + +### Ephemeral micromamba cache repair — 2026-10-04 + +- Confirmed upstream micromamba 1.5.8 `run.cpp` uses `user_cache_dir()/proc`; `environment.cpp` reads `XDG_CACHE_HOME` before falling back to the home cache. Runtime invocations now explicitly set `XDG_CACHE_HOME=/tmp/omnibioai-validation-cache` in Docker and Apptainer. +- Docker retains read-only rootfs, network none, writable isolated /tmp tmpfs and read-only fixtures. Apptainer retains cleanenv, containall, network none and no writable image/overlay; explicit container environment avoids leaking host cache settings. No Dockerfile, scientific contract, package pin or frozen factory file changed. +- Four new OCI/SIF × amd64/arm64 argument regressions assert exact temporary cache, host-cache exclusion, environment activation and retained isolation. Adapter **159 PASS**; full repository **8,397 PASS / 13 SKIP / 0 FAIL**. Ruff/actionlint PASS; native execution remains unproven until fresh-source run passes. diff --git a/scripts/contract_native_validation.py b/scripts/contract_native_validation.py index 7b75e30..627ae05 100644 --- a/scripts/contract_native_validation.py +++ b/scripts/contract_native_validation.py @@ -240,13 +240,16 @@ def smoke_result(contract: dict, repo: Path, work: Path, result: dict) -> dict: def runtime_argv(phase: str, artifact: str, arch: str, work: Path, fixtures: Path, argv: list[str]) -> list[str]: + # micromamba run writes process bookkeeping below XDG_CACHE_HOME/mamba/proc. + # Keep it in isolated writable /tmp, never the image's read-only /root cache. + cache_environment = "XDG_CACHE_HOME=/tmp/omnibioai-validation-cache" if phase == "oci": prefix = ["docker", "run", "--rm", "--platform", f"linux/{arch}", "--network", "none", "--read-only", - "--tmpfs", "/tmp:rw", "--user", "0:0", "--volume", f"{work}:/work:rw", + "--tmpfs", "/tmp:rw", "--env", cache_environment, "--user", "0:0", "--volume", f"{work}:/work:rw", "--volume", f"{fixtures}:/work/validation-contracts/fixtures:ro", "--workdir", "/work", "--entrypoint", "micromamba", artifact] elif phase == "sif": - prefix = ["sudo", "apptainer", "exec", "--cleanenv", "--containall", "--net", "--network", "none", + prefix = ["sudo", "apptainer", "exec", "--cleanenv", "--containall", "--env", cache_environment, "--net", "--network", "none", "--bind", f"{work}:/work:rw", "--bind", f"{fixtures}:/work/validation-contracts/fixtures:ro", "--pwd", "/work", artifact, "micromamba"] else: diff --git a/tests/test_contract_native_validation.py b/tests/test_contract_native_validation.py index 3b27314..edb7860 100644 --- a/tests/test_contract_native_validation.py +++ b/tests/test_contract_native_validation.py @@ -228,6 +228,27 @@ def test_argv_boundaries_and_network(tmp_path): assert any(value.endswith(":ro") for value in argv) +@pytest.mark.parametrize("phase", ["oci", "sif"]) +@pytest.mark.parametrize("arch", ["amd64", "arm64"]) +def test_micromamba_cache_is_ephemeral_without_relaxing_isolation(phase, arch, tmp_path, monkeypatch): + # A host setting must not leak into --cleanenv SIF execution or Docker. + monkeypatch.setenv("XDG_CACHE_HOME", "/unsafe/host-cache") + command = ["uname", "-m"] + argv = native.runtime_argv(phase, "artifact", arch, tmp_path / "work", tmp_path / "fixtures", command) + assert argv.count("--env") == 1 + assert argv[argv.index("--env") + 1] == "XDG_CACHE_HOME=/tmp/omnibioai-validation-cache" + assert "/unsafe/host-cache" not in " ".join(argv) + assert argv[argv.index("--network") + 1] == "none" + assert f"{tmp_path / 'fixtures'}:/work/validation-contracts/fixtures:ro" in argv + assert argv[-6:] == ["run", "--no-capture-output", "--prefix", "/opt/conda", *command] + if phase == "oci": + assert "--read-only" in argv + assert argv[argv.index("--tmpfs") + 1] == "/tmp:rw" + else: + assert "--cleanenv" in argv and "--containall" in argv + assert "--writable" not in argv and "--writable-tmpfs" not in argv + + @pytest.fixture def repo_copy(tmp_path): root = tmp_path / "repo"