Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .agents/specs/release-binary-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion scripts/build-linux-accelerator-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
117 changes: 107 additions & 10 deletions tests/scripts/test_release_accelerator_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import argparse
import importlib.util
import json
import os
import shutil
import subprocess
import tempfile
Expand Down Expand Up @@ -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:
Expand Down
Loading