Skip to content

fix(ci): authorize candidate testing through PR reviews #17793

fix(ci): authorize candidate testing through PR reviews

fix(ci): authorize candidate testing through PR reviews #17793

Workflow file for this run

# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Publish complete managed images from exact base-image contracts. Every
# agent/platform lane pushes and validates only an immutable digest. The
# aggregate publisher then proves that all three agents have both supported
# Linux architectures before it stages any cohort alias. Only after all staged
# aliases resolve to the exact validated manifests does the single OpenClaw
# cohort pointer move. Consumers use that pointer to discover the matching
# Hermes and Deep Agents Code cohort aliases, so a failed run cannot expose a
# mixed-agent or mixed-architecture cohort.
#
# The Pi candidate lane builds and validates its own per-architecture images and
# publishes exact candidate digests under a separate contract artifact name. It
# never contributes to the all-agent cohort, so Pi cannot reach onboarding agent
# selection before the activation change merges.
name: Images / Build, Test, and Publish Managed Images
on:
workflow_call:
inputs:
dcode-base-contract-base64:
required: true
type: string
hermes-base-contract-base64:
required: true
type: string
openclaw-base-contract-base64:
required: true
type: string
pull_request:
paths:
- ".github/actions/ci-reviewed-npm-audit/**"
- ".github/actions/setup-reviewed-npm/**"
- ".github/workflows/base-image.yaml"
- ".github/actions/publish-managed-image-digest/**"
- ".github/workflows/managed-images.yaml"
- ".dockerignore"
- "Dockerfile"
- "agents/**"
- "ci/npm-audit-exceptions.json"
- "ci/pi-agent-qualification-v1-*.json"
- "ci/reviewed-npm-audit.json"
- "nemoclaw/**"
- "nemoclaw-blueprint/**"
- "scripts/**"
- "src/lib/actions/sandbox/**"
- "src/lib/adapters/container-engine.ts"
- "src/lib/adapters/openshell/**"
- "src/lib/adapters/podman/**"
- "src/lib/agent/candidate-authority.ts"
- "src/lib/agent/deep-agents-code-runtime-identity.json"
- "src/lib/extra-agents-validation.ts"
- "src/lib/core/json-types.ts"
- "src/lib/core/ports.ts"
- "src/lib/messaging/**"
- "src/lib/onboard/**"
- "src/lib/security/credential-hash.ts"
- "src/lib/sandbox-base-image/security-package-specs.ts"
- "src/lib/state/paths.ts"
- "src/lib/state/state-root.ts"
- "test/helpers/openclaw-real-agent-reload-proof.ts"
- "test/package-contract/channels/hermes-discord-runtime.test.ts"
- "test/e2e/fixtures/docker-build-guard.ts"
- "test/e2e/fixtures/hermes-switchyard-package.ts"
- "test/e2e/fixtures/hermes-crash-capture.ts"
- "test/e2e/live/hermes-root-entrypoint-smoke.test.ts"
- "test/e2e/live/mcp-bridge*.ts"
- "test/e2e/support/mcp-bridge-portable-lock-barrier.ts"
- "test/e2e/fixtures/gateway-runtime-start.ts"
- "test/e2e/fixtures/admin-request-selector.ts"
- "test/e2e/fixtures/admin-approval-connect.sh"
- "test/e2e/fixtures/admin-approval-connect.ts"
- "test/e2e/fixtures/issue-4462-admin-approval-evidence.ts"
- "test/e2e/fixtures/phases/lifecycle.ts"
- "test/e2e/lib/issue-4462-admin-request-selector.py"
- "test/e2e/lib/issue-4462-fresh-agent-gateway-snapshot.py"
- "test/e2e/live/managed-image-activation-e2e*.ts"
- "src/lib/tool-disclosure.ts"
- "tools/mcp-tool-discovery-runtime/**"
- "tsconfig.runtime-preloads.json"
permissions:
contents: read
packages: write
concurrency:
group: managed-images-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
REGISTRY: ghcr.io
jobs:
pr-reviewed-npm-audit:
name: PR npm audit
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
steps:
- name: Checkout commit under review
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
path: candidate
persist-credentials: false
- name: Audit exact PR production npm graphs
uses: ./candidate/.github/actions/ci-reviewed-npm-audit
with:
target-root: ${{ github.workspace }}/candidate
report-dir: artifacts/reviewed-npm-audit
cache-directory: ${{ runner.temp }}/reviewed-npm-audit-cache
pr-staging-qa-deep-code:
name: Staging QA base permission regression (Deep Agents Code)
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
timeout-minutes: 90
permissions:
contents: read
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
# Retains the reviewed discovery-permission repair and the current
# managed-image security inventory. The previous staging source pinned
# libssh2 nemoclaw1, which cannot satisfy the candidate's nemoclaw2 contract.
STAGING_QA_SOURCE_SHA: ce96811ddb418ad01c040521a1fe912b5bcb405e
STAGING_QA_BASE_IMAGE: nemoclaw-deepagents-code-base:staging-31396519688
STAGING_QA_FINAL_IMAGE: nemoclaw-managed-pr/langchain-deepagents-code-staging-qa
STAGING_QA_DARWIN_IMAGE: nemoclaw-managed-pr/langchain-deepagents-code-staging-qa-darwin
steps:
- name: Checkout latest PR commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
path: candidate
persist-credentials: false
# Rebuild a security-compatible base from the exact source that retains
# the reviewed discovery-permission repair.
- name: Checkout exact staging QA base source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.STAGING_QA_SOURCE_SHA }}
path: staging-qa-base-source
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
- name: Install reviewed npm
uses: NVIDIA/NemoClaw/.github/actions/setup-reviewed-npm@98669f24d35f18e49b6b2769cd68709509ea24f2
- name: Validate staging QA source
shell: bash
run: |
set -euo pipefail
source_root="$GITHUB_WORKSPACE/staging-qa-base-source"
actual_source_sha="$(git -C "$source_root" rev-parse HEAD)"
if [ "$actual_source_sha" != "$STAGING_QA_SOURCE_SHA" ]; then
echo "ERROR: staging QA base source does not match the recorded NemoClaw commit." >&2
exit 1
fi
printf '### Staging QA Deep Agents Code base\n\n'
printf 'NemoClaw source commit: %s\n' "$STAGING_QA_SOURCE_SHA"
{
printf '### Staging QA Deep Agents Code base\n\n'
printf 'NemoClaw source commit: %s\n' "$STAGING_QA_SOURCE_SHA"
} >> "$GITHUB_STEP_SUMMARY"
# NemoPatch exact Deep Agents candidate-base boundary.
# Preserve the recorded staging tree and replace only the dependency inputs
# that the candidate base image owns.
- name: Overlay exact PR dependency inputs on staging QA base
shell: bash
run: |
set -euo pipefail
candidate_root="$GITHUB_WORKSPACE/candidate"
staging_root="$GITHUB_WORKSPACE/staging-qa-base-source"
for relative in \
agents/langchain-deepagents-code/Dockerfile.base \
scripts/security/build-native-security-packages.sh \
scripts/security/build-perl-security-packages.sh \
agents/langchain-deepagents-code/requirements.lock
do
source_file="$candidate_root/$relative"
destination_file="$staging_root/$relative"
if [ ! -f "$source_file" ] || [ -L "$source_file" ] || [ ! -f "$destination_file" ] || [ -L "$destination_file" ]; then
echo "ERROR: staging QA dependency input is missing, unsafe, or changed shape: $relative" >&2
exit 1
fi
install -m 0644 "$source_file" "$destination_file"
done
for support_relative in \
agents/langchain-deepagents-code/patch-dependency-compatibility.py \
agents/langchain-deepagents-code/dependency-overrides.in \
agents/langchain-deepagents-code/validate-runtime-contract.py \
src/lib/agent/deep-agents-code-runtime-identity.json \
ci/reviewed-npm-audit.json \
scripts/lib/bundled-npm-package.mts \
scripts/lib/patch-bundled-npm-ip-address.mts \
scripts/lib/patch-bundled-npm-undici.mts \
scripts/lib/reviewed-npm-archive.mts \
scripts/lib/reviewed-npm-audit.mts \
scripts/lib/reviewed-npm-identity.mts \
scripts/patch-bundled-npm-brace-expansion.mts \
scripts/patch-bundled-npm-tar.mts \
scripts/upgrade-bundled-npm.mts \
scripts/security/patches/perl-5.44.0-net-ping-capability-tests.patch \
scripts/security/patches/libssh2-1.11.1-cve-2026.patch \
scripts/security/patches/zlib-1.3.1-write-error.patch \
scripts/security/zlib-write-error.c \
scripts/security/libssh2-sftp-response-regression.c \
scripts/security/security-package-inventory.mts \
src/lib/sandbox-base-image/security-package-specs.ts
do
support_source="$candidate_root/$support_relative"
support_parent="$staging_root/$(dirname "$support_relative")"
support_destination="$staging_root/$support_relative"
if [ ! -f "$support_source" ] || [ -L "$support_source" ] || [ ! -d "$support_parent" ] || [ -L "$support_parent" ] || [ -L "$support_destination" ]; then
echo "ERROR: staging QA Dockerfile support file is missing, unsafe, or changed shape: $support_relative" >&2
exit 1
fi
if [ -e "$support_destination" ] && [ ! -f "$support_destination" ]; then
echo "ERROR: staging QA Dockerfile support destination changed shape: $support_relative" >&2
exit 1
fi
install -m 0644 "$support_source" "$support_destination"
done
printf '\nCandidate dependency inputs: %s\n' "$CANDIDATE_SHA" >> "$GITHUB_STEP_SUMMARY"
- name: Reproduce staging discovery permission drift
shell: bash
working-directory: candidate
run: |
set -euo pipefail
reviewed_root="tools/mcp-tool-discovery-runtime/reviewed-runtime-bundle/mcp-tool-discovery"
for artifact in \
BUNDLED_PACKAGES.json \
THIRD_PARTY_LICENSES.txt \
mcp-tool-discovery.bundle
do
artifact_path="${reviewed_root}/${artifact}"
if [ ! -f "$artifact_path" ] || [ -L "$artifact_path" ]; then
echo "ERROR: reviewed discovery permission fixture must be a regular non-symlink: ${artifact_path}" >&2
exit 1
fi
chmod 0664 "$artifact_path"
done
- name: Rebuild staging QA Deep Agents Code base from exact source
id: staging-base
shell: bash
env:
DOCKER_BUILDKIT: "1"
run: |
set -euo pipefail
source_root="$GITHUB_WORKSPACE/staging-qa-base-source"
docker build --progress=plain \
-f "$source_root/agents/langchain-deepagents-code/Dockerfile.base" \
-t "$STAGING_QA_BASE_IMAGE" \
"$source_root"
base_id="$(docker image inspect --format "{{.Id}}" "$STAGING_QA_BASE_IMAGE")"
if [[ ! "$base_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: rebuilt staging QA base did not resolve to an immutable local image ID." >&2
exit 1
fi
printf 'id=%s\n' "$base_id" >> "$GITHUB_OUTPUT"
printf '\nRebuilt local image: %s\n' "$base_id" >> "$GITHUB_STEP_SUMMARY"
- name: Build latest PR commit against reproduced staging QA base
id: staging-final
shell: bash
working-directory: candidate
env:
DOCKER_BUILDKIT: "1"
run: |
set -euo pipefail
final_reference="${STAGING_QA_FINAL_IMAGE}:${CANDIDATE_SHA}"
docker build --progress=plain \
-f agents/langchain-deepagents-code/Dockerfile \
--build-arg BASE_IMAGE="$STAGING_QA_BASE_IMAGE" \
--build-arg NEMOCLAW_MODEL=nvidia/nemotron-3-ultra-550b-a55b \
--build-arg NEMOCLAW_INFERENCE_PROVIDER_ID=inference \
--build-arg NEMOCLAW_UPSTREAM_PROVIDER=nvidia-nim \
--build-arg NEMOCLAW_INFERENCE_BASE_URL=https://inference.local/v1 \
--build-arg NEMOCLAW_INFERENCE_API=openai-completions \
--build-arg NEMOCLAW_DCODE_AUTO_APPROVAL=thread-opt-in \
--build-arg NEMOCLAW_BUILD_ID="$STAGING_QA_SOURCE_SHA" \
--build-arg NEMOCLAW_DARWIN_VM_COMPAT=0 \
-t "$final_reference" \
.
final_id="$(docker image inspect --format "{{.Id}}" "$final_reference")"
if [[ ! "$final_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: staging QA final image did not resolve to an immutable local image ID." >&2
exit 1
fi
printf 'id=%s\n' "$final_id" >> "$GITHUB_OUTPUT"
- name: Build Darwin compatibility image against reproduced staging QA base
id: staging-darwin-final
shell: bash
working-directory: candidate
env:
DOCKER_BUILDKIT: "1"
run: |
set -euo pipefail
final_reference="${STAGING_QA_DARWIN_IMAGE}:${CANDIDATE_SHA}"
docker build --progress=plain \
-f agents/langchain-deepagents-code/Dockerfile \
--build-arg BASE_IMAGE="$STAGING_QA_BASE_IMAGE" \
--build-arg NEMOCLAW_MODEL=nvidia/nemotron-3-ultra-550b-a55b \
--build-arg NEMOCLAW_INFERENCE_PROVIDER_ID=inference \
--build-arg NEMOCLAW_UPSTREAM_PROVIDER=nvidia-nim \
--build-arg NEMOCLAW_INFERENCE_BASE_URL=https://inference.local/v1 \
--build-arg NEMOCLAW_INFERENCE_API=openai-completions \
--build-arg NEMOCLAW_DCODE_AUTO_APPROVAL=thread-opt-in \
--build-arg NEMOCLAW_BUILD_ID="$STAGING_QA_SOURCE_SHA" \
--build-arg NEMOCLAW_DARWIN_VM_COMPAT=1 \
-t "$final_reference" \
.
final_id="$(docker image inspect --format "{{.Id}}" "$final_reference")"
if [[ ! "$final_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: Darwin compatibility image did not resolve to an immutable local image ID." >&2
exit 1
fi
printf 'id=%s\n' "$final_id" >> "$GITHUB_OUTPUT"
- name: Validate staging QA final image contract
shell: bash
env:
BASE_ID: ${{ steps.staging-base.outputs.id }}
DARWIN_FINAL_ID: ${{ steps.staging-darwin-final.outputs.id }}
FINAL_ID: ${{ steps.staging-final.outputs.id }}
run: |
set -euo pipefail
base_layers="$(docker image inspect --format "{{json .RootFS.Layers}}" "$BASE_ID")"
final_layers="$(docker image inspect --format "{{json .RootFS.Layers}}" "$FINAL_ID")"
if ! jq -n -e \
--argjson base "$base_layers" \
--argjson final "$final_layers" '
($base | length) > 0 and
($final | length) >= ($base | length) and
all(range(0; $base | length); $final[.] == $base[.])
' >/dev/null; then
echo "ERROR: staging QA final image does not extend the rebuilt QA base." >&2
exit 1
fi
candidate/scripts/checks/verify-dcode-conversation-history-image.sh \
"$FINAL_ID" linux/amd64 0
candidate/scripts/checks/verify-dcode-conversation-history-image.sh \
"$DARWIN_FINAL_ID" linux/amd64 1
if ! actual_discovery_contract="$(
docker run --rm --platform linux/amd64 --entrypoint /bin/sh "$FINAL_ID" -c '
set -eu
discovery_runtime=/usr/local/lib/nemoclaw/mcp-tool-discovery-runtime
if ! entry_owner_unsafe="$(find -P "$discovery_runtime" ! -user root -print -quit)"; then
echo "ERROR: staging QA discovery entry ownership inspection failed." >&2
exit 1
fi
if [ -n "$entry_owner_unsafe" ]; then
echo "ERROR: staging QA discovery entry is not root-owned: $entry_owner_unsafe" >&2
exit 1
fi
if ! owner_or_write_unsafe="$(
find -L "$discovery_runtime" \
\( ! -user root -o -perm /022 \) -print -quit
)"; then
echo "ERROR: staging QA discovery tree inspection failed." >&2
exit 1
fi
if [ -n "$owner_or_write_unsafe" ]; then
echo "ERROR: staging QA discovery tree is not root-owned and read-only: $owner_or_write_unsafe" >&2
exit 1
fi
if ! mode_unsafe="$(
find -P "$discovery_runtime" \
\( \( -type d ! -perm 0555 \) -o \( -type f ! -perm 0444 \) \) \
-print -quit
)"; then
echo "ERROR: staging QA discovery mode inspection failed." >&2
exit 1
fi
if [ -n "$mode_unsafe" ]; then
echo "ERROR: staging QA discovery path has an unexpected mode: $mode_unsafe" >&2
exit 1
fi
if ! actual_discovery_contract="$(node "$discovery_runtime/mcp-tool-discovery.mjs")"; then
echo "ERROR: staging QA discovery bundle execution failed." >&2
exit 1
fi
printf "%s" "$actual_discovery_contract"
'
)"; then
echo "ERROR: staging QA final image discovery contract probe failed." >&2
exit 1
fi
if ! node -e '
const expected = {
protocol: 2,
ok: false,
count: 0,
tools: [],
truncated: false,
detail: "tool discovery received invalid runtime arguments",
failedStage: "preflight",
failureClass: "precondition",
};
let result;
try {
result = JSON.parse(require("node:fs").readFileSync(0, "utf8"));
} catch {
process.exit(1);
}
const record =
result !== null && typeof result === "object" && !Array.isArray(result)
? result
: undefined;
if (
!record ||
Object.keys(record).length !== Object.keys(expected).length ||
record.protocol !== expected.protocol ||
record.ok !== expected.ok ||
record.count !== expected.count ||
!Array.isArray(record.tools) ||
record.tools.length !== 0 ||
record.truncated !== expected.truncated ||
record.detail !== expected.detail ||
record.failedStage !== expected.failedStage ||
record.failureClass !== expected.failureClass
) {
process.exit(1);
}
' <<< "$actual_discovery_contract" >/dev/null; then
echo "ERROR: staging QA discovery bundle contract mismatch." >&2
exit 1
fi
pr-build-and-entrypoint:
name: PR build and direct managed startup (${{ matrix.display_name }}, ${{ matrix.arch }})
# External contributor PRs retain the local build/direct-startup lane after
# GitHub's maintainer workflow approval. Exact digest publication is limited
# to branches in NVIDIA/NemoClaw; fork jobs never log in or push.
needs:
- pr-reviewed-npm-audit
- publication-identity
if: github.event_name == 'pull_request'
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
timeout-minutes: 90
permissions:
contents: read
packages: write
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
PLATFORM: linux/${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
agent: [openclaw, hermes, langchain-deepagents-code]
arch: [amd64, arm64]
include:
- agent: openclaw
display_name: OpenClaw
dockerfile: Dockerfile
base_dockerfile: Dockerfile.base
base_alias: ghcr.io/nvidia/nemoclaw/sandbox-base:latest
base_repository: ghcr.io/nvidia/nemoclaw/sandbox-base
image: nemoclaw-managed-pr/openclaw
repository: ghcr.io/nvidia/nemoclaw/openclaw-sandbox
- agent: hermes
display_name: Hermes
dockerfile: agents/hermes/Dockerfile
base_dockerfile: agents/hermes/Dockerfile.base
base_alias: ghcr.io/nvidia/nemoclaw/hermes-sandbox-base:latest
base_repository: ghcr.io/nvidia/nemoclaw/hermes-sandbox-base
image: nemoclaw-managed-pr/hermes
repository: ghcr.io/nvidia/nemoclaw/hermes-sandbox
- agent: langchain-deepagents-code
display_name: Deep Agents Code
dockerfile: agents/langchain-deepagents-code/Dockerfile
base_dockerfile: agents/langchain-deepagents-code/Dockerfile.base
base_alias: ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox-base:latest
base_repository: ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox-base
image: nemoclaw-managed-pr/langchain-deepagents-code
repository: ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Resolve managed image release identity
id: release
shell: bash
env:
RELEASE: ${{ needs.publication-identity.outputs.release }}
run: |
set -euo pipefail
release="$RELEASE"
if [[ ! "$release" =~ ^v[0-9]+([.][0-9]+){1,3}([-.][0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
echo "ERROR: managed image release identity is invalid: $release" >&2
exit 1
fi
printf 'value=%s\n' "$release" >> "$GITHUB_OUTPUT"
- name: Reproduce reviewed discovery permission drift
shell: bash
run: |
set -euo pipefail
reviewed_root="tools/mcp-tool-discovery-runtime/reviewed-runtime-bundle/mcp-tool-discovery"
for artifact in \
BUNDLED_PACKAGES.json \
THIRD_PARTY_LICENSES.txt \
mcp-tool-discovery.bundle
do
artifact_path="${reviewed_root}/${artifact}"
if [ ! -f "$artifact_path" ] || [ -L "$artifact_path" ]; then
echo "ERROR: reviewed discovery permission fixture must be a regular non-symlink: ${artifact_path}" >&2
exit 1
fi
chmod 0664 "$artifact_path"
done
- name: Checkout trusted mcporter audit verifier
if: matrix.agent == 'openclaw'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: e0769ad0e6783e4108a1f26cc44b162f1f7ecc3f # reviewed proxy-addr 2.0.8 lock
path: .trusted-mcporter-audit
persist-credentials: false
sparse-checkout: |
ci/npm-audit-exceptions.json
ci/reviewed-npm-audit.json
scripts/lib/npm-audit-receipt.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/reviewed-npm-archive.mts
sparse-checkout-cone-mode: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
- name: Install reviewed npm
uses: NVIDIA/NemoClaw/.github/actions/setup-reviewed-npm@98669f24d35f18e49b6b2769cd68709509ea24f2
- name: Prepare same-run mcporter audit evidence
if: matrix.agent == 'openclaw'
id: mcporter-audit
shell: bash
env:
REVIEWED_AUDIT_SHA: e0769ad0e6783e4108a1f26cc44b162f1f7ecc3f
run: |
set -euo pipefail
receipt="$RUNNER_TEMP/trusted-mcporter-audit-report/mcporter-runtime.receipt.json"
raw="$RUNNER_TEMP/trusted-mcporter-audit-report/mcporter-runtime.raw.json"
policy="$RUNNER_TEMP/trusted-mcporter-audit-report/mcporter-runtime.policy.json"
trusted_root="$GITHUB_WORKSPACE/.trusted-mcporter-audit"
test "$(git -C "$trusted_root" rev-parse --verify HEAD)" = "$REVIEWED_AUDIT_SHA"
audit_config="$RUNNER_TEMP/pr-mcporter-audit-config.json"
# PR builds must accept an audited dependency repair before its lock
# identity reaches main. Retain all other base-owned policy fields.
node --input-type=module - \
"$trusted_root/ci/reviewed-npm-audit.json" \
"$GITHUB_WORKSPACE/ci/reviewed-npm-audit.json" "$audit_config" <<'NODE'
import { readFileSync, writeFileSync } from "node:fs";
import { isDeepStrictEqual } from "node:util";
const [trustedPath, candidatePath, outputPath] = process.argv.slice(2);
const trusted = JSON.parse(readFileSync(trustedPath, "utf8"));
const candidate = JSON.parse(readFileSync(candidatePath, "utf8"));
const baseGraph = trusted.lockedGraphs.find((graph) => graph.id === "mcporter-runtime");
const candidateGraph = candidate.lockedGraphs.find((graph) => graph.id === "mcporter-runtime");
if (!baseGraph || !candidateGraph || !isDeepStrictEqual(
{ ...candidateGraph, lockSha256: baseGraph.lockSha256 }, baseGraph,
)) {
throw new Error("Candidate mcporter package identity differs from the trusted base");
}
baseGraph.lockSha256 = candidateGraph.lockSha256;
writeFileSync(outputPath, JSON.stringify(trusted), { mode: 0o600 });
NODE
node --input-type=module - "$trusted_root" \
"$GITHUB_WORKSPACE/agents/openclaw/mcporter-runtime" "$audit_config" \
"$RUNNER_TEMP/trusted-mcporter-audit-report" <<'AUDIT'
import { execFileSync } from "node:child_process";
import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
const [trustedRoot, sourceRoot, configPath, reportRoot] = process.argv.slice(2);
const { verifyReviewedNpmLock, verifyInstalledNpmLock } = await import(pathToFileURL(join(trustedRoot, "scripts/lib/reviewed-npm-archive.mts")));
const { runReviewedNpmAudit } = await import(pathToFileURL(join(trustedRoot, "scripts/lib/reviewed-npm-audit.mts")));
const { createAuditReceipt, canonicalAuditReceipt } = await import(pathToFileURL(join(trustedRoot, "scripts/lib/npm-audit-receipt.mts")));
const config = JSON.parse(readFileSync(configPath, "utf8"));
const graph = config.lockedGraphs.find((entry) => entry.id === "mcporter-runtime");
const directory = mkdtempSync(join(process.env.RUNNER_TEMP ?? "/tmp", "mcporter-audit-"));
const packageJson = join(sourceRoot, "package.json"), packageLock = join(sourceRoot, "package-lock.json");
const exceptionFile = join(trustedRoot, "ci/npm-audit-exceptions.json");
mkdirSync(reportRoot, { mode: 0o700 });
const raw = join(reportRoot, "mcporter-runtime.raw.json");
try {
verifyReviewedNpmLock({ expectedIntegrity: graph.integrity, expectedLockSha256: graph.lockSha256, label: graph.label, lockfilePath: packageLock, packageSpec: graph.packageSpec, registryOrigin: config.registryOrigin, tarballUrl: graph.tarballUrl });
copyFileSync(packageJson, join(directory, "package.json"));
copyFileSync(packageLock, join(directory, "package-lock.json"));
const env = { ...process.env, NPM_CONFIG_USERCONFIG: "/dev/null", NPM_CONFIG_REGISTRY: config.registryOrigin };
delete env.NODE_AUTH_TOKEN; delete env.NPM_TOKEN; delete env.GH_TOKEN;
execFileSync("npm", ["ci", "--ignore-scripts", "--omit=dev", "--no-audit", "--no-fund"], { cwd: directory, env, stdio: "inherit" });
verifyInstalledNpmLock({ expectedLockSha256: graph.lockSha256, installRoot: directory, label: graph.label, lockfilePath: join(directory, "package-lock.json"), omitDev: true });
execFileSync("npm", ["audit", "signatures", "--registry=https://registry.yarnpkg.com", "--omit=dev"], { cwd: directory, env, stdio: "inherit" });
const result = runReviewedNpmAudit({ directory, exceptionFile, graph: graph.id, reviewedNpmIdentity: config, reportFile: raw, resultFile: join(reportRoot, "mcporter-runtime.policy.json"), threshold: "high" });
const receipt = createAuditReceipt({ acceptedAdvisoryIds: result.acceptedAdvisories, blockingAdvisoryIds: result.unacceptedBlockingAdvisories.map((finding) => finding.advisory), exceptionPolicySha256: result.exceptionPolicySha256, graphId: graph.id, reviewedNpmIdentity: config, packageJson: readFileSync(packageJson), packageLock: readFileSync(packageLock), rawResponse: readFileSync(raw), registryOrigin: "https://registry.yarnpkg.com", severityThreshold: "high" });
writeFileSync(join(reportRoot, "mcporter-runtime.receipt.json"), canonicalAuditReceipt(receipt), { mode: 0o600 });
} finally {
rmSync(directory, { recursive: true, force: true });
}
AUDIT
node --experimental-strip-types --no-warnings \
"$trusted_root/scripts/lib/npm-audit-receipt.mts" \
--receipt "$receipt" \
--package-json "$GITHUB_WORKSPACE/agents/openclaw/mcporter-runtime/package.json" \
--package-lock "$GITHUB_WORKSPACE/agents/openclaw/mcporter-runtime/package-lock.json" \
--raw-report "$raw" \
--exceptions "$trusted_root/ci/npm-audit-exceptions.json" \
--graph mcporter-runtime \
--audit-config "$audit_config" \
--registry https://registry.yarnpkg.com \
--threshold high \
--result "$policy"
test -f "$receipt"; test -f "$raw"; test -s "$policy"; test ! -L "$policy"
printf 'receipt=%s\nraw=%s\npolicy=%s\nreceipt_sha256=%s\npolicy_sha256=%s\n' "$receipt" "$raw" "$policy" "$(sha256sum "$receipt" | cut -d' ' -f1)" "$(sha256sum "$policy" | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Validate Deep Agents PR base build arguments
if: matrix.agent == 'langchain-deepagents-code'
shell: bash
run: scripts/check-production-build-args.sh -f agents/langchain-deepagents-code/Dockerfile.base
- name: Resolve digest-pinned native PR base
id: base
shell: bash
env:
AGENT: ${{ matrix.agent }}
BASE_DOCKERFILE: ${{ matrix.base_dockerfile }}
BASE_ALIAS: ${{ matrix.base_alias }}
BASE_REPOSITORY: ${{ matrix.base_repository }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
DISPLAY_NAME: ${{ matrix.display_name }}
LOCAL_BASE_REFERENCE: nemoclaw-managed-pr/${{ matrix.agent }}-base:${{ github.event.pull_request.head.sha }}
run: scripts/checks/resolve-managed-pr-base.sh
- name: Validate PR managed-image build args
shell: bash
env:
BASE_REFERENCE: ${{ steps.base.outputs.ref }}
DOCKERFILE: ${{ matrix.dockerfile }}
run: |
set -euo pipefail
scripts/check-production-build-args.sh \
-f "$DOCKERFILE" \
--build-arg "BASE_IMAGE=${BASE_REFERENCE}" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox"
- name: Build PR managed image from local base
if: steps.base.outputs.local == 'true'
shell: bash
env:
AGENT: ${{ matrix.agent }}
BASE_IMAGE: ${{ steps.base.outputs.ref }}
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
DOCKERFILE: ${{ matrix.dockerfile }}
IMAGE_REFERENCE: ${{ matrix.image }}:${{ github.event.pull_request.head.sha }}
PUBLICATION_COHORT: ${{ needs.publication-identity.outputs.cohort }}
RELEASE: ${{ steps.release.outputs.value }}
RESOLUTION_KEY: ${{ steps.base.outputs.resolution_key }}
RESOLUTION_LABEL: ${{ steps.base.outputs.resolution_label }}
MCPORTER_AUDIT_RECEIPT: ${{ steps.mcporter-audit.outputs.receipt }}
MCPORTER_AUDIT_RAW_REPORT: ${{ steps.mcporter-audit.outputs.raw }}
MCPORTER_AUDIT_POLICY_RESULT: ${{ steps.mcporter-audit.outputs.policy }}
MCPORTER_AUDIT_RECEIPT_SHA256: ${{ steps.mcporter-audit.outputs.receipt_sha256 }}
MCPORTER_AUDIT_POLICY_RESULT_SHA256: ${{ steps.mcporter-audit.outputs.policy_sha256 }}
run: |
set -euo pipefail
# The base resolver loads a changed base into Docker's local image
# store. Keep this consumer on that same store: a Buildx container
# builder otherwise treats the local-only reference as Docker Hub.
resolution_labels=()
audit_options=()
if [ "$AGENT" = "openclaw" ]; then
audit_options+=(
--build-arg "NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256=${MCPORTER_AUDIT_RECEIPT_SHA256}"
--build-arg "NEMOCLAW_MCPORTER_AUDIT_POLICY_RESULT_SHA256=${MCPORTER_AUDIT_POLICY_RESULT_SHA256}"
--secret "id=nemoclaw-mcporter-audit-receipt,src=${MCPORTER_AUDIT_RECEIPT}"
--secret "id=nemoclaw-mcporter-audit-raw-report,src=${MCPORTER_AUDIT_RAW_REPORT}"
--secret "id=nemoclaw-mcporter-audit-policy-result,src=${MCPORTER_AUDIT_POLICY_RESULT}"
)
fi
if [ "$AGENT" = "langchain-deepagents-code" ]; then
resolution_labels+=(
--label "com.nvidia.nemoclaw.base-resolution-key=${RESOLUTION_KEY}"
--label "com.nvidia.nemoclaw.base-resolution=${RESOLUTION_LABEL}"
)
fi
docker build \
--platform "$PLATFORM" \
--file "$DOCKERFILE" \
--tag "$IMAGE_REFERENCE" \
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
--label "org.opencontainers.image.revision=${CANDIDATE_SHA}" \
--label "org.opencontainers.image.version=${RELEASE}" \
--label "io.nvidia.nemoclaw.agent=${{ matrix.agent }}" \
--label "io.nvidia.nemoclaw.managed-image.contract=1" \
--label "io.nvidia.nemoclaw.managed-image.platform=${PLATFORM}" \
--label "io.nvidia.nemoclaw.managed-image.startup-profile=1" \
--label "io.nvidia.nemoclaw.managed-image.capabilities=1" \
--label "io.nvidia.nemoclaw.managed-image.cohort=${PUBLICATION_COHORT}" \
"${resolution_labels[@]}" \
"${audit_options[@]}" \
--build-arg "BASE_IMAGE=${BASE_IMAGE}" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox" \
.
- name: Build PR managed image from registry base
if: steps.base.outputs.local != 'true'
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/${{ matrix.arch }}
load: true
push: false
tags: ${{ matrix.image }}:${{ github.event.pull_request.head.sha }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }}
org.opencontainers.image.version=${{ steps.release.outputs.value }}
io.nvidia.nemoclaw.agent=${{ matrix.agent }}
io.nvidia.nemoclaw.managed-image.contract=1
io.nvidia.nemoclaw.managed-image.platform=linux/${{ matrix.arch }}
io.nvidia.nemoclaw.managed-image.startup-profile=1
io.nvidia.nemoclaw.managed-image.capabilities=1
io.nvidia.nemoclaw.managed-image.cohort=${{ needs.publication-identity.outputs.cohort }}
${{ matrix.agent == 'langchain-deepagents-code' && format('com.nvidia.nemoclaw.base-resolution-key={0}', steps.base.outputs.resolution_key) || '' }}
${{ matrix.agent == 'langchain-deepagents-code' && format('com.nvidia.nemoclaw.base-resolution={0}', steps.base.outputs.resolution_label) || '' }}
build-args: |
BASE_IMAGE=${{ steps.base.outputs.ref }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256={0}', steps.mcporter-audit.outputs.receipt_sha256) || '' }}
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_POLICY_RESULT_SHA256={0}', steps.mcporter-audit.outputs.policy_sha256) || '' }}
secret-files: |
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-receipt={0}', steps.mcporter-audit.outputs.receipt) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-raw-report={0}', steps.mcporter-audit.outputs.raw) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-policy-result={0}', steps.mcporter-audit.outputs.policy) || '' }}
cache-from: type=registry,ref=ghcr.io/nvidia/nemoclaw/${{ matrix.agent }}-sandbox:buildcache-linux-${{ matrix.arch }}
provenance: false
sbom: false
- name: Validate exact PR managed image contract
id: contract
shell: bash
env:
AGENT: ${{ matrix.agent }}
IMAGE_REFERENCE: ${{ matrix.image }}:${{ github.event.pull_request.head.sha }}
PUBLICATION_COHORT: ${{ needs.publication-identity.outputs.cohort }}
RELEASE: ${{ steps.release.outputs.value }}
RESOLUTION_KEY: ${{ steps.base.outputs.resolution_key }}
RESOLUTION_LABEL: ${{ steps.base.outputs.resolution_label }}
run: |
set -euo pipefail
image_json="$(docker image inspect "$IMAGE_REFERENCE")"
if [ "$AGENT" = "hermes" ]; then
layer_count="$(jq -er '.[0].RootFS.Layers | length' <<< "$image_json")"
if [ "$layer_count" -gt 125 ]; then
echo "ERROR: Hermes managed image has ${layer_count} filesystem layers; the publication runner compatibility ceiling is 125." >&2
exit 1
fi
fi
image_id="$(
jq -er '
if length == 1 and (.[0].Id | type) == "string"
then .[0].Id
else error("expected one local image identity")
end
' <<< "$image_json"
)"
if [[ ! "$image_id" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: PR managed image did not resolve to an immutable local image ID: $image_id" >&2
exit 1
fi
if [ "$(docker image inspect --format '{{.Id}}' "$image_id")" != "$image_id" ]; then
echo "ERROR: PR managed image ID did not resolve to itself." >&2
exit 1
fi
layer_count="$(
jq -er '
if length == 1 and (.[0].RootFS.Layers | type) == "array"
then .[0].RootFS.Layers | length
else error("expected one local image layer graph")
end
' <<< "$image_json"
)"
if [ "$layer_count" -gt 124 ]; then
echo "ERROR: PR managed image has $layer_count filesystem layers; Docker import requires at most 124 to preserve one layer of headroom." >&2
exit 1
fi
if [[ ! "$PUBLICATION_COHORT" =~ ^ghrun-[1-9][0-9]{0,19}-[1-9][0-9]{0,9}$ ]] ||
! jq -e \
--arg agent "$AGENT" \
--arg cohort "$PUBLICATION_COHORT" \
--arg image_id "$image_id" \
--arg platform "$PLATFORM" \
--arg release "$RELEASE" \
--arg revision "$CANDIDATE_SHA" '
length == 1 and
.[0].Id == $image_id and
.[0].Config.User == "sandbox" and
.[0].Config.Labels["io.nvidia.nemoclaw.agent"] == $agent and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.contract"] == "1" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.platform"] == $platform and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.startup-profile"] == "1" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.capabilities"] == "1" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.cohort"] == $cohort and
.[0].Config.Labels["org.opencontainers.image.revision"] == $revision and
.[0].Config.Labels["org.opencontainers.image.version"] == $release
' <<< "$image_json" >/dev/null; then
echo "ERROR: PR managed image contract does not match the exact build identity." >&2
exit 1
fi
if [ "$AGENT" = "langchain-deepagents-code" ] &&
! jq -e --arg key "$RESOLUTION_KEY" --arg label "$RESOLUTION_LABEL" '
.[0].Config.Labels["com.nvidia.nemoclaw.base-resolution-key"] == $key and
.[0].Config.Labels["com.nvidia.nemoclaw.base-resolution"] == $label
' <<< "$image_json" >/dev/null; then
echo "ERROR: Deep Agents Code managed image lost base resolution metadata." >&2
exit 1
fi
if [ "$AGENT" = "langchain-deepagents-code" ]; then
scripts/checks/verify-dcode-conversation-history-image.sh "$image_id" "$PLATFORM" 0
fi
discovery_runtime="/usr/local/lib/nemoclaw/mcp-tool-discovery-runtime"
if ! actual_discovery_contract="$(
docker run --rm --platform "$PLATFORM" --entrypoint /bin/sh "$image_id" -c '
set -eu
discovery_runtime="$1"
if ! entry_owner_unsafe="$(
find -P "$discovery_runtime" ! -user root -print -quit
)"; then
echo "ERROR: final PR managed image discovery entry ownership inspection failed." >&2
exit 1
fi
if [ -n "$entry_owner_unsafe" ]; then
echo "ERROR: final PR managed image discovery entry is not root-owned: $entry_owner_unsafe" >&2
exit 1
fi
if ! owner_or_write_unsafe="$(
find -L "$discovery_runtime" \
\( ! -user root -o -perm /022 \) -print -quit
)"; then
echo "ERROR: final PR managed image discovery tree inspection failed." >&2
exit 1
fi
if [ -n "$owner_or_write_unsafe" ]; then
echo "ERROR: final PR managed image discovery tree is not root-owned and read-only: $owner_or_write_unsafe" >&2
exit 1
fi
if ! mode_unsafe="$(
find -P "$discovery_runtime" \
\( \( -type d ! -perm 0555 \) -o \( -type f ! -perm 0444 \) \) \
-print -quit
)"; then
echo "ERROR: final PR managed image discovery mode inspection failed." >&2
exit 1
fi
if [ -n "$mode_unsafe" ]; then
echo "ERROR: final PR managed image discovery path has an unexpected mode: $mode_unsafe" >&2
exit 1
fi
node "$discovery_runtime/mcp-tool-discovery.mjs"
' -- "$discovery_runtime"
)"; then
echo "ERROR: final PR managed image discovery contract probe failed." >&2
exit 1
fi
if ! node -e '
const expected = {
protocol: 2,
ok: false,
count: 0,
tools: [],
truncated: false,
detail: "tool discovery received invalid runtime arguments",
failedStage: "preflight",
failureClass: "precondition",
};
let result;
try {
result = JSON.parse(require("node:fs").readFileSync(0, "utf8"));
} catch {
process.exit(1);
}
const record =
result !== null && typeof result === "object" && !Array.isArray(result)
? result
: undefined;
if (
!record ||
Object.keys(record).length !== Object.keys(expected).length ||
record.protocol !== expected.protocol ||
record.ok !== expected.ok ||
record.count !== expected.count ||
!Array.isArray(record.tools) ||
record.tools.length !== 0 ||
record.truncated !== expected.truncated ||
record.detail !== expected.detail ||
record.failedStage !== expected.failedStage ||
record.failureClass !== expected.failureClass
) {
process.exit(1);
}
' <<< "$actual_discovery_contract" >/dev/null; then
echo "ERROR: final PR managed image discovery bundle contract mismatch." >&2
exit 1
fi
printf 'reference=%s\n' "$image_id" >> "$GITHUB_OUTPUT"
printf '### %s exact PR managed image\n\n`%s`\n' "$AGENT" "$image_id" \
>> "$GITHUB_STEP_SUMMARY"
- name: Install managed-image direct harness dependencies
shell: bash
env:
AGENT: ${{ matrix.agent }}
run: |
set -euo pipefail
if [ "$AGENT" = "hermes" ]; then
node scripts/lib/openshell-sdk-install.mts prepare
fi
npm ci --ignore-scripts --no-audit --no-fund --@nvidia:registry=https://npm.pkg.github.com
if [ "$AGENT" = "hermes" ]; then
node scripts/lib/openshell-sdk-install.mts check
fi
npm run build:policy-boundary
- name: Build CLI for Hermes runtime contract
if: matrix.agent == 'hermes'
run: npm run build:cli
- name: Verify native Hermes Discord status before publication
if: matrix.agent == 'hermes'
shell: bash
env:
IMAGE_REFERENCE: ${{ steps.contract.outputs.reference }}
run: |
set -euo pipefail
npx --no-install tsx scripts/checks/run-hermes-discord-runtime-contract.mts \
--image "$IMAGE_REFERENCE" --platform "$PLATFORM"
- name: Exercise managed startup root stdin and hold
shell: bash
env:
AGENT: ${{ matrix.agent }}
IMAGE_REFERENCE: ${{ steps.contract.outputs.reference }}
run: |
set -euo pipefail
npx --no-install tsx \
scripts/checks/run-managed-image-direct-e2e.ts \
--agent "$AGENT" \
--image "$IMAGE_REFERENCE" \
--platform "$PLATFORM"
- name: Prepare passive Hermes native crash capture
id: hermes-crash-capture
if: matrix.agent == 'hermes' && matrix.arch == 'amd64'
timeout-minutes: 5
shell: bash
run: |
set -euo pipefail
if ! command -v gdb >/dev/null; then
if ! sudo apt-get update || ! sudo apt-get install -y --no-install-recommends gdb; then
echo '::warning::Debugger installation failed; Hermes qualification will run without crash capture.'
exit 0
fi
fi
umask 077
saved="$RUNNER_TEMP/nemoclaw-hermes-original-core-pattern"
test ! -e "$saved"
test ! -L "$saved"
cp /proc/sys/kernel/core_pattern "$saved"
printf '%s\n' '/tmp/nemoclaw-hermes-crash/core.%p' | sudo tee /proc/sys/kernel/core_pattern >/dev/null
printf '%s\n' 'enabled=true' >> "$GITHUB_OUTPUT"
- name: Qualify Hermes root entrypoint and Switchyard package
if: matrix.agent == 'hermes'
timeout-minutes: 30
env:
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/hermes-root-entrypoint-smoke
NEMOCLAW_HERMES_TEST_IMAGE: ${{ steps.contract.outputs.reference }}
NEMOCLAW_RUN_LIVE_E2E: "1"
NEMOCLAW_HERMES_CRASH_CAPTURE: ${{ matrix.arch == 'amd64' && steps.hermes-crash-capture.outputs.enabled == 'true' && '1' || '0' }}
run: |
npx --no-install vitest run --project e2e-live \
test/e2e/live/hermes-root-entrypoint-smoke.test.ts
- name: Restore core settings and remove private Hermes crash memory
if: always() && matrix.agent == 'hermes' && matrix.arch == 'amd64'
timeout-minutes: 2
shell: bash
run: |
set -euo pipefail
status=0
saved="$RUNNER_TEMP/nemoclaw-hermes-original-core-pattern"
if [ -f "$saved" ]; then
if ! sudo tee /proc/sys/kernel/core_pattern <"$saved" >/dev/null; then
echo '::error::Failed to restore the original core pattern'
status=1
# Read procfs through a pipe: its reported file size can be zero.
elif ! cat /proc/sys/kernel/core_pattern | cmp -s "$saved" -; then
echo '::error::Failed to verify the restored core pattern'
status=1
else
rm -f "$saved" || status=1
fi
fi
find "$RUNNER_TEMP" -maxdepth 1 -type d -name 'nemoclaw-hermes-crash-*' -exec rm -rf -- {} + || status=1
if containers="$(docker ps -aq --filter label=io.nvidia.nemoclaw.hermes-crash-capture=1)"; then
if [ -n "$containers" ]; then
while IFS= read -r container; do
docker rm -f "$container" || status=1
done <<<"$containers"
fi
else
status=1
fi
exit "$status"
- name: Upload Hermes package qualification artifacts
if: always() && matrix.agent == 'hermes'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: hermes-root-entrypoint-pr-${{ matrix.arch }}-${{ github.run_attempt }}
path: e2e-artifacts/live/hermes-root-entrypoint-smoke/
include-hidden-files: false
if-no-files-found: ignore
retention-days: 14
- name: Log in to GHCR for exact same-repository PR digest
if: github.event.pull_request.head.repo.full_name == github.repository
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Publish by digest only. No candidate tag, cohort tag, or release alias is
# created, so this proof cannot expose an incomplete all-agent cohort.
- name: Publish exact same-repository PR managed image by digest
id: publish
if: github.event.pull_request.head.repo.full_name == github.repository
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/${{ matrix.arch }}
build-contexts: ${{ steps.base.outputs.local == 'true' && format('nemoclaw-pr-base=oci-layout://{0}', steps.base.outputs.oci) || '' }}
outputs: type=image,name=${{ matrix.repository }},push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }}
org.opencontainers.image.version=${{ steps.release.outputs.value }}
io.nvidia.nemoclaw.agent=${{ matrix.agent }}
io.nvidia.nemoclaw.managed-image.contract=1
io.nvidia.nemoclaw.managed-image.platform=linux/${{ matrix.arch }}
io.nvidia.nemoclaw.managed-image.startup-profile=1
io.nvidia.nemoclaw.managed-image.capabilities=1
io.nvidia.nemoclaw.managed-image.cohort=${{ needs.publication-identity.outputs.cohort }}
${{ matrix.agent == 'langchain-deepagents-code' && format('com.nvidia.nemoclaw.base-resolution-key={0}', steps.base.outputs.resolution_key) || '' }}
${{ matrix.agent == 'langchain-deepagents-code' && format('com.nvidia.nemoclaw.base-resolution={0}', steps.base.outputs.resolution_label) || '' }}
build-args: |
BASE_IMAGE=${{ steps.base.outputs.local == 'true' && 'nemoclaw-pr-base' || steps.base.outputs.ref }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256={0}', steps.mcporter-audit.outputs.receipt_sha256) || '' }}
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_POLICY_RESULT_SHA256={0}', steps.mcporter-audit.outputs.policy_sha256) || '' }}
secret-files: |
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-receipt={0}', steps.mcporter-audit.outputs.receipt) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-raw-report={0}', steps.mcporter-audit.outputs.raw) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-policy-result={0}', steps.mcporter-audit.outputs.policy) || '' }}
cache-from: type=registry,ref=ghcr.io/nvidia/nemoclaw/${{ matrix.agent }}-sandbox:buildcache-linux-${{ matrix.arch }}
provenance: false
sbom: false
- name: Remove PR publication credentials
if: always() && github.event.pull_request.head.repo.full_name == github.repository
shell: bash
run: docker logout ghcr.io
- name: Pull exact published PR managed image
if: github.event.pull_request.head.repo.full_name == github.repository
shell: bash
env:
IMAGE_REFERENCE: ${{ format('{0}@{1}', matrix.repository, steps.publish.outputs.digest) }}
run: |
set -euo pipefail
scripts/checks/pull-public-exact-digest.sh "$IMAGE_REFERENCE" "$PLATFORM"
- name: Verify published PR Hermes Discord status
if: matrix.agent == 'hermes' && github.event.pull_request.head.repo.full_name == github.repository
shell: bash
env:
IMAGE_REFERENCE: ${{ format('{0}@{1}', matrix.repository, steps.publish.outputs.digest) }}
run: |
set -euo pipefail
npx --no-install tsx scripts/checks/run-hermes-discord-runtime-contract.mts \
--image "$IMAGE_REFERENCE" --platform "$PLATFORM"
- name: Export exact published PR managed-image contract
if: github.event.pull_request.head.repo.full_name == github.repository
shell: bash
env:
AGENT: ${{ matrix.agent }}
COHORT: ${{ needs.publication-identity.outputs.cohort }}
DIGEST: ${{ steps.publish.outputs.digest }}
IMAGE: ${{ matrix.repository }}
RELEASE: ${{ steps.release.outputs.value }}
RESOLUTION_KEY: ${{ steps.base.outputs.resolution_key }}
RESOLUTION_LABEL: ${{ steps.base.outputs.resolution_label }}
run: |
set -euo pipefail
[[ "$CANDIDATE_SHA" =~ ^[a-f0-9]{40}$ ]] || {
echo "ERROR: exact PR head SHA is invalid" >&2
exit 1
}
[[ "$DIGEST" =~ ^sha256:[a-f0-9]{64}$ ]] || {
echo "ERROR: PR publication did not return an immutable digest" >&2
exit 1
}
reference="${IMAGE}@${DIGEST}"
raw="$RUNNER_TEMP/${AGENT}-published-manifest.raw"
if [ "$AGENT" = "hermes" ]; then
published_layer_count="$(docker image inspect --format '{{len .RootFS.Layers}}' "$reference")"
if [ "$published_layer_count" -gt 125 ]; then
echo "ERROR: Hermes managed image has ${published_layer_count} filesystem layers; the publication runner compatibility ceiling is 125." >&2
exit 1
fi
fi
docker buildx imagetools inspect "$reference" --raw > "$raw"
[[ "sha256:$(sha256sum "$raw" | awk '{print $1}')" == "$DIGEST" ]] || {
echo "ERROR: published PR manifest bytes do not match the build digest" >&2
exit 1
}
published_release="$(
docker image inspect \
--format '{{index .Config.Labels "org.opencontainers.image.version"}}' \
"$reference"
)"
if [ "$published_release" != "$RELEASE" ]; then
echo "ERROR: published PR image release label does not match the immutable contract." >&2
exit 1
fi
if [ "$AGENT" = "langchain-deepagents-code" ] &&
{ [ "$(docker image inspect --format '{{index .Config.Labels "com.nvidia.nemoclaw.base-resolution-key"}}' "$reference")" != "$RESOLUTION_KEY" ] ||
[ "$(docker image inspect --format '{{index .Config.Labels "com.nvidia.nemoclaw.base-resolution"}}' "$reference")" != "$RESOLUTION_LABEL" ]; }; then
echo "ERROR: published Deep Agents Code image lost base resolution metadata." >&2
exit 1
fi
contract_dir="$RUNNER_TEMP/managed-pr-contract"
mkdir -p "$contract_dir"
jq -n \
--arg agent "$AGENT" \
--arg cohort "$COHORT" \
--arg digest "$DIGEST" \
--arg image "$IMAGE" \
--arg reference "$reference" \
--arg platform "$PLATFORM" \
--arg release "$RELEASE" \
--arg revision "$CANDIDATE_SHA" \
'{
contractVersion: 1,
agent: $agent,
platform: $platform,
image: $image,
digest: $digest,
reference: $reference,
source: {
repository: "NVIDIA/NemoClaw",
revision: $revision,
release: $release,
cohort: $cohort
},
startupProfileContractVersion: 1,
capabilityContractVersion: 1
}' > "$contract_dir/contract.json"
- name: Upload exact published PR managed-image contract
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-pr-contract-${{ matrix.arch == 'arm64' && 'arm64-' || '' }}${{ github.run_id }}-${{ matrix.agent }}
path: ${{ runner.temp }}/managed-pr-contract/contract.json
if-no-files-found: error
overwrite: true
retention-days: 7
pr-managed-activation:
name: PR exact all-agent managed runtime activation (${{ matrix.arch }})
needs: [pr-build-and-entrypoint, publication-identity]
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
timeout-minutes: 90
permissions:
contents: read
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/managed-image-activation
E2E_JOB: "1"
E2E_TARGET_ID: managed-image-activation
NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js
NEMOCLAW_E2E_EXPECTED_SHA: ${{ github.event.pull_request.head.sha }}
NEMOCLAW_E2E_SHARD: default
NEMOCLAW_MANAGED_ACTIVATION_CATALOG: ${{ github.workspace }}/managed-pr-catalog.json
MANAGED_IMAGE_PLATFORM: linux/${{ matrix.arch }}
NEMOCLAW_NON_INTERACTIVE: "1"
NEMOCLAW_RUN_LIVE_E2E: "1"
OPENSHELL_GATEWAY: nemoclaw
steps:
- name: Checkout exact PR head
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
- name: Install reviewed npm
uses: NVIDIA/NemoClaw/.github/actions/setup-reviewed-npm@98669f24d35f18e49b6b2769cd68709509ea24f2
- name: Bind E2E correlation identity
shell: bash
run: |
set -euo pipefail
correlation_id="$(node --input-type=module -e \
'import { randomUUID } from "node:crypto"; console.log(randomUUID())')"
[[ "$correlation_id" =~ ^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$ ]]
printf 'NEMOCLAW_E2E_CORRELATION_ID=%s\n' "$correlation_id" >> "$GITHUB_ENV"
- name: Download exact published all-agent contracts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: managed-pr-contract-${{ matrix.arch == 'arm64' && 'arm64-' || '' }}${{ github.run_id }}-*
path: ${{ runner.temp }}/managed-pr-contracts
merge-multiple: false
- name: Assemble exact all-agent activation catalog
shell: bash
run: |
set -euo pipefail
node scripts/lib/openshell-sdk-install.mts prepare
npm ci --ignore-scripts --no-audit --no-fund --@nvidia:registry=https://npm.pkg.github.com
node scripts/lib/openshell-sdk-install.mts check
mapfile -d '' contracts < <(
find "$RUNNER_TEMP/managed-pr-contracts" -type f -name contract.json -print0
)
node --no-warnings \
tools/e2e/pr-managed-image-publication.mts assemble \
"$CANDIDATE_SHA" \
"$NEMOCLAW_MANAGED_ACTIVATION_CATALOG" \
"${contracts[@]}"
- name: Bind CLI to publication release
shell: bash
env:
RELEASE: ${{ needs.publication-identity.outputs.release }}
run: |
set -euo pipefail
[[ "$(git rev-parse --verify HEAD)" == "$CANDIDATE_SHA" ]] || {
echo "ERROR: CLI checkout does not match the publication revision." >&2
exit 1
}
node --no-warnings -e '
const fs = require("node:fs");
const { validateBuildIdentity } = require("./src/lib/core/version.ts");
if (!process.env.RELEASE.startsWith("v")) throw new Error("Missing publication release prefix.");
const identity = validateBuildIdentity({
nemoclawVersion: process.env.RELEASE.slice(1),
sourceRevision: process.env.CANDIDATE_SHA,
});
fs.mkdirSync("dist", { recursive: true });
fs.writeFileSync("dist/build-identity.json", JSON.stringify(identity) + "\n");
'
- name: Build exact candidate CLI
run: npm run build:cli
- name: Install OpenShell CLI
shell: bash
run: env -u GITHUB_TOKEN bash scripts/install-openshell.sh
- name: Run real all-agent managed runtime activation
shell: bash
run: |
set -euo pipefail
[[ "$(git rev-parse --verify HEAD)" == "$CANDIDATE_SHA" ]] || {
echo "ERROR: managed activation checkout does not match the exact PR head" >&2
exit 1
}
export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH"
export OPENSHELL_BIN="$(command -v openshell)"
"$OPENSHELL_BIN" --version
npx --no-install tsx tools/e2e/live-vitest-invocation.mts run \
--test-path test/e2e/live/managed-image-activation-e2e.test.ts
- name: Upload managed runtime activation evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-activation-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.arch }}
path: e2e-artifacts/live/managed-image-activation/
if-no-files-found: error
retention-days: 1
pr-managed-podman-activation:
name: PR exact all-agent managed runtime activation on rootless Podman
needs: [pr-build-and-entrypoint, publication-identity]
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-26.04
timeout-minutes: 90
permissions:
contents: read
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha }}
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/managed-image-podman-activation
E2E_JOB: "1"
E2E_SOURCE_REVISION: ${{ github.event.pull_request.head.sha }}
E2E_TARGET_ID: managed-image-activation
NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js
NEMOCLAW_E2E_EXPECTED_SHA: ${{ github.event.pull_request.head.sha }}
NEMOCLAW_E2E_SHARD: default
NEMOCLAW_GATEWAY_RUNTIME: podman
NEMOCLAW_MANAGED_ACTIVATION_CATALOG: ${{ github.workspace }}/managed-pr-catalog.json
NEMOCLAW_NON_INTERACTIVE: "1"
NEMOCLAW_RUN_LIVE_E2E: "1"
OPENSHELL_DRIVERS: podman
OPENSHELL_GATEWAY: nemoclaw
PODMAN_APT_VERSION: "5.7.0+ds2-3build1"
steps:
- name: Checkout exact PR head
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Initialize managed Podman activation diagnostics
shell: bash
run: |
set -euo pipefail
install -d -m 0700 "$E2E_ARTIFACT_DIR"
printf 'candidate_sha=%s\nphase=setup\n' "$CANDIDATE_SHA" \
>"$E2E_ARTIFACT_DIR/setup-context.txt"
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
- name: Install reviewed npm
uses: NVIDIA/NemoClaw/.github/actions/setup-reviewed-npm@98669f24d35f18e49b6b2769cd68709509ea24f2
- name: Bind E2E correlation identity
shell: bash
run: |
set -euo pipefail
correlation_id="$(node --input-type=module -e \
'import { randomUUID } from "node:crypto"; console.log(randomUUID())')"
[[ "$correlation_id" =~ ^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$ ]]
printf 'NEMOCLAW_E2E_CORRELATION_ID=%s\n' "$correlation_id" >> "$GITHUB_ENV"
- name: Download exact published all-agent contracts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: managed-pr-contract-${{ github.run_id }}-*
path: ${{ runner.temp }}/managed-pr-contracts
merge-multiple: false
- name: Assemble exact all-agent activation catalog
shell: bash
run: |
set -euo pipefail
node scripts/lib/openshell-sdk-install.mts prepare
npm ci --ignore-scripts --no-audit --no-fund --@nvidia:registry=https://npm.pkg.github.com
node scripts/lib/openshell-sdk-install.mts check
mapfile -d '' contracts < <(
find "$RUNNER_TEMP/managed-pr-contracts" -type f -name contract.json -print0
)
node --no-warnings \
tools/e2e/pr-managed-image-publication.mts assemble \
"$CANDIDATE_SHA" \
"$NEMOCLAW_MANAGED_ACTIVATION_CATALOG" \
"${contracts[@]}"
- name: Bind CLI to publication release
shell: bash
env:
RELEASE: ${{ needs.publication-identity.outputs.release }}
run: |
set -euo pipefail
[[ "$(git rev-parse --verify HEAD)" == "$CANDIDATE_SHA" ]] || {
echo "ERROR: CLI checkout does not match the publication revision." >&2
exit 1
}
node --no-warnings -e '
const fs = require("node:fs");
const { validateBuildIdentity } = require("./src/lib/core/version.ts");
if (!process.env.RELEASE.startsWith("v")) throw new Error("Missing publication release prefix.");
const identity = validateBuildIdentity({
nemoclawVersion: process.env.RELEASE.slice(1),
sourceRevision: process.env.CANDIDATE_SHA,
});
fs.mkdirSync("dist", { recursive: true });
fs.writeFileSync("dist/build-identity.json", JSON.stringify(identity) + "\n");
'
- name: Build exact candidate CLI
run: npm run build:cli
- name: Install OpenShell CLI
shell: bash
run: env -u GITHUB_TOKEN bash scripts/install-openshell.sh
- name: Install rootless Podman runtime
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install --yes \
apparmor \
fuse-overlayfs \
passt \
slirp4netns \
uidmap \
"podman=$PODMAN_APT_VERSION"
test "$(dpkg-query --show --showformat='${Version}' podman)" = "$PODMAN_APT_VERSION"
test "$(podman --version)" = "podman version 5.7.0"
pasta_profile=/etc/apparmor.d/usr.bin.pasta
signal_rule='^[[:space:]]*signal[[:space:]]+\(receive\)[[:space:]]+peer=podman,[[:space:]]*$'
test -f "$pasta_profile"
if ! grep -Eq "$signal_rule" "$pasta_profile"; then
sudo sed -i \
'/^[[:space:]]*include <abstractions\/pasta>[[:space:]]*$/a\ signal (receive) peer=podman,' \
"$pasta_profile"
fi
sudo apparmor_parser -r "$pasta_profile"
- name: Start exact rootless Podman API service
shell: bash
run: |
set -euo pipefail
umask 077
uid="$(id -u)"
runtime_dir="/run/user/$uid"
socket_path="$runtime_dir/podman/podman.sock"
install -d -m 0700 "$runtime_dir" "$runtime_dir/podman" "$E2E_ARTIFACT_DIR"
export XDG_RUNTIME_DIR="$runtime_dir"
containers_conf="$RUNNER_TEMP/nemoclaw-managed-podman-containers.conf"
cat >"$containers_conf" <<'CONTAINERS_CONF'
[network]
default_rootless_network_cmd = "pasta"
firewall_driver = "iptables"
[engine]
env = ["NETAVARK_FW=iptables"]
CONTAINERS_CONF
chmod 0600 "$containers_conf"
export CONTAINERS_CONF="$containers_conf"
export NETAVARK_FW=iptables
service_log="$E2E_ARTIFACT_DIR/podman-system-service.log"
podman system service --time=0 "unix://$socket_path" >"$service_log" 2>&1 &
service_pid="$!"
for attempt in $(seq 1 30); do
if podman --url "unix://$socket_path" info --format json \
>"$E2E_ARTIFACT_DIR/podman-info.json" 2>>"$service_log"; then
break
fi
test "$attempt" -lt 30
sleep 1
done
test -S "$socket_path"
jq -e '(.host.security.rootless // .Host.Security.Rootless) == true' \
"$E2E_ARTIFACT_DIR/podman-info.json" >/dev/null
sudo ip address replace 169.254.2.2/32 dev lo
{
printf 'CONTAINER_HOST=unix://%s\n' "$socket_path"
printf 'CONTAINERS_CONF=%s\n' "$containers_conf"
printf 'E2E_MANAGED_PODMAN_SERVICE_PID=%s\n' "$service_pid"
printf 'NETAVARK_FW=iptables\n'
printf 'OPENSHELL_PODMAN_SOCKET=%s\n' "$socket_path"
printf 'XDG_RUNTIME_DIR=%s\n' "$runtime_dir"
} >>"$GITHUB_ENV"
- name: Disable and guard Docker
shell: bash
run: |
set -euo pipefail
guard_dir="$RUNNER_TEMP/nemoclaw-managed-podman-docker-guard"
guard_log="$guard_dir/invocations.log"
install -d -m 0700 "$guard_dir/bin"
: >"$guard_log"
cat >"$guard_dir/bin/docker" <<'DOCKER_GUARD'
#!/usr/bin/env bash
guard_bin_dir="${BASH_SOURCE[0]%/*}"
subcommand="${1:-missing}"
[[ "$subcommand" =~ ^[a-z][a-z0-9-]{0,31}$ ]] || subcommand=invalid
printf '%s\n' "$subcommand" >>"$guard_bin_dir/../invocations.log"
printf 'Docker CLI use is forbidden in managed Podman activation.\n' >&2
exit 97
DOCKER_GUARD
chmod 0700 "$guard_dir/bin/docker"
guard_bin="$guard_dir/bin/docker"
guarded_path="$guard_dir/bin:$PATH"
export DOCKER_API_VERSION= DOCKER_CERT_PATH= DOCKER_CONFIG= DOCKER_CONTEXT=
export DOCKER_HOST= DOCKER_TLS_VERIFY=
export E2E_DOCKER_GUARD_BIN="$guard_bin" E2E_DOCKER_GUARD_LOG="$guard_log"
export PATH="$guarded_path"
sudo systemctl stop docker.service docker.socket || true
sudo systemctl mask --runtime docker.service docker.socket || true
sudo pkill -TERM -x dockerd 2>/dev/null || true
for attempt in $(seq 1 20); do
if ! pgrep -x dockerd >/dev/null; then
break
fi
sleep 1
done
if pgrep -x dockerd >/dev/null; then
echo "::error::dockerd remained active after Docker shutdown" >&2
exit 1
fi
sudo rm -f /var/run/docker.sock /run/docker.sock
{
printf 'DOCKER_API_VERSION=\n'
printf 'DOCKER_CERT_PATH=\n'
printf 'DOCKER_CONFIG=\n'
printf 'DOCKER_CONTEXT=\n'
printf 'DOCKER_HOST=\n'
printf 'DOCKER_TLS_VERIFY=\n'
printf 'E2E_DOCKER_GUARD_BIN=%s\n' "$guard_bin"
printf 'E2E_DOCKER_GUARD_LOG=%s\n' "$guard_log"
printf 'PATH=%s\n' "$guarded_path"
} >>"$GITHUB_ENV"
if systemctl is-active --quiet docker.service; then
echo "::error::docker.service remained active after Docker shutdown" >&2
exit 1
fi
if systemctl is-active --quiet docker.socket; then
echo "::error::docker.socket remained active after Docker shutdown" >&2
exit 1
fi
if [ -S /var/run/docker.sock ]; then
echo "::error::Docker socket remained available after Docker shutdown" >&2
exit 1
fi
docker_candidate="$(command -v docker || true)"
if [ "$docker_candidate" != "$guard_bin" ]; then
echo "::error::Docker command resolution escaped the invocation guard" >&2
exit 1
fi
jq -n \
--arg dockerCandidate "$docker_candidate" \
'{
schemaVersion: 1,
phase: "before-candidate",
dockerServiceActive: false,
dockerSocketActive: false,
dockerDaemonActive: false,
dockerSocketPresent: false,
dockerGuardInvocationCount: 0,
dockerCandidate: $dockerCandidate
}' >"$E2E_ARTIFACT_DIR/docker-absence-before-candidate.json"
- name: Run real all-agent managed runtime activation on Podman
shell: bash
run: |
set -euo pipefail
test "$(git rev-parse --verify HEAD)" = "$CANDIDATE_SHA"
export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH"
export OPENSHELL_BIN="$(command -v openshell)"
"$OPENSHELL_BIN" --version
npx --no-install tsx tools/e2e/live-vitest-invocation.mts run \
--test-path test/e2e/live/managed-image-activation-e2e.test.ts
- name: Verify Docker stayed unavailable
if: always()
shell: bash
run: |
set -euo pipefail
test -f "$E2E_DOCKER_GUARD_LOG"
guard_bytes="$(wc -c <"$E2E_DOCKER_GUARD_LOG" | tr -d '[:space:]')"
guard_commands="$(jq -Rsc 'split("\n") | map(select(length > 0)) | unique' "$E2E_DOCKER_GUARD_LOG")"
docker_candidate="$(command -v docker || true)"
docker_service_state="$(systemctl is-active docker.service 2>/dev/null || true)"
docker_socket_state="$(systemctl is-active docker.socket 2>/dev/null || true)"
docker_daemon_active=false
docker_socket_present=false
pgrep -x dockerd >/dev/null && docker_daemon_active=true
[ -S /var/run/docker.sock ] && docker_socket_present=true
jq -n \
--arg dockerCandidate "$docker_candidate" \
--arg dockerServiceState "$docker_service_state" \
--arg dockerSocketState "$docker_socket_state" \
--argjson dockerDaemonActive "$docker_daemon_active" \
--argjson dockerSocketPresent "$docker_socket_present" \
--argjson dockerGuardCommands "$guard_commands" \
--argjson guardBytes "$guard_bytes" \
'{
schemaVersion: 1,
phase: "after-candidate",
dockerServiceState: $dockerServiceState,
dockerSocketState: $dockerSocketState,
dockerDaemonActive: $dockerDaemonActive,
dockerSocketPresent: $dockerSocketPresent,
dockerGuardBytes: $guardBytes,
dockerGuardCommands: $dockerGuardCommands,
dockerCandidate: $dockerCandidate
}' >"$E2E_ARTIFACT_DIR/docker-absence-after-candidate.json"
if [ "$guard_bytes" -ne 0 ]; then
echo "::error::Docker invocation guard recorded candidate execution: $(jq -r 'join(",")' <<<"$guard_commands")" >&2
exit 1
fi
if [ "$docker_candidate" != "$E2E_DOCKER_GUARD_BIN" ]; then
echo "::error::Docker command resolution escaped the invocation guard" >&2
exit 1
fi
if [ "$docker_service_state" = active ]; then
echo "::error::docker.service became active during managed Podman activation" >&2
exit 1
fi
if [ "$docker_socket_state" = active ]; then
echo "::error::docker.socket became active during managed Podman activation" >&2
exit 1
fi
if [ "$docker_daemon_active" = true ]; then
echo "::error::dockerd became active during managed Podman activation" >&2
exit 1
fi
if [ "$docker_socket_present" = true ]; then
echo "::error::Docker socket became available during managed Podman activation" >&2
exit 1
fi
- name: Stop rootless Podman API service
if: always()
shell: bash
run: |
set -euo pipefail
sudo ip address delete 169.254.2.2/32 dev lo 2>/dev/null || true
service_pid="${E2E_MANAGED_PODMAN_SERVICE_PID:-}"
if [[ "$service_pid" =~ ^[1-9][0-9]*$ ]]; then
kill "$service_pid" 2>/dev/null || true
wait "$service_pid" 2>/dev/null || true
fi
- name: Upload managed Podman activation evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-podman-activation-${{ github.run_id }}-${{ github.run_attempt }}
path: e2e-artifacts/live/managed-image-podman-activation/
if-no-files-found: error
retention-days: 1
pi-candidate:
needs: [publication-identity]
name: Build and validate the Pi candidate managed image (${{ matrix.arch }})
if: github.repository == 'NVIDIA/NemoClaw' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
permissions:
contents: read
packages: write
strategy: &pi_candidate_strategy
fail-fast: false
matrix:
include:
- arch: amd64
platform: linux/amd64
runner: ubuntu-24.04
- arch: arm64
platform: linux/arm64
runner: ubuntu-24.04-arm
env: &pi_candidate_env
RELEASE: ${{ needs.publication-identity.outputs.release }}
BASE_DOCKERFILE: agents/pi/Dockerfile.base
CANDIDATE_IMAGE: nemoclaw-managed-candidate/pi
DOCKERFILE: agents/pi/Dockerfile
LOCAL_BASE_REFERENCE: nemoclaw-managed-candidate/pi-base:${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
PLATFORM: ${{ matrix.platform }}
PUBLICATION_COHORT: ghrun-${{ github.run_id }}-${{ github.run_attempt }}
REPOSITORY: ghcr.io/nvidia/nemoclaw/pi-sandbox
# Qualification receipts compare image sources with the PR head, never GitHub's synthetic merge.
SOURCE_REVISION: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
steps: &pi_candidate_steps
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
# Pi has no published base alias yet, so the candidate lane builds its own
# base on the target architecture. The activation change adds the shared
# published-base contract with the rest of the release cohort.
- name: Install reviewed npm
if: github.event_name == 'pull_request'
uses: NVIDIA/NemoClaw/.github/actions/setup-reviewed-npm@98669f24d35f18e49b6b2769cd68709509ea24f2
- name: Install trusted-event reviewed npm
if: github.event_name != 'pull_request'
uses: ./.github/actions/setup-reviewed-npm
- name: Build the exact Pi candidate base
id: base
shell: bash
run: |
set -euo pipefail
local_base_archive="$RUNNER_TEMP/pi-${{ matrix.arch }}-candidate-base.docker.tar"
local_base_oci_archive="$RUNNER_TEMP/pi-${{ matrix.arch }}-candidate-base.oci.tar"
local_base_oci="$RUNNER_TEMP/pi-${{ matrix.arch }}-candidate-base.oci"
docker buildx build \
--platform "$PLATFORM" \
--provenance=false \
--sbom=false \
--file "$BASE_DOCKERFILE" \
--tag "$LOCAL_BASE_REFERENCE" \
--output "type=docker,dest=${local_base_archive}" \
--output "type=oci,dest=${local_base_oci_archive}" \
.
docker load --input "$local_base_archive"
mkdir -p "$local_base_oci"
tar -C "$local_base_oci" -xf "$local_base_oci_archive"
local_base_oci_digest="$(
jq -er '
.manifests
| if length == 1 then .[0].digest else error("not one image") end
' "$local_base_oci/index.json"
)"
if [[ ! "$local_base_oci_digest" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: Pi candidate base OCI layout returned an invalid digest." >&2
exit 1
fi
printf 'oci=%s@%s\n' "$local_base_oci" "$local_base_oci_digest" >> "$GITHUB_OUTPUT"
- name: Validate candidate build args
shell: bash
run: |
set -euo pipefail
scripts/check-production-build-args.sh \
-f "$DOCKERFILE" \
--build-arg "BASE_IMAGE=nemoclaw-pi-base" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1" \
--build-arg "NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox"
- name: Build the Pi candidate managed image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: agents/pi/Dockerfile
platforms: ${{ matrix.platform }}
build-contexts: nemoclaw-pi-base=oci-layout://${{ steps.base.outputs.oci }}
load: true
push: false
tags: nemoclaw-managed-candidate/pi:${{ env.SOURCE_REVISION }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ env.SOURCE_REVISION }}
io.nvidia.nemoclaw.agent=pi
io.nvidia.nemoclaw.managed-image.contract=1
io.nvidia.nemoclaw.managed-image.platform=${{ matrix.platform }}
io.nvidia.nemoclaw.managed-image.startup-profile=1
io.nvidia.nemoclaw.managed-image.capabilities=1
io.nvidia.nemoclaw.managed-image.cohort=ghrun-${{ github.run_id }}-${{ github.run_attempt }}
build-args: |
BASE_IMAGE=nemoclaw-pi-base
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox
provenance: false
sbom: false
- name: Validate the Pi candidate runtime contract
shell: bash
env:
IMAGE_REFERENCE: nemoclaw-managed-candidate/pi:${{ env.SOURCE_REVISION }}
run: |
set -euo pipefail
image_json="$(docker image inspect "$IMAGE_REFERENCE")"
if ! jq -e \
--arg platform "$PLATFORM" \
'
length == 1 and (
.[0].Config.Labels["io.nvidia.nemoclaw.agent"] == "pi" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.platform"] == $platform and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.startup-profile"] == "1" and
.[0].Config.Entrypoint == ["/usr/local/bin/nemoclaw-start"]
)
' <<< "$image_json" >/dev/null
then
echo "ERROR: the Pi candidate image does not carry the managed-image runtime contract." >&2
exit 1
fi
version="$(docker run --rm --entrypoint /usr/local/bin/pi "$IMAGE_REFERENCE" --version)"
expected_version="$(node -p 'require("./agents/pi/pi-runtime/package.json").dependencies["@earendil-works/pi-coding-agent"]')"
grep -Fq "$expected_version" <<< "$version"
docker run --rm --entrypoint /bin/bash "$IMAGE_REFERENCE" -c '
set -eu
test "$(stat -c %a /sandbox/.pi/agent/models.json)" = 600
test "$(stat -c %U /sandbox/.pi/agent/models.json)" = sandbox
node -e "const c=require(\"/sandbox/.pi/agent/models.json\"); if (!c.defaultModel || !c.providers.openshell.baseUrl) process.exit(1)"
runtime=/usr/local/lib/nemoclaw/managed-startup-image-runtime.cjs
test -f "$runtime"
test ! -L "$runtime"
test "$(stat -c "%u:%g:%a" "$runtime")" = 0:0:444
test -x /usr/local/bin/nemoclaw-managed-startup-hold
test ! -e /usr/local/bin/nemoclaw-managed-bootstrap
test ! -e /usr/local/lib/nemoclaw/managed-bootstrap-trampoline.sh
'
- name: Log in to GHCR
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Publish only the canonical digest. The candidate repository has no
# consumer alias, so a published candidate stays reachable by digest alone.
- name: Publish and validate the Pi candidate image by digest
id: publish
uses: ./.github/actions/publish-managed-image-digest
with:
builder: ${{ steps.buildx.outputs.name }}
file: agents/pi/Dockerfile
platform: ${{ matrix.platform }}
image: ghcr.io/nvidia/nemoclaw/pi-sandbox
build-contexts: nemoclaw-pi-base=oci-layout://${{ steps.base.outputs.oci }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ env.SOURCE_REVISION }}
io.nvidia.nemoclaw.agent=pi
io.nvidia.nemoclaw.managed-image.contract=1
io.nvidia.nemoclaw.managed-image.platform=${{ matrix.platform }}
io.nvidia.nemoclaw.managed-image.startup-profile=1
io.nvidia.nemoclaw.managed-image.capabilities=1
io.nvidia.nemoclaw.managed-image.cohort=ghrun-${{ github.run_id }}-${{ github.run_attempt }}
build-args: |
BASE_IMAGE=nemoclaw-pi-base
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox
provenance: false
sbom: false
- name: Remove Pi publication credentials
if: always()
shell: bash
run: docker logout ghcr.io
# The publication above rebuilds the image rather than reusing the
# already-validated local one, so revalidate the exact published digest
# before the contract records it as the qualified candidate.
- name: Validate the published Pi candidate digest
shell: bash
env:
REFERENCE: ${{ steps.publish.outputs.reference }}
run: |
set -euo pipefail
image_json="$(docker image inspect "$REFERENCE")"
if ! jq -e \
--arg platform "$PLATFORM" \
'
length == 1 and (
.[0].Config.Labels["io.nvidia.nemoclaw.agent"] == "pi" and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.platform"] == $platform and
.[0].Config.Labels["io.nvidia.nemoclaw.managed-image.startup-profile"] == "1" and
.[0].Config.Entrypoint == ["/usr/local/bin/nemoclaw-start"]
)
' <<< "$image_json" >/dev/null
then
echo "ERROR: the published Pi candidate digest does not carry the managed-image runtime contract." >&2
exit 1
fi
version="$(docker run --rm --entrypoint /usr/local/bin/pi "$REFERENCE" --version)"
expected_version="$(node -p 'require("./agents/pi/pi-runtime/package.json").dependencies["@earendil-works/pi-coding-agent"]')"
grep -Fq "$expected_version" <<< "$version"
docker run --rm --entrypoint /bin/bash "$REFERENCE" -c '
set -eu
test "$(stat -c %a /sandbox/.pi/agent/models.json)" = 600
test "$(stat -c %U /sandbox/.pi/agent/models.json)" = sandbox
node -e "const c=require(\"/sandbox/.pi/agent/models.json\"); if (!c.defaultModel || !c.providers.openshell.baseUrl) process.exit(1)"
runtime=/usr/local/lib/nemoclaw/managed-startup-image-runtime.cjs
test -f "$runtime"
test ! -L "$runtime"
test "$(stat -c "%u:%g:%a" "$runtime")" = 0:0:444
test -x /usr/local/bin/nemoclaw-managed-startup-hold
test ! -e /usr/local/bin/nemoclaw-managed-bootstrap
test ! -e /usr/local/lib/nemoclaw/managed-bootstrap-trampoline.sh
'
# The checks above bypass /usr/local/bin/nemoclaw-start with a direct
# --entrypoint override, so they never prove the entrypoint itself runs
# correctly. Start the published digest through its declared entrypoint
# with no command, matching a real launch,
# and prove PID 1 drops to the sandbox user, hardens its resource limits,
# and persists the trusted proxy environment before it holds the sandbox
# open.
- name: Exercise the Pi candidate through its declared entrypoint
shell: bash
env:
DIGEST: ${{ steps.publish.outputs.digest }}
run: |
set -euo pipefail
if [[ ! "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: the Pi candidate publication did not return an immutable digest." >&2
exit 1
fi
reference="${REPOSITORY}@${DIGEST}"
corporate_ca_dir="$(mktemp -d "$RUNNER_TEMP/pi-candidate-ca.XXXXXX")"
corporate_ca="$corporate_ca_dir/corporate-ca.pem"
openssl req -x509 -newkey rsa:2048 -nodes -days 1 \
-subj '/CN=NemoClaw Pi candidate CA handoff' \
-addext 'basicConstraints=critical,CA:TRUE' \
-keyout "$corporate_ca_dir/corporate-ca.key" \
-out "$corporate_ca" >/dev/null 2>&1
chmod 0444 "$corporate_ca"
entrypoint_container="$(
docker run -d \
--network none \
--env SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
--mount "type=bind,src=$corporate_ca,dst=/usr/local/share/nemoclaw/corporate-ca.pem,readonly" \
"$reference"
)"
cleanup_entrypoint_container() {
docker rm -f "$entrypoint_container" >/dev/null 2>&1 || true
rm -r -- "$corporate_ca_dir"
}
trap cleanup_entrypoint_container EXIT
entrypoint_deadline=$(($(date +%s) + 30))
while ! docker logs "$entrypoint_container" 2>&1 | grep -q 'Setting up NemoClaw Pi runtime'; do
if [ "$(docker inspect --format '{{.State.Running}}' "$entrypoint_container" 2>/dev/null)" != "true" ]; then
echo "ERROR: the Pi candidate entrypoint exited before reaching its held state." >&2
docker logs "$entrypoint_container" >&2 || true
exit 1
fi
if [ "$(date +%s)" -ge "$entrypoint_deadline" ]; then
echo "ERROR: the Pi candidate entrypoint did not reach its held state in time." >&2
docker logs "$entrypoint_container" >&2 || true
exit 1
fi
sleep 1
done
pid1_status="$(docker exec "$entrypoint_container" cat /proc/1/status)"
pid1_uid="$(printf '%s\n' "$pid1_status" | awk '/^Uid:/ {print $2}')"
if [ "$pid1_uid" != "999" ]; then
echo "ERROR: the Pi candidate entrypoint did not drop PID 1 to the sandbox uid: $pid1_uid" >&2
exit 1
fi
pid1_limits="$(docker exec "$entrypoint_container" cat /proc/1/limits)"
if ! grep -qE '^Max processes +512 +512 ' <<< "$pid1_limits"; then
echo "ERROR: the Pi candidate entrypoint did not harden PID 1 nproc to exactly 512." >&2
exit 1
fi
if ! grep -qE '^Max open files +65536 +65536 ' <<< "$pid1_limits"; then
echo "ERROR: the Pi candidate entrypoint did not harden PID 1 nofile to exactly 65536." >&2
exit 1
fi
runtime_env="$(docker exec "$entrypoint_container" cat /tmp/nemoclaw-proxy-env.sh)"
merged_ca=/tmp/nemoclaw-ca-bundle.pem
merged_ca_status="$(docker exec "$entrypoint_container" stat -c '%u:%g:%a' "$merged_ca")"
if [ "$merged_ca_status" != "999:999:444" ]; then
echo "ERROR: the Pi candidate merged CA bundle is not protected: $merged_ca_status" >&2
exit 1
fi
for ca_variable in \
SSL_CERT_FILE \
CURL_CA_BUNDLE \
REQUESTS_CA_BUNDLE \
GIT_SSL_CAINFO \
NODE_EXTRA_CA_CERTS
do
expected_export="export ${ca_variable}=${merged_ca}"
if ! grep -qF "$expected_export" <<< "$runtime_env"; then
echo "ERROR: the Pi candidate entrypoint did not persist the merged CA variable ($expected_export)." >&2
exit 1
fi
done
docker exec --user 999:999 "$entrypoint_container" node -e '
const fs = require("node:fs");
const { X509Certificate } = require("node:crypto");
const mounted = new X509Certificate(
fs.readFileSync("/usr/local/share/nemoclaw/corporate-ca.pem"),
);
const bundle = fs.readFileSync(process.argv[1], "utf8");
const blocks = bundle.match(
/-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g,
);
if (!blocks?.some((block) =>
new X509Certificate(block).fingerprint256 === mounted.fingerprint256
)) process.exit(1);
' "$merged_ca"
docker exec --user 999:999 "$entrypoint_container" /bin/bash -ceu '
unset HTTP_PROXY HTTPS_PROXY NO_PROXY http_proxy https_proxy no_proxy
unset SSL_CERT_FILE CURL_CA_BUNDLE REQUESTS_CA_BUNDLE GIT_SSL_CAINFO NODE_EXTRA_CA_CERTS
source /tmp/nemoclaw-proxy-env.sh
proxy_url=http://10.200.0.1:3128
for proxy_variable in HTTP_PROXY HTTPS_PROXY http_proxy https_proxy; do
if [ "${!proxy_variable}" != "$proxy_url" ]; then
echo "ERROR: an independent Pi shell did not load $proxy_variable from the runtime environment." >&2
exit 1
fi
done
no_proxy_value=localhost,127.0.0.1,::1,10.200.0.1
for no_proxy_variable in NO_PROXY no_proxy; do
if [ "${!no_proxy_variable}" != "$no_proxy_value" ]; then
echo "ERROR: an independent Pi shell did not load $no_proxy_variable from the runtime environment." >&2
exit 1
fi
done
merged_ca=/tmp/nemoclaw-ca-bundle.pem
for ca_variable in \
SSL_CERT_FILE \
CURL_CA_BUNDLE \
REQUESTS_CA_BUNDLE \
GIT_SSL_CAINFO \
NODE_EXTRA_CA_CERTS
do
if [ "${!ca_variable}" != "$merged_ca" ]; then
echo "ERROR: an independent Pi shell did not load $ca_variable from the runtime environment." >&2
exit 1
fi
done
'
- name: Record the exact Pi candidate contract
shell: bash
env:
DIGEST: ${{ steps.publish.outputs.digest }}
run: |
set -euo pipefail
if [[ ! "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then
echo "ERROR: the Pi candidate publication did not return an immutable digest." >&2
exit 1
fi
release="$RELEASE"
contract_dir="$RUNNER_TEMP/managed-candidate-contract"
mkdir -p "$contract_dir"
jq -n \
--arg cohort "$PUBLICATION_COHORT" \
--arg digest "$DIGEST" \
--arg image "$REPOSITORY" \
--arg platform "$PLATFORM" \
--arg release "$release" \
--arg revision "$SOURCE_REVISION" \
--arg reference "${REPOSITORY}@${DIGEST}" \
'{
contractVersion: 1,
agent: "pi",
platform: $platform,
image: $image,
digest: $digest,
reference: $reference,
source: {
repository: "NVIDIA/NemoClaw",
revision: $revision,
release: $release,
cohort: $cohort
},
startupProfileContractVersion: 1,
capabilityContractVersion: 1
}' > "$contract_dir/contract.json"
node tools/managed-images/validate-candidate-contract.mts \
--contract "$contract_dir/contract.json" \
--platform "$PLATFORM"
# The all-agent activation job downloads managed-pr-contract-* artifacts.
# This candidate name is deliberately outside that pattern so a published
# Pi digest cannot enter the atomic release cohort.
- name: Upload the exact Pi candidate contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-candidate-contract-${{ github.run_id }}-${{ github.run_attempt }}-pi-${{ matrix.arch }}
path: ${{ runner.temp }}/managed-candidate-contract/contract.json
if-no-files-found: error
retention-days: 7
pi-candidate-publish:
needs: [publication-identity]
name: Publish and validate the Pi candidate managed image (${{ matrix.arch }})
if: github.repository == 'NVIDIA/NemoClaw' && github.event_name != 'pull_request'
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
permissions:
contents: read
packages: write
strategy: *pi_candidate_strategy
env: *pi_candidate_env
steps: *pi_candidate_steps
publication-identity:
name: Record managed image publication identity
# Failed-job reruns retain the original cohort and release outputs, even if
# another tag arrives before a producer or activation job is retried.
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
env:
CANDIDATE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
outputs:
cohort: ${{ steps.identity.outputs.cohort }}
release: ${{ steps.release.outputs.value }}
steps:
- name: Checkout publication revision
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Resolve managed image release identity
id: release
shell: bash
run: |
set -euo pipefail
[[ "$(git rev-parse --verify HEAD)" == "$CANDIDATE_SHA" ]]
release="$(git describe --tags --match 'v*' "$CANDIDATE_SHA")"
if [[ ! "$release" =~ ^v[0-9]+([.][0-9]+){1,3}([-.][0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
echo "ERROR: managed image release identity is invalid." >&2
exit 1
fi
if [[ "$GITHUB_REF" == refs/tags/* && "$release" != "${GITHUB_REF#refs/tags/}" ]]; then
echo "ERROR: managed image release identity does not match the release tag." >&2
exit 1
fi
printf 'value=%s\n' "$release" >> "$GITHUB_OUTPUT"
- name: Record publication identity
id: identity
shell: bash
run: |
set -euo pipefail
[[ "$GITHUB_RUN_ID" =~ ^[1-9][0-9]{0,19}$ ]]
[[ "$GITHUB_RUN_ATTEMPT" =~ ^[1-9][0-9]{0,9}$ ]]
# Failed-job reruns retain this successful job's original output,
# while rerun-all executes it again and must mint fresh immutable aliases.
printf 'cohort=ghrun-%s-%s\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" >> "$GITHUB_OUTPUT"
reviewed-npm-audit:
name: npm audit for managed image publication
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Audit reviewed production npm graphs
uses: ./.github/actions/ci-reviewed-npm-audit
with:
target-root: ${{ github.workspace }}
report-dir: artifacts/reviewed-npm-audit
cache-directory: ${{ runner.temp }}/reviewed-npm-audit-cache
trusted-cache-write: true
build-and-validate:
name: Build and validate ${{ matrix.display_name }} managed image (${{ matrix.arch }})
if: github.event_name != 'pull_request'
needs:
- publication-identity
- reviewed-npm-audit
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- agent: openclaw
arch: amd64
display_name: OpenClaw
dockerfile: Dockerfile
base_image: nvidia/nemoclaw/sandbox-base
image: nvidia/nemoclaw/openclaw-sandbox
platform: linux/amd64
artifact_platform: linux-amd64
required_binary: /usr/local/bin/openclaw
runner: ubuntu-24.04
- agent: openclaw
arch: arm64
display_name: OpenClaw
dockerfile: Dockerfile
base_image: nvidia/nemoclaw/sandbox-base
image: nvidia/nemoclaw/openclaw-sandbox
platform: linux/arm64
artifact_platform: linux-arm64
required_binary: /usr/local/bin/openclaw
runner: ubuntu-24.04-arm
- agent: hermes
arch: amd64
display_name: Hermes
dockerfile: agents/hermes/Dockerfile
base_image: nvidia/nemoclaw/hermes-sandbox-base
image: nvidia/nemoclaw/hermes-sandbox
platform: linux/amd64
artifact_platform: linux-amd64
required_binary: /usr/local/bin/hermes
runner: ubuntu-24.04
- agent: hermes
arch: arm64
display_name: Hermes
dockerfile: agents/hermes/Dockerfile
base_image: nvidia/nemoclaw/hermes-sandbox-base
image: nvidia/nemoclaw/hermes-sandbox
platform: linux/arm64
artifact_platform: linux-arm64
required_binary: /usr/local/bin/hermes
runner: ubuntu-24.04-arm
- agent: langchain-deepagents-code
arch: amd64
display_name: Deep Agents Code
dockerfile: agents/langchain-deepagents-code/Dockerfile
base_image: nvidia/nemoclaw/langchain-deepagents-code-sandbox-base
image: nvidia/nemoclaw/langchain-deepagents-code-sandbox
platform: linux/amd64
artifact_platform: linux-amd64
required_binary: /usr/local/bin/dcode
runner: ubuntu-24.04
- agent: langchain-deepagents-code
arch: arm64
display_name: Deep Agents Code
dockerfile: agents/langchain-deepagents-code/Dockerfile
base_image: nvidia/nemoclaw/langchain-deepagents-code-sandbox-base
image: nvidia/nemoclaw/langchain-deepagents-code-sandbox
platform: linux/arm64
artifact_platform: linux-arm64
required_binary: /usr/local/bin/dcode
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
- name: Install reviewed npm
uses: ./.github/actions/setup-reviewed-npm
- name: Resolve managed image release identity
id: release
shell: bash
env:
RELEASE: ${{ needs.publication-identity.outputs.release }}
run: |
set -euo pipefail
release="$RELEASE"
if [[ ! "$release" =~ ^v[0-9]+([.][0-9]+){1,3}([-.][0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
echo "ERROR: managed image release identity is invalid: $release" >&2
exit 1
fi
if [[ "$GITHUB_REF" == refs/tags/* && "$release" != "${GITHUB_REF#refs/tags/}" ]]; then
echo "ERROR: managed image release identity does not match the release tag." >&2
exit 1
fi
printf 'value=%s\n' "$release" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Download same-run npm audit evidence
if: matrix.agent == 'openclaw'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: reviewed-npm-audit
path: ${{ runner.temp }}/reviewed-npm-audit
- name: Prepare same-run mcporter audit evidence
if: matrix.agent == 'openclaw'
id: mcporter-audit
shell: bash
run: |
set -euo pipefail
receipt="$RUNNER_TEMP/reviewed-npm-audit/mcporter-runtime.receipt.json"
raw="$RUNNER_TEMP/reviewed-npm-audit/mcporter-runtime.raw.json"
policy="$RUNNER_TEMP/reviewed-npm-audit/mcporter-runtime.policy.json"
test -f "$receipt"; test -f "$raw"; test -s "$policy"; test ! -L "$policy"
printf 'receipt=%s\nraw=%s\npolicy=%s\nreceipt_sha256=%s\npolicy_sha256=%s\n' "$receipt" "$raw" "$policy" "$(sha256sum "$receipt" | cut -d' ' -f1)" "$(sha256sum "$policy" | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Restore exact base image contract
shell: bash
env:
AGENT: ${{ matrix.agent }}
DCODE_CONTRACT_BASE64: ${{ inputs.dcode-base-contract-base64 }}
HERMES_CONTRACT_BASE64: ${{ inputs.hermes-base-contract-base64 }}
OPENCLAW_CONTRACT_BASE64: ${{ inputs.openclaw-base-contract-base64 }}
run: |
set -euo pipefail
case "$AGENT" in
openclaw) contract_base64="$OPENCLAW_CONTRACT_BASE64" ;;
hermes) contract_base64="$HERMES_CONTRACT_BASE64" ;;
langchain-deepagents-code) contract_base64="$DCODE_CONTRACT_BASE64" ;;
*) echo "ERROR: unsupported managed agent: $AGENT" >&2; exit 1 ;;
esac
if [ -z "$contract_base64" ] || [ "${#contract_base64}" -gt 131072 ]; then
echo "ERROR: exact base image producer output is missing or oversized." >&2
exit 1
fi
if [[ ! "$contract_base64" =~ ^[A-Za-z0-9+/]+={0,2}$ ]] ||
[ $(( ${#contract_base64} % 4 )) -ne 0 ]; then
echo "ERROR: exact base image producer output is not canonical base64." >&2
exit 1
fi
contract_root="$RUNNER_TEMP/managed-base-contract"
install -d -m 0700 "$contract_root"
if ! printf '%s' "$contract_base64" |
base64 --decode > "$contract_root/contract.json" 2>/dev/null ||
[ "$(base64 < "$contract_root/contract.json" | tr -d '\n')" != "$contract_base64" ]; then
rm -f "$contract_root/contract.json"
echo "ERROR: exact base image producer output is not canonical base64." >&2
exit 1
fi
- name: Validate exact base image contract
id: base
shell: bash
env:
AGENT: ${{ matrix.agent }}
BASE_IMAGE: ${{ env.REGISTRY }}/${{ matrix.base_image }}
CONTRACT: ${{ runner.temp }}/managed-base-contract/contract.json
PLATFORM: ${{ matrix.platform }}
run: |
set -euo pipefail
if [ ! -f "$CONTRACT" ] || [ -L "$CONTRACT" ]; then
echo "ERROR: exact base image contract is missing or is a symlink." >&2
exit 1
fi
if ! jq -e \
--arg agent "$AGENT" \
--arg image "$BASE_IMAGE" \
--arg platform "$PLATFORM" \
--arg revision "$GITHUB_SHA" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
'
(keys | sort) == [
"agent",
"contractVersion",
"digest",
"image",
"platformDigests",
"platformReferences",
"platforms",
"reference",
"run",
"sourceRevision"
]
and .contractVersion == 1
and .agent == $agent
and .image == $image
and (.digest | test("^sha256:[0-9a-f]{64}$"))
and .reference == (.image + "@" + .digest)
and .platforms == ["linux/amd64", "linux/arm64"]
and (.platformDigests | keys | sort) == .platforms
and (.platformReferences | keys | sort) == .platforms
and (.platformDigests[$platform] | test("^sha256:[0-9a-f]{64}$"))
and .platformReferences[$platform] ==
(.image + "@" + .platformDigests[$platform])
and .sourceRevision == $revision
and .run.id == $runId
and (.run.attempt | type) == "number"
and .run.attempt >= 1
and .run.attempt <= $runAttempt
' "$CONTRACT" >/dev/null
then
echo "ERROR: exact base image contract failed closed validation." >&2
exit 1
fi
platform_reference="$(
jq -er --arg platform "$PLATFORM" '.platformReferences[$platform]' "$CONTRACT"
)"
docker buildx imagetools inspect "$platform_reference" >/dev/null
printf 'ref=%s\n' "$platform_reference" >> "$GITHUB_OUTPUT"
if [ "$AGENT" = "langchain-deepagents-code" ]; then
digest="$(jq -er --arg platform "$PLATFORM" '.platformDigests[$platform]' "$CONTRACT")"
source_revision="$(jq -er '.sourceRevision' "$CONTRACT")"
docker pull --platform "$PLATFORM" "$platform_reference" >/dev/null
image_json="$(docker image inspect "$platform_reference")"
image_id="$(jq -er 'if length == 1 then .[0].Id else error("not one image") end' <<< "$image_json")"
os="$(jq -er '.[0].Os' <<< "$image_json")"
architecture="$(jq -er '.[0].Architecture' <<< "$image_json")"
image_revision="$(jq -er '.[0].Config.Labels["org.opencontainers.image.revision"]' <<< "$image_json")"
if [[ ! "$image_id" =~ ^sha256:[0-9a-f]{64}$ ]] ||
[ "${os}/${architecture}" != "$PLATFORM" ] ||
[ "$image_revision" != "$source_revision" ]; then
echo "ERROR: DCode base image does not match its immutable contract." >&2
exit 1
fi
glibc_output="$(docker run --rm --platform "$PLATFORM" --entrypoint getconf "$platform_reference" GNU_LIBC_VERSION)"
[[ "$glibc_output" =~ ^glibc\ ([0-9]+[.][0-9]+)$ ]] || {
echo "ERROR: DCode base image returned malformed glibc metadata." >&2
exit 1
}
glibc="${BASH_REMATCH[1]}"
[ "$(printf '%s\n' 2.39 "$glibc" | sort -V | head -n 1)" = "2.39" ] || {
echo "ERROR: DCode base image is below glibc 2.39." >&2
exit 1
}
metadata="$(jq -cn \
--arg architecture "$architecture" --arg digest "$digest" \
--arg glibc "$glibc" --arg image "$BASE_IMAGE" --arg imageId "$image_id" \
--arg os "$os" --arg ref "$platform_reference" --arg revision "$source_revision" \
'{schema:1,key:"",imageName:$image,ref:$ref,digest:$digest,source:"override",sourceRevision:$revision,imageId:$imageId,os:$os,architecture:$architecture,glibcVersion:$glibc,requireOpenshellSandboxAbi:true,minGlibcVersion:"2.39"}')"
key="$(printf '%s' "$metadata" | sha256sum | awk '{print $1}')"
metadata="$(jq -c --arg key "$key" '.key = $key' <<< "$metadata")"
printf 'resolution_key=%s\n' "$key" >> "$GITHUB_OUTPUT"
printf 'resolution_label=%s\n' "$(printf '%s' "$metadata" | base64 -w0 | tr '+/' '-_' | tr -d '=')" >> "$GITHUB_OUTPUT"
fi
- name: Log in to GHCR
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Validate production build args
env:
BASE_IMAGE: ${{ steps.base.outputs.ref }}
DOCKERFILE: ${{ matrix.dockerfile }}
run: |
set -euo pipefail
target_arch='${{ matrix.arch }}'
case "$target_arch" in amd64|arm64) ;; *) exit 1 ;; esac
build_args=(
-f "$DOCKERFILE"
--build-arg "BASE_IMAGE=${BASE_IMAGE}"
--build-arg "TARGETARCH=${target_arch}"
--build-arg "NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1"
--build-arg "NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox"
)
scripts/check-production-build-args.sh "${build_args[@]}"
# Push only the canonical digest. Consumer aliases do not exist until the
# exact image has passed anonymous-pull and runtime-contract validation.
- name: Publish and validate managed image by digest
id: build
uses: ./.github/actions/publish-managed-image-digest
with:
file: ${{ matrix.dockerfile }}
platform: ${{ matrix.platform }}
image: ${{ env.REGISTRY }}/${{ matrix.image }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.release.outputs.value }}
io.nvidia.nemoclaw.agent=${{ matrix.agent }}
io.nvidia.nemoclaw.managed-image.contract=1
io.nvidia.nemoclaw.managed-image.platform=${{ matrix.platform }}
io.nvidia.nemoclaw.managed-image.startup-profile=1
io.nvidia.nemoclaw.managed-image.capabilities=1
io.nvidia.nemoclaw.managed-image.cohort=${{ needs.publication-identity.outputs.cohort }}
${{ matrix.agent == 'langchain-deepagents-code' && format('com.nvidia.nemoclaw.base-resolution-key={0}', steps.base.outputs.resolution_key) || '' }}
${{ matrix.agent == 'langchain-deepagents-code' && format('com.nvidia.nemoclaw.base-resolution={0}', steps.base.outputs.resolution_label) || '' }}
build-args: |
BASE_IMAGE=${{ steps.base.outputs.ref }}
TARGETARCH=${{ matrix.arch }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=sandbox
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256={0}', steps.mcporter-audit.outputs.receipt_sha256) || '' }}
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_POLICY_RESULT_SHA256={0}', steps.mcporter-audit.outputs.policy_sha256) || '' }}
secret-files: |
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-receipt={0}', steps.mcporter-audit.outputs.receipt) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-raw-report={0}', steps.mcporter-audit.outputs.raw) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-policy-result={0}', steps.mcporter-audit.outputs.policy) || '' }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ matrix.image }}:buildcache-${{ matrix.artifact_platform }}
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ matrix.image }}:buildcache-${{ matrix.artifact_platform }},mode=max
provenance: mode=max
sbom: true
- name: Install managed-image publication harness dependencies
shell: bash
env:
AGENT: ${{ matrix.agent }}
run: |
set -euo pipefail
if [ "$AGENT" = "hermes" ]; then
node scripts/lib/openshell-sdk-install.mts prepare
fi
npm ci --ignore-scripts --no-audit --no-fund --@nvidia:registry=https://npm.pkg.github.com
if [ "$AGENT" = "hermes" ]; then
node scripts/lib/openshell-sdk-install.mts check
fi
npm run build:policy-boundary
- name: Build CLI for Hermes runtime contract
if: matrix.agent == 'hermes'
run: npm run build:cli
- name: Validate exact managed image before promotion
id: validate
shell: bash
env:
AGENT: ${{ matrix.agent }}
DIGEST: ${{ steps.build.outputs.digest }}
IMAGE: ${{ env.REGISTRY }}/${{ matrix.image }}
PLATFORM: ${{ matrix.platform }}
PUBLICATION_COHORT: ${{ needs.publication-identity.outputs.cohort }}
RELEASE: ${{ steps.release.outputs.value }}
REQUIRED_BINARY: ${{ matrix.required_binary }}
RESOLUTION_KEY: ${{ steps.base.outputs.resolution_key }}
RESOLUTION_LABEL: ${{ steps.base.outputs.resolution_label }}
REFERENCE: ${{ steps.build.outputs.reference }}
ANONYMOUS_CONFIG: ${{ steps.build.outputs.docker-config }}
IMAGE_ID: ${{ steps.build.outputs.local-id }}
run: |
set -euo pipefail
reference="$REFERENCE"
anonymous_config="$ANONYMOUS_CONFIG"
image_id="$IMAGE_ID"
image_user="$(docker image inspect --format '{{.Config.User}}' "$reference")"
if [ "$image_user" != "sandbox" ]; then
echo "ERROR: managed image OCI user must be sandbox for OpenShell 0.0.116: $image_user" >&2
exit 1
fi
if [ "$AGENT" = "langchain-deepagents-code" ] &&
{ [ "$(docker image inspect --format '{{index .Config.Labels "com.nvidia.nemoclaw.base-resolution-key"}}' "$reference")" != "$RESOLUTION_KEY" ] ||
[ "$(docker image inspect --format '{{index .Config.Labels "com.nvidia.nemoclaw.base-resolution"}}' "$reference")" != "$RESOLUTION_LABEL" ]; }; then
echo "ERROR: Deep Agents Code image lost base resolution metadata." >&2
exit 1
fi
agent_label="$(
docker image inspect \
--format '{{index .Config.Labels "io.nvidia.nemoclaw.agent"}}' \
"$reference"
)"
contract_label="$(
docker image inspect \
--format '{{index .Config.Labels "io.nvidia.nemoclaw.managed-image.contract"}}' \
"$reference"
)"
startup_profile_label="$(
docker image inspect \
--format '{{index .Config.Labels "io.nvidia.nemoclaw.managed-image.startup-profile"}}' \
"$reference"
)"
capabilities_label="$(
docker image inspect \
--format '{{index .Config.Labels "io.nvidia.nemoclaw.managed-image.capabilities"}}' \
"$reference"
)"
platform_label="$(
docker image inspect \
--format '{{index .Config.Labels "io.nvidia.nemoclaw.managed-image.platform"}}' \
"$reference"
)"
cohort_label="$(
docker image inspect \
--format '{{index .Config.Labels "io.nvidia.nemoclaw.managed-image.cohort"}}' \
"$reference"
)"
revision_label="$(
docker image inspect \
--format '{{index .Config.Labels "org.opencontainers.image.revision"}}' \
"$reference"
)"
release_label="$(
docker image inspect \
--format '{{index .Config.Labels "org.opencontainers.image.version"}}' \
"$reference"
)"
cohort_prefix="ghrun-${GITHUB_RUN_ID}-"
cohort_attempt="${PUBLICATION_COHORT#"$cohort_prefix"}"
if [[ ! "$GITHUB_RUN_ID" =~ ^[1-9][0-9]{0,19}$ ]] ||
[[ ! "$GITHUB_RUN_ATTEMPT" =~ ^[1-9][0-9]{0,9}$ ]] ||
[[ "$PUBLICATION_COHORT" != "${cohort_prefix}"* ]] ||
[[ ! "$cohort_attempt" =~ ^[1-9][0-9]{0,9}$ ]] ||
[ "$cohort_attempt" -gt "$GITHUB_RUN_ATTEMPT" ] ||
[ "$agent_label" != "$AGENT" ] ||
[ "$contract_label" != "1" ] ||
[ "$startup_profile_label" != "1" ] ||
[ "$capabilities_label" != "1" ] ||
[ "$platform_label" != "$PLATFORM" ] ||
[ "$cohort_label" != "$PUBLICATION_COHORT" ] ||
[ "$revision_label" != "$GITHUB_SHA" ] ||
[ "$release_label" != "$RELEASE" ]; then
echo "ERROR: managed image contract labels do not match the build identity." >&2
exit 1
fi
DOCKER_CONFIG="$anonymous_config" docker run --rm -i \
--platform "$PLATFORM" \
--network none \
--env "AGENT=$AGENT" \
--env "REQUIRED_BINARY=$REQUIRED_BINARY" \
--entrypoint /bin/sh \
"$reference" -eu -s <<'VALIDATE_FILESYSTEM'
test -x /usr/local/bin/nemoclaw-start
test -f /usr/local/lib/nemoclaw/managed-startup-image-runtime.cjs
test ! -L /usr/local/lib/nemoclaw/managed-startup-image-runtime.cjs
test "$(stat -c '%u:%g:%a' /usr/local/lib/nemoclaw/managed-startup-image-runtime.cjs)" = "0:0:444"
test -x "$REQUIRED_BINARY"
test -r /opt/nemoclaw-blueprint/blueprint.yaml
test ! -e /usr/local/share/nemoclaw/corporate-ca.pem
test ! -L /usr/local/share/nemoclaw/corporate-ca.pem
test "$NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION" = "1"
case "$AGENT" in
openclaw)
node <<'VALIDATE_OPENCLAW_UNION'
const fs = require("node:fs");
const path = require("node:path");
const config = JSON.parse(
fs.readFileSync("/sandbox/.openclaw/openclaw.json", "utf8"),
);
const packages = {
"diagnostics-otel": ["@openclaw/diagnostics-otel", "2026.9.2"],
brave: ["@openclaw/brave-plugin", "2026.9.2"],
tavily: ["@openclaw/tavily-plugin", "2026.9.2"],
discord: ["@openclaw/discord", "2026.9.2"],
"openclaw-weixin": ["@tencent-weixin/openclaw-weixin", "2.4.9"],
slack: ["@openclaw/slack", "2026.9.2"],
whatsapp: ["@openclaw/whatsapp", "2026.9.2"],
msteams: ["@openclaw/msteams", "2026.9.2"],
googlechat: ["@openclaw/googlechat", "2026.9.2"],
};
const projectsRoot = "/sandbox/.openclaw/npm/projects";
const projectRoots = fs
.readdirSync(projectsRoot, { withFileTypes: true })
.filter((entry) => entry.isDirectory())
.map((entry) => path.join(projectsRoot, entry.name));
for (const [id, [name, version]] of Object.entries(packages)) {
const matches = projectRoots.flatMap((projectRoot) => {
const nodeModulesRoot = path.join(projectRoot, "node_modules");
const packageRoot = path.join(nodeModulesRoot, ...name.split("/"));
const manifestPath = path.join(packageRoot, "package.json");
if (
!fs.existsSync(nodeModulesRoot) ||
!fs.existsSync(packageRoot) ||
!fs.lstatSync(packageRoot).isDirectory() ||
!fs.existsSync(manifestPath) ||
!fs.lstatSync(manifestPath).isFile()
) return [];
const packageRelative = path.relative(
fs.realpathSync(nodeModulesRoot),
fs.realpathSync(packageRoot),
);
if (
packageRelative === "" ||
packageRelative === ".." ||
packageRelative.startsWith(`..${path.sep}`) ||
path.isAbsolute(packageRelative)
) return [];
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
return manifest.name === name && manifest.version === version ? [manifestPath] : [];
});
if (matches.length !== 1 || config.plugins?.entries?.[id]?.enabled !== false) {
throw new Error(`managed OpenClaw plugin ${id} is missing, duplicated, or active`);
}
}
if (config.plugins?.entries?.telegram?.enabled !== false) {
throw new Error("bundled OpenClaw plugin telegram is not explicitly disabled");
}
for (const id of [
"telegram",
"discord",
"openclaw-weixin",
"slack",
"whatsapp",
"msteams",
"googlechat",
]) {
if (config.channels?.[id]?.enabled !== false) {
throw new Error(`managed OpenClaw channel ${id} is not explicitly disabled`);
}
}
if (config.tools?.web?.search?.enabled !== false) {
throw new Error("managed OpenClaw web search is not explicitly disabled");
}
VALIDATE_OPENCLAW_UNION
;;
hermes)
/opt/hermes/.venv/bin/python -I <<'VALIDATE_HERMES_UNION'
import importlib.metadata as metadata
from pathlib import Path
import yaml
config = yaml.safe_load(Path("/sandbox/.hermes/config.yaml").read_text())
optional = ("telegram", "discord", "weixin", "slack", "whatsapp", "teams")
if any(config["platforms"].get(name) != {"enabled": False} for name in optional):
raise SystemExit("managed Hermes optional platform is not explicitly disabled")
if metadata.version("microsoft-teams-apps") != "2.0.13.4":
raise SystemExit("managed Hermes microsoft-teams-apps version is wrong")
if metadata.version("aiohttp") != "3.14.3":
raise SystemExit("managed Hermes aiohttp version is wrong")
if metadata.version("agent-client-protocol") != "0.9.0":
raise SystemExit("managed Hermes agent-client-protocol version is wrong")
VALIDATE_HERMES_UNION
/usr/local/bin/hermes acp --check
;;
langchain-deepagents-code) ;;
*) echo "ERROR: unsupported managed agent $AGENT" >&2; exit 1 ;;
esac
VALIDATE_FILESYSTEM
if [ "$AGENT" = "langchain-deepagents-code" ]; then
DOCKER_CONFIG="$anonymous_config" \
node --no-warnings scripts/checks/validate-dcode-runtime-contract.mts \
--reference "$reference" \
--platform "$PLATFORM"
fi
version_output="$(
DOCKER_CONFIG="$anonymous_config" docker run --rm \
--platform "$PLATFORM" \
--network none \
--entrypoint "$REQUIRED_BINARY" \
"$reference" --version 2>&1
)"
if [ -z "$version_output" ]; then
echo "ERROR: required agent binary returned an empty version." >&2
exit 1
fi
DOCKER_CONFIG="$anonymous_config" \
npx --no-install tsx \
scripts/checks/run-managed-image-direct-e2e.ts \
--agent "$AGENT" \
--image "$reference" \
--platform "$PLATFORM"
printf 'local_id=%s\n' "$image_id" >> "$GITHUB_OUTPUT"
printf 'reference=%s\n' "$reference" >> "$GITHUB_OUTPUT"
- name: Verify native Hermes Discord status before publication
if: matrix.agent == 'hermes'
shell: bash
env:
IMAGE_REFERENCE: ${{ steps.validate.outputs.reference }}
PLATFORM: ${{ matrix.platform }}
DOCKER_CONFIG: ${{ steps.build.outputs.docker-config }}
run: |
set -euo pipefail
npx --no-install tsx scripts/checks/run-hermes-discord-runtime-contract.mts \
--image "$IMAGE_REFERENCE" --platform "$PLATFORM"
- name: Qualify Hermes root entrypoint and Switchyard package
if: matrix.agent == 'hermes'
timeout-minutes: 30
env:
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/hermes-root-entrypoint-smoke
NEMOCLAW_HERMES_TEST_IMAGE: ${{ steps.validate.outputs.local_id }}
NEMOCLAW_RUN_LIVE_E2E: "1"
run: |
npx --no-install vitest run --project e2e-live \
test/e2e/live/hermes-root-entrypoint-smoke.test.ts
- name: Upload Hermes package qualification artifacts
if: always() && matrix.agent == 'hermes'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: hermes-root-entrypoint-publication-${{ matrix.arch }}-${{ github.run_attempt }}
path: e2e-artifacts/live/hermes-root-entrypoint-smoke/
include-hidden-files: false
if-no-files-found: ignore
retention-days: 14
- name: Capture exact managed image publication evidence
id: evidence
shell: bash
env:
AGENT: ${{ matrix.agent }}
BASE_REFERENCE: ${{ steps.base.outputs.ref }}
COHORT: ${{ needs.publication-identity.outputs.cohort }}
DIGEST: ${{ steps.build.outputs.digest }}
PLATFORM: ${{ matrix.platform }}
REFERENCE: ${{ steps.validate.outputs.reference }}
run: |
set -euo pipefail
evidence_dir="$RUNNER_TEMP/managed-image-publication-evidence"
evidence="$evidence_dir/evidence.json"
scripts/checks/verify-managed-image-publication-evidence.sh \
--reference "$REFERENCE" \
--digest "$DIGEST" \
--platform "$PLATFORM" \
--agent "$AGENT" \
--base-reference "$BASE_REFERENCE" \
--repository "$GITHUB_REPOSITORY" \
--revision "$GITHUB_SHA" \
--cohort "$COHORT" \
--run-id "$GITHUB_RUN_ID" \
--run-attempt "$GITHUB_RUN_ATTEMPT" \
--output "$evidence"
printf 'path=%s\n' "$evidence" >> "$GITHUB_OUTPUT"
- name: Export validated managed image candidate
env:
AGENT: ${{ matrix.agent }}
BASE_REFERENCE: ${{ steps.base.outputs.ref }}
DIGEST: ${{ steps.build.outputs.digest }}
EVIDENCE: ${{ steps.evidence.outputs.path }}
IMAGE: ${{ env.REGISTRY }}/${{ matrix.image }}
PLATFORM: ${{ matrix.platform }}
PUBLICATION_COHORT: ${{ needs.publication-identity.outputs.cohort }}
REFERENCE: ${{ steps.validate.outputs.reference }}
run: |
set -euo pipefail
if [[ ! "$GITHUB_SHA" =~ ^[0-9a-f]{40}$ ]] ||
[[ ! "$PUBLICATION_COHORT" =~ ^ghrun-[1-9][0-9]{0,19}-[1-9][0-9]{0,9}$ ]]; then
echo "ERROR: managed image publication identity is invalid." >&2
exit 1
fi
release_tag=""
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
release_tag="${GITHUB_REF#refs/tags/}"
if [[ ! "$release_tag" =~ ^v[0-9]+([.][0-9]+){1,3}([-.][0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
echo "ERROR: release tag is not a supported version identity: $release_tag" >&2
exit 1
fi
elif [ "$GITHUB_REF" != "refs/heads/main" ]; then
echo "ERROR: managed images may only be published from main or a v* release tag." >&2
exit 1
fi
contract_dir="$RUNNER_TEMP/managed-image-candidate"
mkdir -p "$contract_dir"
if [ ! -f "$EVIDENCE" ] || [ -L "$EVIDENCE" ]; then
echo "ERROR: exact registry publication evidence is missing or unsafe." >&2
exit 1
fi
jq -n \
--arg agent "$AGENT" \
--arg baseReference "$BASE_REFERENCE" \
--arg digest "$DIGEST" \
--arg image "$IMAGE" \
--arg platform "$PLATFORM" \
--arg cohort "$PUBLICATION_COHORT" \
--arg reference "$REFERENCE" \
--arg ref "$GITHUB_REF" \
--arg release "$release_tag" \
--arg repository "$GITHUB_REPOSITORY" \
--arg revision "$GITHUB_SHA" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
--slurpfile publicationEvidence "$EVIDENCE" \
'{
contractVersion: 2,
phase: "candidate",
agent: $agent,
image: $image,
digest: $digest,
reference: $reference,
baseReference: $baseReference,
platform: $platform,
publicationEvidence: $publicationEvidence[0],
source: {
repository: $repository,
revision: $revision,
ref: $ref,
cohort: $cohort
},
run: {
id: $runId,
attempt: $runAttempt
},
release: (if $release == "" then null else $release end)
}' > "$contract_dir/contract.json"
jq -e \
--arg agent "$AGENT" \
--arg image "$IMAGE" \
--arg platform "$PLATFORM" \
--arg cohort "$PUBLICATION_COHORT" \
--arg ref "$GITHUB_REF" \
--arg release "$release_tag" \
--arg repository "$GITHUB_REPOSITORY" \
--arg revision "$GITHUB_SHA" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
'(keys | sort) == [
"agent",
"baseReference",
"contractVersion",
"digest",
"image",
"phase",
"platform",
"publicationEvidence",
"reference",
"release",
"run",
"source"
]
and .contractVersion == 2
and .phase == "candidate"
and .agent == $agent
and .image == $image
and .platform == $platform
and (.digest | test("^sha256:[0-9a-f]{64}$"))
and .reference == (.image + "@" + .digest)
and (.baseReference | test("@sha256:[0-9a-f]{64}$"))
and .publicationEvidence.candidateDescriptor.digest == .digest
and .publicationEvidence.workloadDescriptor.platform == (
$platform
| split("/")
| {os: .[0], architecture: .[1]}
)
and .publicationEvidence.attestations.manifestDescriptor.annotations[
"vnd.docker.reference.digest"
] == .publicationEvidence.workloadDescriptor.digest
and .publicationEvidence.attestations.slsa.descriptor.annotations[
"in-toto.io/predicate-type"
] == "https://slsa.dev/provenance/v1"
and .publicationEvidence.attestations.slsa.statement.subject.digest ==
.publicationEvidence.workloadDescriptor.digest
and .publicationEvidence.attestations.slsa.statement.bindings == {
agent: $agent,
baseReference: .baseReference,
cohort: $cohort,
platform: $platform,
revision: $revision,
source: ("https://github.com/" + $repository)
}
and .publicationEvidence.attestations.slsa.statement.builderId ==
("https://github.com/" + $repository + "/actions/runs/" +
($runId | tostring) + "/attempts/" + ($runAttempt | tostring))
and .publicationEvidence.attestations.spdx.descriptor.annotations[
"in-toto.io/predicate-type"
] == "https://spdx.dev/Document"
and .publicationEvidence.attestations.spdx.statement.subject.digest ==
.publicationEvidence.workloadDescriptor.digest
and .source == {
repository: $repository,
revision: $revision,
ref: $ref,
cohort: $cohort
}
and .run == {id: $runId, attempt: $runAttempt}
and .release == (if $release == "" then null else $release end)
and (has("aliases") | not)' \
"$contract_dir/contract.json" >/dev/null
- name: Upload validated managed image candidate
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
# A failed-job rerun keeps successful lanes and replaces only the
# stable artifact owned by each retried agent/platform lane.
name: managed-image-candidate-${{ github.run_id }}-${{ matrix.agent }}-${{ matrix.artifact_platform }}
path: ${{ runner.temp }}/managed-image-candidate/contract.json
if-no-files-found: error
overwrite: true
retention-days: 1
promote:
name: Promote complete multi-platform managed image cohort
needs:
- publication-identity
- build-and-validate
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Restore all validated managed image candidates
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: managed-image-candidate-${{ github.run_id }}-*
path: ${{ runner.temp }}/managed-image-candidates
# This is the all-agent/all-architecture publication barrier. It fails
# closed before registry authentication or any alias operation.
- name: Validate complete managed image candidate set
id: candidates
shell: bash
env:
CANDIDATE_ROOT: ${{ runner.temp }}/managed-image-candidates
PUBLICATION_COHORT: ${{ needs.publication-identity.outputs.cohort }}
run: |
set -euo pipefail
if [[ ! "$GITHUB_SHA" =~ ^[0-9a-f]{40}$ ]]; then
echo "ERROR: source revision must be a full 40-character SHA." >&2
exit 1
fi
expected_cohort="$PUBLICATION_COHORT"
expected_cohort_prefix="ghrun-${GITHUB_RUN_ID}-"
cohort_attempt="${expected_cohort#"$expected_cohort_prefix"}"
if [[ ! "$GITHUB_RUN_ID" =~ ^[1-9][0-9]{0,19}$ ]] ||
[[ ! "$GITHUB_RUN_ATTEMPT" =~ ^[1-9][0-9]{0,9}$ ]] ||
[[ "$expected_cohort" != "${expected_cohort_prefix}"* ]] ||
[[ ! "$cohort_attempt" =~ ^[1-9][0-9]{0,9}$ ]] ||
[ "$cohort_attempt" -gt "$GITHUB_RUN_ATTEMPT" ]; then
echo "ERROR: publication cohort is invalid: $expected_cohort" >&2
exit 1
fi
expected_release=""
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
expected_release="${GITHUB_REF#refs/tags/}"
if [[ ! "$expected_release" =~ ^v[0-9]+([.][0-9]+){1,3}([-.][0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
echo "ERROR: release tag is not a supported version identity: $expected_release" >&2
exit 1
fi
elif [ "$GITHUB_REF" != "refs/heads/main" ]; then
echo "ERROR: managed images may only be promoted from main or a v* release tag." >&2
exit 1
fi
expected_artifacts=(
"managed-image-candidate-${GITHUB_RUN_ID}-openclaw-linux-amd64"
"managed-image-candidate-${GITHUB_RUN_ID}-openclaw-linux-arm64"
"managed-image-candidate-${GITHUB_RUN_ID}-hermes-linux-amd64"
"managed-image-candidate-${GITHUB_RUN_ID}-hermes-linux-arm64"
"managed-image-candidate-${GITHUB_RUN_ID}-langchain-deepagents-code-linux-amd64"
"managed-image-candidate-${GITHUB_RUN_ID}-langchain-deepagents-code-linux-arm64"
)
expected_agents=(
openclaw
openclaw
hermes
hermes
langchain-deepagents-code
langchain-deepagents-code
)
expected_platforms=(
linux/amd64
linux/arm64
linux/amd64
linux/arm64
linux/amd64
linux/arm64
)
if [ ! -d "$CANDIDATE_ROOT" ] || [ -L "$CANDIDATE_ROOT" ]; then
echo "ERROR: managed image candidate root is missing or unsafe." >&2
exit 1
fi
actual_entry_count="$(
find "$CANDIDATE_ROOT" ! -path "$CANDIDATE_ROOT" -prune -print |
wc -l | tr -d '[:space:]'
)"
if [ "$actual_entry_count" != "${#expected_artifacts[@]}" ]; then
echo "ERROR: expected exactly six managed image candidate artifacts." >&2
exit 1
fi
candidate_files=()
expected_attempts=()
for index in "${!expected_artifacts[@]}"; do
artifact="${expected_artifacts[$index]}"
expected_agent="${expected_agents[$index]}"
expected_platform="${expected_platforms[$index]}"
artifact_dir="$CANDIDATE_ROOT/$artifact"
contract="$artifact_dir/contract.json"
if [ ! -d "$artifact_dir" ] || [ -L "$artifact_dir" ] ||
[ ! -f "$contract" ] || [ -L "$contract" ]; then
echo "ERROR: required managed image candidate is missing or unsafe: $artifact" >&2
exit 1
fi
artifact_entry_count="$(
find "$artifact_dir" ! -path "$artifact_dir" -prune -print |
wc -l | tr -d '[:space:]'
)"
expected_attempt="$(
jq -er '.run.attempt | select(type == "number" and . >= 1 and floor == .)' \
"$contract"
)" || {
echo "ERROR: managed image candidate producer attempt is invalid: $artifact" >&2
exit 1
}
if [ "$expected_attempt" -gt "$GITHUB_RUN_ATTEMPT" ]; then
echo "ERROR: managed image candidate producer attempt is invalid: $artifact" >&2
exit 1
fi
if [ "$artifact_entry_count" != "1" ] ||
! jq -e \
--arg agent "$expected_agent" \
--arg platform "$expected_platform" \
--argjson attempt "$expected_attempt" \
--argjson runId "$GITHUB_RUN_ID" \
'.agent == $agent and .platform == $platform and
.run == {id: $runId, attempt: $attempt}' \
"$contract" >/dev/null; then
echo "ERROR: managed image candidate artifact identity is invalid: $artifact" >&2
exit 1
fi
candidate_files+=("$contract")
expected_attempts+=("$expected_attempt")
done
candidate_set="$RUNNER_TEMP/managed-image-candidate-set.json"
jq -s 'sort_by(.agent, .platform)' "${candidate_files[@]}" > "$candidate_set"
expected_attempts_json="$(
jq -cn \
--argjson openclawAmd64 "${expected_attempts[0]}" \
--argjson openclawArm64 "${expected_attempts[1]}" \
--argjson hermesAmd64 "${expected_attempts[2]}" \
--argjson hermesArm64 "${expected_attempts[3]}" \
--argjson dcodeAmd64 "${expected_attempts[4]}" \
--argjson dcodeArm64 "${expected_attempts[5]}" \
'{
"openclaw|linux/amd64": $openclawAmd64,
"openclaw|linux/arm64": $openclawArm64,
"hermes|linux/amd64": $hermesAmd64,
"hermes|linux/arm64": $hermesArm64,
"langchain-deepagents-code|linux/amd64": $dcodeAmd64,
"langchain-deepagents-code|linux/arm64": $dcodeArm64
}'
)"
if ! jq -e \
--argjson attempts "$expected_attempts_json" \
--arg ref "$GITHUB_REF" \
--arg release "$expected_release" \
--arg repository "$GITHUB_REPOSITORY" \
--arg revision "$GITHUB_SHA" \
--arg cohort "$expected_cohort" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
'
def sha256: type == "string" and test("^sha256:[0-9a-f]{64}$");
def positive_size:
type == "number" and . > 0 and floor == .;
def workload_descriptor($platform):
(keys | sort) == ["digest", "mediaType", "platform", "size"]
and .mediaType == "application/vnd.oci.image.manifest.v1+json"
and (.digest | sha256)
and (.size | positive_size)
and .platform == (
$platform | split("/") | {os: .[0], architecture: .[1]}
);
def attestation_manifest_descriptor($workloadDigest):
(keys | sort) == ["annotations", "digest", "mediaType", "platform", "size"]
and .mediaType == "application/vnd.oci.image.manifest.v1+json"
and (.digest | sha256)
and (.size | positive_size)
and .platform == {os: "unknown", architecture: "unknown"}
and (.annotations | keys | sort) == [
"vnd.docker.reference.digest",
"vnd.docker.reference.type"
]
and .annotations["vnd.docker.reference.digest"] == $workloadDigest
and .annotations["vnd.docker.reference.type"] == "attestation-manifest";
def statement_descriptor($predicateType):
(keys | sort) == ["annotations", "digest", "mediaType", "size"]
and .mediaType == "application/vnd.in-toto+json"
and (.digest | sha256)
and (.size | positive_size)
and .annotations == {"in-toto.io/predicate-type": $predicateType};
length == 6
and ([.[].agent] | group_by(.) | map({key: .[0], value: length}) | from_entries) == {
"hermes": 2,
"langchain-deepagents-code": 2,
"openclaw": 2
}
and (group_by(.agent) | all(.[];
([.[].platform] | sort) == ["linux/amd64", "linux/arm64"]
))
and all(.[];
(keys | sort) == [
"agent",
"baseReference",
"contractVersion",
"digest",
"image",
"phase",
"platform",
"publicationEvidence",
"reference",
"release",
"run",
"source"
]
and .contractVersion == 2
and .phase == "candidate"
and (.digest | test("^sha256:[0-9a-f]{64}$"))
and .reference == (.image + "@" + .digest)
and (.baseReference | test("@sha256:[0-9a-f]{64}$"))
and (.publicationEvidence | keys | sort) == [
"attestations",
"candidateDescriptor",
"workloadDescriptor"
]
and (.publicationEvidence.candidateDescriptor | keys | sort) == [
"digest",
"mediaType",
"size"
]
and .publicationEvidence.candidateDescriptor.mediaType ==
"application/vnd.oci.image.index.v1+json"
and .publicationEvidence.candidateDescriptor.digest == .digest
and (.publicationEvidence.candidateDescriptor.size | positive_size)
and (
.platform as $candidatePlatform
| .publicationEvidence.workloadDescriptor
| workload_descriptor($candidatePlatform)
)
and (.publicationEvidence.attestations | keys | sort) == [
"manifestDescriptor",
"slsa",
"spdx"
]
and (
.publicationEvidence.workloadDescriptor.digest as $workloadDigest
|
.publicationEvidence.attestations.manifestDescriptor
| attestation_manifest_descriptor($workloadDigest)
)
and (.publicationEvidence.attestations.slsa | keys | sort) == [
"descriptor",
"statement"
]
and (
.publicationEvidence.attestations.slsa.descriptor
| statement_descriptor("https://slsa.dev/provenance/v1")
)
and (
.agent as $candidateAgent
| .baseReference as $candidateBaseReference
| .platform as $candidatePlatform
|
.publicationEvidence.workloadDescriptor.digest as $workloadDigest
| .publicationEvidence.attestations.slsa.statement
| (keys | sort) == [
"bindings",
"buildType",
"builderId",
"predicateType",
"subject",
"type"
]
and .type == "https://in-toto.io/Statement/v1"
and .predicateType == "https://slsa.dev/provenance/v1"
and .buildType ==
"https://github.com/moby/buildkit/blob/master/docs/attestations/slsa-definitions.md"
and (.subject | keys | sort) == ["digest", "name"]
and (.subject.name | type) == "string"
and (.subject.name | length) > 0
and .subject.digest == $workloadDigest
and (.bindings | keys | sort) == [
"agent",
"baseReference",
"cohort",
"platform",
"revision",
"source"
]
and .bindings.agent == $candidateAgent
and .bindings.baseReference == $candidateBaseReference
and .bindings.cohort == $cohort
and .bindings.platform == $candidatePlatform
and .bindings.revision == $revision
and .bindings.source == ("https://github.com/" + $repository)
and .builderId ==
("https://github.com/" + $repository + "/actions/runs/" +
($runId | tostring) + "/attempts/" +
($attempts[$candidateAgent + "|" + $candidatePlatform] | tostring))
)
and (.publicationEvidence.attestations.spdx | keys | sort) == [
"descriptor",
"statement"
]
and (
.publicationEvidence.attestations.spdx.descriptor
| statement_descriptor("https://spdx.dev/Document")
)
and (
.publicationEvidence.workloadDescriptor.digest as $workloadDigest
| .publicationEvidence.attestations.spdx.statement
| (keys | sort) == ["predicateType", "subject", "type"]
and .type == "https://in-toto.io/Statement/v1"
and .predicateType == "https://spdx.dev/Document"
and (.subject | keys | sort) == ["digest", "name"]
and (.subject.name | type) == "string"
and (.subject.name | length) > 0
and .subject.digest == $workloadDigest
)
and .publicationEvidence.attestations.slsa.descriptor.digest !=
.publicationEvidence.attestations.spdx.descriptor.digest
and .source == {
repository: $repository,
revision: $revision,
ref: $ref,
cohort: $cohort
}
and .run == {
id: $runId,
attempt: $attempts[.agent + "|" + .platform]
}
and .release == (if $release == "" then null else $release end)
and (has("aliases") | not)
)
and ([.[].reference] | unique | length) == 6
and ([.[].baseReference] | unique | length) == 6
and ([.[].publicationEvidence.workloadDescriptor.digest] | unique | length) == 6
and ([.[].publicationEvidence.attestations.manifestDescriptor.digest]
| unique | length) == 6
and ([.[].publicationEvidence.attestations.slsa.descriptor.digest]
| unique | length) == 6
and ([.[].publicationEvidence.attestations.spdx.descriptor.digest]
| unique | length) == 6
and (
map({key: (.agent + "|" + .platform), value: .image}) | from_entries
) == {
"openclaw|linux/amd64": "ghcr.io/nvidia/nemoclaw/openclaw-sandbox",
"openclaw|linux/arm64": "ghcr.io/nvidia/nemoclaw/openclaw-sandbox",
"hermes|linux/amd64": "ghcr.io/nvidia/nemoclaw/hermes-sandbox",
"hermes|linux/arm64": "ghcr.io/nvidia/nemoclaw/hermes-sandbox",
"langchain-deepagents-code|linux/amd64":
"ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox",
"langchain-deepagents-code|linux/arm64":
"ghcr.io/nvidia/nemoclaw/langchain-deepagents-code-sandbox"
}
' "$candidate_set" >/dev/null
then
echo "ERROR: complete managed image candidate set failed closed validation." >&2
exit 1
fi
printf 'candidate_set=%s\n' "$candidate_set" >> "$GITHUB_OUTPUT"
- name: Verify release tag before managed image promotion
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
RELEASE_TAG: ${{ github.ref_name }}
RELEASE_REVISION: ${{ github.sha }}
with:
script: |
const releaseTag = process.env.RELEASE_TAG ?? '';
const releaseRevision = process.env.RELEASE_REVISION ?? '';
if (!/^v\d+\.\d+\.\d+$/.test(releaseTag)) {
throw new Error(`Refusing to verify non-semver tag: ${releaseTag}`);
}
if (!/^[0-9a-f]{40}$/.test(releaseRevision)) {
throw new Error(`Refusing release promotion with invalid revision: ${releaseRevision}`);
}
const { owner, repo } = context.repo;
const ref = await github.rest.git.getRef({ owner, repo, ref: `tags/${releaseTag}` });
if (ref.data.object.type !== 'tag') {
throw new Error(`Release tag ${releaseTag} must be annotated`);
}
const tagObjectSha = ref.data.object.sha;
let tagObject;
for (let attempt = 1; attempt <= 10; attempt += 1) {
({ data: tagObject } = await github.rest.git.getTag({
owner,
repo,
tag_sha: tagObjectSha,
}));
if (tagObject.verification?.verified === true) break;
if (attempt < 10) {
core.info(`Waiting for GitHub tag verification (${attempt}/10)`);
await new Promise((resolve) => setTimeout(resolve, 3000));
}
}
if (
tagObject.tag !== releaseTag ||
tagObject.object.type !== 'commit' ||
tagObject.object.sha !== releaseRevision ||
tagObject.verification?.verified !== true
) {
throw new Error(`Release tag ${releaseTag} is not a verified direct commit tag`);
}
- name: Checkout publication verifier
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Docker Buildx for promotion
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Log in to GHCR for promotion
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Revalidate exact managed image publication evidence
shell: bash
env:
CANDIDATE_SET: ${{ steps.candidates.outputs.candidate_set }}
run: |
set -euo pipefail
revalidated_root="$RUNNER_TEMP/revalidated-managed-image-evidence"
install -d -m 0700 "$revalidated_root"
index=0
while IFS= read -r candidate; do
index=$((index + 1))
reference="$(jq -er '.reference' <<<"$candidate")"
digest="$(jq -er '.digest' <<<"$candidate")"
platform="$(jq -er '.platform' <<<"$candidate")"
agent="$(jq -er '.agent' <<<"$candidate")"
base_reference="$(jq -er '.baseReference' <<<"$candidate")"
repository="$(jq -er '.source.repository' <<<"$candidate")"
revision="$(jq -er '.source.revision' <<<"$candidate")"
cohort="$(jq -er '.source.cohort' <<<"$candidate")"
run_id="$(jq -er '.run.id | tostring' <<<"$candidate")"
run_attempt="$(jq -er '.run.attempt | tostring' <<<"$candidate")"
actual="$revalidated_root/$index.json"
expected="$revalidated_root/$index.expected.json"
scripts/checks/verify-managed-image-publication-evidence.sh \
--reference "$reference" \
--digest "$digest" \
--platform "$platform" \
--agent "$agent" \
--base-reference "$base_reference" \
--repository "$repository" \
--revision "$revision" \
--cohort "$cohort" \
--run-id "$run_id" \
--run-attempt "$run_attempt" \
--output "$actual"
jq -S '.publicationEvidence' <<<"$candidate" > "$expected"
if ! cmp -s "$expected" <(jq -S . "$actual"); then
echo "ERROR: registry publication evidence changed after candidate validation: $reference" >&2
exit 1
fi
done < <(jq -c '.[]' "$CANDIDATE_SET")
if [ "$index" -ne 6 ]; then
echo "ERROR: registry evidence revalidation did not cover all six candidates." >&2
exit 1
fi
- name: Stage validated multi-platform managed image cohort and contracts
shell: bash
env:
CANDIDATE_SET: ${{ steps.candidates.outputs.candidate_set }}
PUBLICATION_COHORT: ${{ needs.publication-identity.outputs.cohort }}
run: |
set -euo pipefail
contract_root="$RUNNER_TEMP/managed-image-contracts"
mkdir -p "$contract_root"
cohort="$PUBLICATION_COHORT"
if [[ ! "$cohort" =~ ^ghrun-[1-9][0-9]{0,19}-[1-9][0-9]{0,9}$ ]]; then
echo "ERROR: publication cohort is invalid: $cohort" >&2
exit 1
fi
manifests="$RUNNER_TEMP/managed-image-cohort-manifests.jsonl"
: > "$manifests"
for agent in openclaw hermes langchain-deepagents-code; do
agent_candidates="$RUNNER_TEMP/managed-image-${agent}-candidates.json"
jq -ce --arg agent "$agent" \
'[.[] | select(.agent == $agent)] | sort_by(.platform)' \
"$CANDIDATE_SET" > "$agent_candidates"
image="$(jq -er '.[0].image' "$agent_candidates")"
descriptor_root="$RUNNER_TEMP/managed-image-${agent}-descriptors"
install -d -m 0700 "$descriptor_root"
descriptor_args=()
candidate_index=0
while IFS= read -r candidate; do
candidate_index=$((candidate_index + 1))
workload_descriptor="$descriptor_root/$candidate_index-workload.json"
attestation_descriptor="$descriptor_root/$candidate_index-attestation.json"
jq -S '.publicationEvidence.workloadDescriptor' \
<<<"$candidate" > "$workload_descriptor"
jq -S '.publicationEvidence.attestations.manifestDescriptor' \
<<<"$candidate" > "$attestation_descriptor"
descriptor_args+=(
--file "$workload_descriptor"
--file "$attestation_descriptor"
)
done < <(jq -c '.[]' "$agent_candidates")
if [ "$candidate_index" -ne 2 ] || [ "${#descriptor_args[@]}" -ne 8 ]; then
echo "ERROR: expected exactly two platform candidates for $agent." >&2
exit 1
fi
cohort_alias="${image}:cohort-${cohort}"
cohort_metadata="$RUNNER_TEMP/managed-image-${agent}-cohort-metadata.json"
docker buildx imagetools create \
--tag "$cohort_alias" \
--metadata-file "$cohort_metadata" \
"${descriptor_args[@]}"
cohort_raw="$RUNNER_TEMP/managed-image-${agent}-cohort.raw"
docker buildx imagetools inspect "$cohort_alias" --raw > "$cohort_raw"
expected_descriptors="$descriptor_root/expected.json"
actual_descriptors="$descriptor_root/actual.json"
jq -S '[
.[]
| (
.publicationEvidence.workloadDescriptor,
.publicationEvidence.attestations.manifestDescriptor
)
] | sort_by(.digest)' "$agent_candidates" > "$expected_descriptors"
jq -S '.manifests | sort_by(.digest)' "$cohort_raw" > "$actual_descriptors"
if ! jq -e '
(keys | sort) == ["manifests", "mediaType", "schemaVersion"]
and .schemaVersion == 2
and .mediaType == "application/vnd.oci.image.index.v1+json"
and (.manifests | length) == 4
and ([
.manifests[]
| select(.platform.os == "linux")
| "linux/" + .platform.architecture
] | sort) == ["linux/amd64", "linux/arm64"]
and ([
.manifests[]
| select(
.platform == {os: "unknown", architecture: "unknown"}
and .annotations["vnd.docker.reference.type"] ==
"attestation-manifest"
)
] | length) == 2
' "$cohort_raw" >/dev/null ||
! cmp -s "$expected_descriptors" "$actual_descriptors"; then
echo "ERROR: staged cohort descriptors differ from validated candidates: $cohort_alias" >&2
exit 1
fi
cohort_descriptor="$RUNNER_TEMP/managed-image-${agent}-cohort-descriptor.json"
jq -ce '.["containerimage.descriptor"]' \
"$cohort_metadata" > "$cohort_descriptor"
cohort_digest="$(jq -er '.digest' "$cohort_descriptor")"
cohort_size="$(wc -c < "$cohort_raw" | tr -d '[:space:]')"
actual_cohort_digest="sha256:$(sha256sum "$cohort_raw" | awk '{print $1}')"
if ! jq -e \
--arg digest "$actual_cohort_digest" \
--argjson size "$cohort_size" \
'
(keys | sort) == ["digest", "mediaType", "size"]
and .mediaType == "application/vnd.oci.image.index.v1+json"
and .digest == $digest
and .size == $size
' "$cohort_descriptor" >/dev/null; then
echo "ERROR: staged cohort descriptor does not match its registry bytes: $cohort_alias" >&2
exit 1
fi
cohort_reference="${image}@${cohort_digest}"
exact_raw="$RUNNER_TEMP/managed-image-${agent}-cohort-exact.raw"
docker buildx imagetools inspect "$cohort_reference" --raw > "$exact_raw"
if ! cmp -s "$cohort_raw" "$exact_raw"; then
echo "ERROR: staged cohort alias bytes do not match their exact digest: $cohort_alias" >&2
exit 1
fi
jq -cn \
--arg agent "$agent" \
--arg alias "$cohort_alias" \
--arg digest "$cohort_digest" \
--arg image "$image" \
--arg reference "$cohort_reference" \
--slurpfile descriptor "$cohort_descriptor" \
--slurpfile platforms "$agent_candidates" \
'{
agent: $agent,
image: $image,
digest: $digest,
reference: $reference,
descriptor: $descriptor[0],
alias: $alias,
platforms: ($platforms[0] | map({
key: .platform,
value: {
digest,
reference,
baseReference,
run,
publicationEvidence
}
}) | from_entries)
}' >> "$manifests"
done
cohort_manifests="$RUNNER_TEMP/managed-image-cohort-manifests.json"
jq -s 'sort_by(.agent)' "$manifests" > "$cohort_manifests"
if ! jq -e \
--arg repository "$GITHUB_REPOSITORY" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
'
length == 3
and ([.[].agent] | sort) == [
"hermes",
"langchain-deepagents-code",
"openclaw"
]
and all(.[];
(.digest | test("^sha256:[0-9a-f]{64}$"))
and .reference == (.image + "@" + .digest)
and .descriptor == {
mediaType: "application/vnd.oci.image.index.v1+json",
digest: .digest,
size: .descriptor.size
}
and (.descriptor.size | type) == "number"
and .descriptor.size > 0
and (.platforms | keys | sort) == ["linux/amd64", "linux/arm64"]
and all(.platforms[];
(.digest | test("^sha256:[0-9a-f]{64}$"))
and (.baseReference | test("@sha256:[0-9a-f]{64}$"))
and (.run | keys | sort) == ["attempt", "id"]
and .run.id == $runId
and (.run.attempt | type) == "number"
and .run.attempt >= 1
and (.run.attempt | floor) == .run.attempt
and .run.attempt <= $runAttempt
and .publicationEvidence.candidateDescriptor.digest == .digest
and .publicationEvidence.attestations.manifestDescriptor.annotations[
"vnd.docker.reference.digest"
] == .publicationEvidence.workloadDescriptor.digest
and .publicationEvidence.attestations.slsa.statement.subject.digest ==
.publicationEvidence.workloadDescriptor.digest
and .publicationEvidence.attestations.spdx.statement.subject.digest ==
.publicationEvidence.workloadDescriptor.digest
and .publicationEvidence.attestations.slsa.statement.builderId ==
("https://github.com/" + $repository + "/actions/runs/" +
($runId | tostring) + "/attempts/" + (.run.attempt | tostring))
)
)
' "$cohort_manifests" >/dev/null; then
echo "ERROR: staged multi-platform cohort failed exact validation." >&2
exit 1
fi
# Prove that every staged agent alias is anonymously pullable on both
# supported architectures before any shipped-agent consumer pointer moves.
anonymous_config="$(mktemp -d "$RUNNER_TEMP/anonymous-cohort-docker-XXXXXX")"
chmod 0700 "$anonymous_config"
while IFS= read -r manifest; do
cohort_reference="$(jq -r '.reference' <<<"$manifest")"
for platform in linux/amd64 linux/arm64; do
DOCKER_CONFIG="$anonymous_config" docker pull \
--platform "$platform" \
"$cohort_reference"
docker image rm "$cohort_reference" >/dev/null
done
done < <(jq -c '.[]' "$cohort_manifests")
# Record the intended root pointers for every shipped agent in its
# exact contract. They are not moved until all v2 evidence artifacts
# are durable. Hermes ships alongside OpenClaw (#11228), and Deep
# Agents Code alongside both (#11341), matching
# SHIPPED_MANAGED_IMAGE_AGENTS in src/lib/onboard/managed-image.
shipped_agents=(openclaw hermes langchain-deepagents-code)
release_tag="$(jq -r '.[0].release // empty' "$CANDIDATE_SET")"
while IFS= read -r candidate; do
agent="$(jq -r '.agent' <<<"$candidate")"
platform="$(jq -r '.platform' <<<"$candidate")"
candidate_run="$(jq -ce '.run' <<<"$candidate")"
artifact_platform="${platform//\//-}"
cohort_manifest="$(jq -ce --arg agent "$agent" '.[] | select(.agent == $agent)' "$cohort_manifests")"
cohort_alias="$(jq -r '.alias' <<<"$cohort_manifest")"
staged_cohort="$(
jq -c '{alias, descriptor, reference}' <<<"$cohort_manifest"
)"
aliases=("$cohort_alias")
for shipped_agent in "${shipped_agents[@]}"; do
if [ "$agent" = "$shipped_agent" ]; then
aliases+=("$(jq -r '.image' <<<"$cohort_manifest"):${GITHUB_SHA}")
if [ -n "$release_tag" ]; then
aliases+=("$(jq -r '.image' <<<"$cohort_manifest"):${release_tag}")
fi
fi
done
aliases_json="$(printf '%s\n' "${aliases[@]}" | jq -R . | jq -s .)"
contract_dir="$contract_root/$agent/$artifact_platform"
mkdir -p "$contract_dir"
jq \
--argjson aliases "$aliases_json" \
--argjson stagedCohort "$staged_cohort" \
'{
contractVersion,
agent,
image,
digest,
reference,
baseReference,
platform,
publicationEvidence,
stagedCohort: $stagedCohort,
source: {
repository: .source.repository,
revision: .source.revision,
release,
cohort: .source.cohort
},
run,
aliases: $aliases
}' <<<"$candidate" > "$contract_dir/contract.json"
if ! jq -e \
--arg agent "$agent" \
--arg platform "$platform" \
--arg cohort "$cohort" \
--argjson aliases "$aliases_json" \
--argjson candidateRun "$candidate_run" \
'(keys | sort) == [
"agent",
"aliases",
"baseReference",
"contractVersion",
"digest",
"image",
"platform",
"publicationEvidence",
"reference",
"run",
"source",
"stagedCohort"
]
and .contractVersion == 2
and .agent == $agent
and .platform == $platform
and (.digest | test("^sha256:[0-9a-f]{64}$"))
and .reference == (.image + "@" + .digest)
and (.baseReference | test("@sha256:[0-9a-f]{64}$"))
and .publicationEvidence.candidateDescriptor.digest == .digest
and .publicationEvidence.workloadDescriptor.platform == (
$platform | split("/") | {os: .[0], architecture: .[1]}
)
and .publicationEvidence.attestations.manifestDescriptor.annotations[
"vnd.docker.reference.digest"
] == .publicationEvidence.workloadDescriptor.digest
and .stagedCohort.alias == (.image + ":cohort-" + $cohort)
and .stagedCohort.reference == (.image + "@" + .stagedCohort.descriptor.digest)
and .stagedCohort.descriptor.mediaType ==
"application/vnd.oci.image.index.v1+json"
and (.stagedCohort.descriptor.digest | test("^sha256:[0-9a-f]{64}$"))
and (.stagedCohort.descriptor.size | type) == "number"
and .stagedCohort.descriptor.size > 0
and .source.revision == $ENV.GITHUB_SHA
and .source.cohort == $cohort
and .run == $candidateRun
and .aliases == $aliases
and (
(.image + ":cohort-" + $cohort) as $cohortAlias
| (.aliases | index($cohortAlias)) != null
)' "$contract_dir/contract.json" >/dev/null; then
echo "ERROR: final exact platform contract failed validation: $agent/$platform" >&2
exit 1
fi
done < <(jq -c '.[]' "$CANDIDATE_SET")
cohort_contract="$contract_root/cohort.json"
jq -n \
--arg repository "$GITHUB_REPOSITORY" \
--arg revision "$GITHUB_SHA" \
--arg release "$release_tag" \
--arg cohort "$cohort" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
--slurpfile agents "$cohort_manifests" \
'{
contractVersion: 2,
cohort: $cohort,
source: {
repository: $repository,
revision: $revision,
release: (if $release == "" then null else $release end)
},
run: {id: $runId, attempt: $runAttempt},
platforms: ["linux/amd64", "linux/arm64"],
agents: ($agents[0] | map({key: .agent, value: del(.agent)}) | from_entries)
}' > "$cohort_contract"
jq -e \
--arg cohort "$cohort" \
--arg repository "$GITHUB_REPOSITORY" \
--arg revision "$GITHUB_SHA" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
'(keys | sort) == [
"agents",
"cohort",
"contractVersion",
"platforms",
"run",
"source"
]
and .contractVersion == 2
and .cohort == $cohort
and .source.revision == $revision
and .run == {id: $runId, attempt: $runAttempt}
and .platforms == ["linux/amd64", "linux/arm64"]
and (.agents | keys | sort) == [
"hermes",
"langchain-deepagents-code",
"openclaw"
]
and all(.agents[];
(.digest | test("^sha256:[0-9a-f]{64}$"))
and .reference == (.image + "@" + .digest)
and .descriptor == {
mediaType: "application/vnd.oci.image.index.v1+json",
digest: .digest,
size: .descriptor.size
}
and (.descriptor.size | type) == "number"
and .descriptor.size > 0
and .alias == (.image + ":cohort-" + $cohort)
and (.platforms | keys | sort) == ["linux/amd64", "linux/arm64"]
and all(.platforms[];
(.run | keys | sort) == ["attempt", "id"]
and .run.id == $runId
and (.run.attempt | type) == "number"
and .run.attempt >= 1
and (.run.attempt | floor) == .run.attempt
and .run.attempt <= $runAttempt
and .publicationEvidence.candidateDescriptor.digest == .digest
and .publicationEvidence.attestations.manifestDescriptor.annotations[
"vnd.docker.reference.digest"
] == .publicationEvidence.workloadDescriptor.digest
and .publicationEvidence.attestations.slsa.statement.builderId ==
("https://github.com/" + $repository + "/actions/runs/" +
($runId | tostring) + "/attempts/" + (.run.attempt | tostring))
)
)' "$cohort_contract" >/dev/null
- name: Upload complete managed image cohort contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-cohort-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/managed-image-contracts/cohort.json
if-no-files-found: error
retention-days: 90
- name: Upload OpenClaw amd64 managed image contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-${{ github.run_id }}-${{ github.run_attempt }}-openclaw-linux-amd64
path: ${{ runner.temp }}/managed-image-contracts/openclaw/linux-amd64/contract.json
if-no-files-found: error
retention-days: 90
- name: Upload OpenClaw arm64 managed image contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-${{ github.run_id }}-${{ github.run_attempt }}-openclaw-linux-arm64
path: ${{ runner.temp }}/managed-image-contracts/openclaw/linux-arm64/contract.json
if-no-files-found: error
retention-days: 90
- name: Upload Hermes amd64 managed image contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-${{ github.run_id }}-${{ github.run_attempt }}-hermes-linux-amd64
path: ${{ runner.temp }}/managed-image-contracts/hermes/linux-amd64/contract.json
if-no-files-found: error
retention-days: 90
- name: Upload Hermes arm64 managed image contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-${{ github.run_id }}-${{ github.run_attempt }}-hermes-linux-arm64
path: ${{ runner.temp }}/managed-image-contracts/hermes/linux-arm64/contract.json
if-no-files-found: error
retention-days: 90
- name: Upload Deep Agents Code amd64 managed image contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-${{ github.run_id }}-${{ github.run_attempt }}-langchain-deepagents-code-linux-amd64
path: ${{ runner.temp }}/managed-image-contracts/langchain-deepagents-code/linux-amd64/contract.json
if-no-files-found: error
retention-days: 90
- name: Upload Deep Agents Code arm64 managed image contract
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: managed-image-${{ github.run_id }}-${{ github.run_attempt }}-langchain-deepagents-code-linux-arm64
path: ${{ runner.temp }}/managed-image-contracts/langchain-deepagents-code/linux-arm64/contract.json
if-no-files-found: error
retention-days: 90
# Keep this final: an evidence-artifact upload failure must never leave a
# consumer root pointing at a cohort without its durable v2 contracts.
- name: Promote durable managed image cohort pointers
shell: bash
env:
PUBLICATION_COHORT: ${{ needs.publication-identity.outputs.cohort }}
run: |
set -euo pipefail
cohort_contract="$RUNNER_TEMP/managed-image-contracts/cohort.json"
if [ ! -f "$cohort_contract" ] || [ -L "$cohort_contract" ]; then
echo "ERROR: durable managed image cohort contract is missing or unsafe." >&2
exit 1
fi
cohort="$PUBLICATION_COHORT"
# Root pointers move for every shipped agent: OpenClaw, Hermes
# (#11228), and Deep Agents Code (#11341), matching
# SHIPPED_MANAGED_IMAGE_AGENTS in src/lib/onboard/managed-image.
# Every shipped agent's contract and exact cohort bytes are validated
# before any pointer moves. A registry failure can leave an earlier
# agent's pointers moved; rerunning this job reconciles them to this
# cohort.
shipped_agents=(openclaw hermes langchain-deepagents-code)
release_tag="$(jq -r '.source.release // empty' "$cohort_contract")"
if [[ ! "$GITHUB_SHA" =~ ^[0-9a-f]{40}$ ]]; then
echo "ERROR: durable managed image pointer identity is invalid." >&2
exit 1
fi
if [ -n "$release_tag" ] &&
[[ ! "$release_tag" =~ ^v[0-9]+([.][0-9]+){1,3}([-.][0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
echo "ERROR: durable managed image release identity is invalid." >&2
exit 1
fi
for agent in "${shipped_agents[@]}"; do
if ! jq -e \
--arg agent "$agent" \
--arg cohort "$cohort" \
--arg repository "$GITHUB_REPOSITORY" \
--arg revision "$GITHUB_SHA" \
--argjson runAttempt "$GITHUB_RUN_ATTEMPT" \
--argjson runId "$GITHUB_RUN_ID" \
'
.contractVersion == 2
and .cohort == $cohort
and .source.repository == $repository
and .source.revision == $revision
and .run == {id: $runId, attempt: $runAttempt}
and .agents[$agent].reference ==
(.agents[$agent].image + "@" + .agents[$agent].digest)
and .agents[$agent].descriptor == {
mediaType: "application/vnd.oci.image.index.v1+json",
digest: .agents[$agent].digest,
size: .agents[$agent].descriptor.size
}
and (.agents[$agent].descriptor.size | type) == "number"
and .agents[$agent].descriptor.size > 0
' "$cohort_contract" >/dev/null; then
echo "ERROR: durable managed image cohort contract cannot authorize promotion for ${agent}." >&2
exit 1
fi
image="$(jq -er --arg agent "$agent" '.agents[$agent].image' "$cohort_contract")"
exact_reference="$(jq -er --arg agent "$agent" '.agents[$agent].reference' "$cohort_contract")"
expected_digest="$(jq -er --arg agent "$agent" '.agents[$agent].digest' "$cohort_contract")"
expected_size="$(jq -er --arg agent "$agent" '.agents[$agent].descriptor.size | tostring' "$cohort_contract")"
if [ "$image" != "ghcr.io/nvidia/nemoclaw/${agent}-sandbox" ] ||
[[ ! "$exact_reference" =~ ^ghcr\.io/nvidia/nemoclaw/(openclaw|hermes|langchain-deepagents-code)-sandbox@sha256:[0-9a-f]{64}$ ]] ||
[ "${exact_reference%@*}" != "$image" ]; then
echo "ERROR: durable managed image pointer identity is invalid for ${agent}." >&2
exit 1
fi
exact_raw="$RUNNER_TEMP/managed-image-${agent}-cohort-exact.raw"
docker buildx imagetools inspect "$exact_reference" --raw > "$exact_raw"
actual_digest="sha256:$(sha256sum "$exact_raw" | awk '{print $1}')"
actual_size="$(wc -c < "$exact_raw" | tr -d '[:space:]')"
if [ "$actual_digest" != "$expected_digest" ] ||
[ "$actual_size" != "$expected_size" ]; then
echo "ERROR: exact ${agent} cohort bytes differ from the durable contract." >&2
exit 1
fi
done
for agent in "${shipped_agents[@]}"; do
image="$(jq -er --arg agent "$agent" '.agents[$agent].image' "$cohort_contract")"
exact_reference="$(jq -er --arg agent "$agent" '.agents[$agent].reference' "$cohort_contract")"
exact_raw="$RUNNER_TEMP/managed-image-${agent}-cohort-exact.raw"
consumer_aliases=("${image}:${GITHUB_SHA}")
if [ -n "$release_tag" ]; then
consumer_aliases+=("${image}:${release_tag}")
fi
consumer_tag_args=()
for alias in "${consumer_aliases[@]}"; do
consumer_tag_args+=(--tag "$alias")
done
docker buildx imagetools create "${consumer_tag_args[@]}" "$exact_reference"
for alias in "${consumer_aliases[@]}"; do
alias_raw="$RUNNER_TEMP/managed-image-${agent}-pointer-${alias##*:}.raw"
docker buildx imagetools inspect "$alias" --raw > "$alias_raw"
if ! cmp -s "$exact_raw" "$alias_raw"; then
echo "ERROR: ${agent} cohort pointer is not exact: $alias" >&2
exit 1
fi
done
done