From 753326ef8c3d865ea2c2127fcfe3e89b76d23cc4 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 10 Aug 2026 15:56:48 +0000 Subject: [PATCH 1/2] spike(release): pin CUDA archive-validation repair FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Codex:GPT-5 [Codex] --- .agents/specs/release-binary-matrix.md | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.agents/specs/release-binary-matrix.md b/.agents/specs/release-binary-matrix.md index db6614a0e..7efe7446d 100644 --- a/.agents/specs/release-binary-matrix.md +++ b/.agents/specs/release-binary-matrix.md @@ -493,6 +493,44 @@ tests before workflow expansion, never by a wildcard build. byte-for-byte rebuild reproducibility is a separate evidence field until demonstrated. +## Hosted CUDA archive-validation repair + +The 2026-08-10 hosted dry run at Actions run `31363264184` built and packaged +six of eight tuples successfully. Both CUDA tuples completed their ten-SM +builds and archive creation, then failed the extracted-archive dependency gate: +`ldd` resolved `libcuda.so.1` through `build-release-cuda-{x86,arm64}`. The +publish chain correctly stopped before verify, attest, or publish. + +The failure is in the validation harness, not in the archive. CUDA's driver is +an external host dependency and hosted build runners have no driver runtime, so +the harness creates a controlled `libcuda.so.1` alias for the extracted +`--help` smoke. The caller currently creates that alias below the same build +directory passed to `--forbid-path`, making the harness violate its own +invariant. The validator must continue rejecting every dependency resolved +through a source or build tree. + +The approved repair is deliberately narrow: + +1. The Linux accelerator release driver creates the validation-only CUDA stub + directory with `mktemp` outside the build tree and removes it on exit. +2. `prepare-cuda-driver-stub.sh` continues to resolve the CUDA toolkit's + external stub and create only the runtime SONAME alias; it does not copy or + bundle that stub into the release archive. +3. `validate-release-archive.py` and its strict forbidden-path check remain + unchanged. No build path is allowlisted and no `ldd` result is suppressed. +4. A red-first regression test proves the release driver no longer places the + validation stub below `$build_dir`, still exports the exact controlled + runtime directory, and installs cleanup before validation. +5. The focused release archive/accelerator/workflow tests, repository + preflight, fresh static+mutation review, and a new hosted eight-tuple dry run + must pass. Only that hosted run may advance `archive_claims`; tagged + publication remains a separate developer-authorized action. + +Rejected alternatives are allowing the known stub path through the validator +or replacing the runtime resolution smoke with `readelf` alone. The former +weakens the no-build-path release invariant, while the latter stops proving +that the extracted executable's declared dependencies resolve. + ## Spike verdict The release program is feasible as backend-specific static-core bundles with a From 0716f6bc8f3d72e4c134ce7fa9429575f28e8bea Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 10 Aug 2026 16:13:51 +0000 Subject: [PATCH 2/2] fix(release): isolate CUDA validation stub FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Codex:GPT-5 [Codex] --- scripts/build-linux-accelerator-release.sh | 7 +- .../test_release_accelerator_metadata.py | 117 ++++++++++++++++-- 2 files changed, 113 insertions(+), 11 deletions(-) diff --git a/scripts/build-linux-accelerator-release.sh b/scripts/build-linux-accelerator-release.sh index 021fdea97..cdb9a2242 100755 --- a/scripts/build-linux-accelerator-release.sh +++ b/scripts/build-linux-accelerator-release.sh @@ -96,7 +96,12 @@ python3 scripts/package-server.py \ --metadata-dir "$metadata_dir" \ --archive "$archive" if [[ "$backend" == cuda ]]; then - cuda_stub_runtime_dir=$(scripts/prepare-cuda-driver-stub.sh /usr/local/cuda "$release_dir/cuda-driver-stub") + cuda_stub_validation_dir=$(mktemp -d) + cleanup_cuda_stub_validation_dir() { + rm -rf -- "$cuda_stub_validation_dir" + } + trap cleanup_cuda_stub_validation_dir EXIT + cuda_stub_runtime_dir=$(scripts/prepare-cuda-driver-stub.sh /usr/local/cuda "$cuda_stub_validation_dir") export LD_LIBRARY_PATH="$cuda_stub_runtime_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" fi python3 scripts/validate-release-archive.py \ diff --git a/tests/scripts/test_release_accelerator_metadata.py b/tests/scripts/test_release_accelerator_metadata.py index 4e41f6260..86b37eccc 100755 --- a/tests/scripts/test_release_accelerator_metadata.py +++ b/tests/scripts/test_release_accelerator_metadata.py @@ -6,6 +6,7 @@ import argparse import importlib.util import json +import os import shutil import subprocess import tempfile @@ -113,16 +114,112 @@ def test_cuda_refuses_partial_sm_or_disabled_triton_cache(self) -> None: self.tool.prepare_accelerator_metadata(args) (args.build_dir / "CMakeCache.txt").write_text(cache, encoding="utf-8") - def test_cuda_archive_smoke_resolves_only_the_external_driver_stub(self) -> None: - script = BUILD_SCRIPT.read_text(encoding="utf-8") - self.assertIn( - 'scripts/prepare-cuda-driver-stub.sh /usr/local/cuda "$release_dir/cuda-driver-stub"', - script, - ) - self.assertIn( - 'export LD_LIBRARY_PATH="$cuda_stub_runtime_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"', - script, - ) + def test_cuda_archive_smoke_uses_external_cleaned_driver_stub_runtime(self) -> None: + with tempfile.TemporaryDirectory() as temporary: + scratch = Path(temporary) + repo = scratch / "repo" + scripts = repo / "scripts" + fake_bin = scratch / "bin" + log = scratch / "log" + external_runtime = scratch / "external-runtime" + scripts.mkdir(parents=True) + fake_bin.mkdir() + log.mkdir() + shutil.copy2(BUILD_SCRIPT, scripts / BUILD_SCRIPT.name) + (repo / "include").mkdir() + (repo / "include/vllm.h").write_text( + "#define VLLM_ABI_VERSION 17\n", + encoding="utf-8", + ) + + shims = { + "cmake": """#!/bin/sh +if [ "${1:-}" = --version ]; then + echo 'cmake version 3.30.0' +fi +""", + "ninja": """#!/bin/sh +echo '1.12.0' +""", + "c++": """#!/bin/sh +echo 'c++ (GCC) 13.2.0' +""", + "mktemp": """#!/bin/sh +printf '%s\n' "$*" > "$TEST_LOG/mktemp.args" +mkdir -p "$TEST_EXTERNAL_RUNTIME" +printf '%s\n' "$TEST_EXTERNAL_RUNTIME" +""", + "python3": """#!/bin/sh +if [ "${1:-}" = scripts/validate-release-archive.py ]; then + printf '%s\n' "$@" > "$TEST_LOG/validate.args" + printf '%s\n' "${LD_LIBRARY_PATH:-}" > "$TEST_LOG/validate.ld-library-path" + exit 23 +fi +""", + } + for name, content in shims.items(): + path = fake_bin / name + path.write_text(content, encoding="utf-8") + path.chmod(0o755) + + stub_prep = scripts / CUDA_STUB_PREP.name + stub_prep.write_text( + """#!/bin/sh +printf '%s\n' "$2" > "$TEST_LOG/stub-runtime.arg" +mkdir -p "$2/canonical-runtime" +realpath "$2/canonical-runtime" +""", + encoding="utf-8", + ) + stub_prep.chmod(0o755) + + build_dir = "build-release-cuda-x86" + env = dict(os.environ) + env.update( + { + "EVIDENCE_URL": "https://github.com/mudler/vllm.cpp/actions/runs/1", + "LD_LIBRARY_PATH": "/host/runtime", + "PATH": f"{fake_bin}:{env['PATH']}", + "SOURCE_DATE_EPOCH": "0", + "SOURCE_SHA": SHA, + "TEST_EXTERNAL_RUNTIME": str(external_runtime), + "TEST_LOG": str(log), + "VERSION": "0.0.1", + } + ) + result = subprocess.run( + [ + "bash", + f"scripts/{BUILD_SCRIPT.name}", + "linux-x86_64-glibc-cuda-fat", + "cuda", + build_dir, + ], + cwd=repo, + env=env, + check=False, + capture_output=True, + text=True, + ) + + self.assertEqual(result.returncode, 23, result.stderr) + mktemp_log = log / "mktemp.args" + self.assertTrue( + mktemp_log.exists(), + "release driver did not allocate the CUDA validation runtime with mktemp", + ) + self.assertEqual(mktemp_log.read_text(encoding="utf-8").strip(), "-d") + self.assertEqual( + (log / "stub-runtime.arg").read_text(encoding="utf-8").strip(), + str(external_runtime), + ) + self.assertFalse(external_runtime.exists(), "validation runtime was not cleaned on failure") + self.assertEqual( + (log / "validate.ld-library-path").read_text(encoding="utf-8").strip(), + f"{external_runtime}/canonical-runtime:/host/runtime", + ) + validate_args = (log / "validate.args").read_text(encoding="utf-8").splitlines() + self.assertEqual(validate_args[-2:], ["--forbid-path", str(repo / build_dir)]) def test_cuda_driver_stub_preparation_adds_runtime_soname_alias(self) -> None: with tempfile.TemporaryDirectory() as temporary: