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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 119 additions & 39 deletions .github/workflows/e2e.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions ci/pi-agent-qualification-v1-linux-amd64.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"agent": "pi",
"platform": "linux/amd64",
"image": "ghcr.io/nvidia/nemoclaw/pi-sandbox",
"digest": "sha256:3bf1dcebb4fdefe4ad588b15f287e2546a570c4464897835c37599de2ec1b66b",
"reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:3bf1dcebb4fdefe4ad588b15f287e2546a570c4464897835c37599de2ec1b66b",
"digest": "sha256:aefc5eecd7bf6e3eea0e4df97cbca155a271e2e18d569cdc4acbf8008fdc943a",
"reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:aefc5eecd7bf6e3eea0e4df97cbca155a271e2e18d569cdc4acbf8008fdc943a",
"source": {
"repository": "NVIDIA/NemoClaw",
"revision": "9abef33ddf73105c8f3f952ced9ce4eb53252126",
"revision": "77e3ce673f6f14c277273de4033775a67fea2a9f",
"release": "v0.1.0",
"cohort": "ghrun-37676667241-1"
"cohort": "ghrun-37850713619-1"
},
"startupProfileContractVersion": 1,
"capabilityContractVersion": 1
Expand Down
8 changes: 4 additions & 4 deletions ci/pi-agent-qualification-v1-linux-arm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"agent": "pi",
"platform": "linux/arm64",
"image": "ghcr.io/nvidia/nemoclaw/pi-sandbox",
"digest": "sha256:f3d7ed13c07c7c3840414752aa72e77178fa957137951c25ad4afa84206b11ac",
"reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:f3d7ed13c07c7c3840414752aa72e77178fa957137951c25ad4afa84206b11ac",
"digest": "sha256:b91f5d84e342d7b5d39460a4e4f9cfc2c4baeb32fd2d61f35f5dd3b468b243bd",
"reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:b91f5d84e342d7b5d39460a4e4f9cfc2c4baeb32fd2d61f35f5dd3b468b243bd",
"source": {
"repository": "NVIDIA/NemoClaw",
"revision": "9abef33ddf73105c8f3f952ced9ce4eb53252126",
"revision": "77e3ce673f6f14c277273de4033775a67fea2a9f",
"release": "v0.1.0",
"cohort": "ghrun-37676667241-1"
"cohort": "ghrun-37850713619-1"
},
"startupProfileContractVersion": 1,
"capabilityContractVersion": 1
Expand Down
5 changes: 3 additions & 2 deletions ci/protected-managed-image-multiarch-activation-v1.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"agents": ["openclaw", "hermes", "langchain-deepagents-code"],
"contractVersion": 1,
"contractVersion": 2,
"jobId": "managed-image-multiarch-startup",
"platforms": ["linux/amd64", "linux/arm64"]
"platforms": ["linux/amd64", "linux/arm64"],
"dcodeBaseSource": "candidate"
}
106 changes: 96 additions & 10 deletions scripts/checks/build-protected-managed-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,18 @@ esac
target_arch="${platform#linux/}"
npm_target_os="linux"
npm_target_libc="glibc"
[[ "$openclaw_base" =~ ^ghcr[.]io/nvidia/nemoclaw/sandbox-base@sha256:[a-f0-9]{64}$ ]] || usage
[[ "$hermes_base" =~ ^ghcr[.]io/nvidia/nemoclaw/hermes-sandbox-base@sha256:[a-f0-9]{64}$ ]] || usage
[[ "$dcode_base" =~ ^ghcr[.]io/nvidia/nemoclaw/langchain-deepagents-code-sandbox-base@sha256:[a-f0-9]{64}$ ]] || usage
[[ "$openclaw_base" == candidate ||
"$openclaw_base" =~ ^ghcr[.]io/nvidia/nemoclaw/sandbox-base@sha256:[a-f0-9]{64}$ ||
(-n "$cache_from" && "$openclaw_base" =~ ^localhost:5000/nemoclaw-managed-protected-base/openclaw@sha256:[a-f0-9]{64}$) ]] || usage
[[ "$hermes_base" == candidate ||
"$hermes_base" =~ ^ghcr[.]io/nvidia/nemoclaw/hermes-sandbox-base@sha256:[a-f0-9]{64}$ ||
(-n "$cache_from" && "$hermes_base" =~ ^localhost:5000/nemoclaw-managed-protected-base/hermes@sha256:[a-f0-9]{64}$) ]] || usage
[[ "$dcode_base" == candidate ||
"$dcode_base" =~ ^ghcr[.]io/nvidia/nemoclaw/langchain-deepagents-code-sandbox-base@sha256:[a-f0-9]{64}$ ||
(-n "$cache_from" && "$dcode_base" =~ ^localhost:5000/nemoclaw-managed-protected-base/langchain-deepagents-code@sha256:[a-f0-9]{64}$) ]] || usage
[[ "$dcode_base" != candidate || -z "$cache_from" ]] || usage
[[ "$openclaw_base" != candidate || -z "$cache_from" ]] || usage
[[ "$hermes_base" != candidate || -z "$cache_from" ]] || usage
prepared_identity="$revision $platform $openclaw_base $hermes_base $dcode_base"
[[ "$source_root" == /* && "$source_root" != *$'\n'* && -d "$source_root" && ! -L "$source_root" ]] || usage
source_root="$(cd -- "$source_root" && pwd -P)"
Expand Down Expand Up @@ -240,6 +249,72 @@ trap restore_worktree EXIT
trap 'exit 130' INT
trap 'exit 143' TERM

# A PR dependency upgrade needs its own base; a published main base cannot
# satisfy the candidate's no-deps profile. Keep this build on the CPU runner
# and bind the exported OCI bytes to the exact source, platform and run.
prepare_candidate_base() {
local agent="$1" dockerfile="$2" cache_name="$3"
prepared_base="$4"
prepared_base_layout=""
local receipt_helper="$controller_root/scripts/checks/protected-dcode-base-receipt.mts"
if [[ "$prepared_base" == candidate ]]; then
[[ "$(git -C "$source_root" rev-parse --verify HEAD)" == "$revision" ]] || {
echo "ERROR: candidate base checkout does not match its revision" >&2
exit 1
}
git -C "$source_root" diff --quiet HEAD -- || {
echo "ERROR: candidate base checkout has tracked modifications" >&2
exit 1
}
prepared_base_layout="${cache_to:-$work_dir}/${cache_name}-base"
local base_receipt="${cache_to:-$work_dir}/${cache_name}-base-receipt.json"
local base_tag="localhost:5000/nemoclaw-managed-protected-base/${agent}:${revision}"
docker buildx build \
--file "$source_root/$dockerfile" \
--platform "$platform" \
--provenance=false --sbom=false \
--label "org.opencontainers.image.source=https://github.com/NVIDIA/NemoClaw" \
--label "org.opencontainers.image.revision=${revision}" \
--label "io.nvidia.nemoclaw.agent=${agent}" \
--label "io.nvidia.nemoclaw.managed-image.cohort=${cohort}" \
--output "type=image,name=${base_tag},push=true,oci-mediatypes=true" \
--output "type=oci,dest=${prepared_base_layout},tar=false" \
"$source_root"
prepared_base="$(CHECKOUT_SHA="$revision" \
NEMOCLAW_PROTECTED_MANAGED_IMAGE_COHORT="$cohort" \
NEMOCLAW_PROTECTED_MANAGED_IMAGE_PLATFORM="$platform" \
node "$receipt_helper" write "$prepared_base_layout" "$base_receipt" "$agent")"
# Prove the pushed manifest and the offline artifact have the same identity.
docker buildx imagetools inspect "$prepared_base" --raw >"$work_dir/${cache_name}-candidate-base.raw"
[[ "sha256:$(sha256sum "$work_dir/${cache_name}-candidate-base.raw" | awk '{print $1}')" == "${prepared_base##*@}" ]] || {
echo "ERROR: candidate base registry and OCI artifact digests differ" >&2
exit 1
}
elif [[ "$prepared_base" == localhost:5000/* ]]; then
prepared_base_layout="$cache_from/${cache_name}-base"
local verified_base
verified_base="$(CHECKOUT_SHA="$revision" \
NEMOCLAW_PROTECTED_MANAGED_IMAGE_COHORT="$cohort" \
NEMOCLAW_PROTECTED_MANAGED_IMAGE_PLATFORM="$platform" \
node "$receipt_helper" verify "$prepared_base_layout" "$cache_from/${cache_name}-base-receipt.json" "$agent")"
[[ "$verified_base" == "$prepared_base" ]] || {
echo "ERROR: candidate base artifact does not match the prepared base reference" >&2
exit 1
}
fi
}

prepare_candidate_base openclaw Dockerfile.base openclaw "$openclaw_base"
openclaw_base="$prepared_base"
openclaw_base_layout="$prepared_base_layout"
prepare_candidate_base hermes agents/hermes/Dockerfile.base hermes "$hermes_base"
hermes_base="$prepared_base"
hermes_base_layout="$prepared_base_layout"
prepare_candidate_base langchain-deepagents-code agents/langchain-deepagents-code/Dockerfile.base dcode "$dcode_base"
dcode_base="$prepared_base"
dcode_base_layout="$prepared_base_layout"
prepared_identity="$revision $platform $openclaw_base $hermes_base $dcode_base"

audit_receipt=""
audit_raw_report=""
audit_policy_result=""
Expand Down Expand Up @@ -476,13 +551,24 @@ build_agent() {
fi

local base_digest="${base_reference##*@}"
docker buildx imagetools inspect "$base_reference" --raw >"$exact_base_raw"
local actual_base
actual_base="sha256:$(sha256sum "$exact_base_raw" | awk '{print $1}')"
[[ "$actual_base" == "$base_digest" ]] || {
echo "ERROR: ${agent} exact base bytes do not match its descriptor" >&2
exit 1
}
local base_layout=""
case "$agent" in
openclaw) base_layout="$openclaw_base_layout" ;;
hermes) base_layout="$hermes_base_layout" ;;
langchain-deepagents-code) base_layout="$dcode_base_layout" ;;
esac
if [[ -n "$base_layout" ]]; then
# The verified local OCI input survives deletion of the CPU job's registry.
cache_args+=(--build-context "$base_reference=oci-layout://${base_layout}@${base_digest}")
else
docker buildx imagetools inspect "$base_reference" --raw >"$exact_base_raw"
local actual_base
actual_base="sha256:$(sha256sum "$exact_base_raw" | awk '{print $1}')"
[[ "$actual_base" == "$base_digest" ]] || {
echo "ERROR: ${agent} exact base bytes do not match its descriptor" >&2
exit 1
}
fi

scripts/check-production-build-args.sh \
-f "$dockerfile_path" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/checks/dependency-pins.mts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ function verifyOpenShellPins(
".github/workflows/e2e.yaml gateway auth OpenShell version",
failures,
),
pins.maxVersion,
"${{ needs.generate-matrix.outputs.openshell_version }}",
".github/workflows/e2e.yaml gateway auth OpenShell version",
failures,
);
Expand Down
83 changes: 74 additions & 9 deletions scripts/checks/extract-installer-pins.mts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type OpenShellPinLayout = {

type OpenShellReleaseTrust = {
brevTemplateSha256: readonly string[];
featureGateTemplateSha256?: readonly string[];
formula: {
asset: "openshell.rb";
sha256: string;
Expand Down Expand Up @@ -592,6 +593,7 @@ const TRUSTED_OPENSHELL_RELEASES: readonly OpenShellReleaseTrust[] = [
],
},
pinLayout: V00116_OPENSHELL_PIN_LAYOUT,
featureGateTemplateSha256: ["3404b35030ce0adef3998dcdedf27245610534ddefaa741e125539b3d2e1a735"],
version: "0.0.116",
},
{
Expand Down Expand Up @@ -646,6 +648,8 @@ const TRUSTED_OPENSHELL_RELEASES: readonly OpenShellReleaseTrust[] = [
],
},
pinLayout: V00116_OPENSHELL_PIN_LAYOUT,
// #12603's reviewed split-supervisor check accepts only the selected sandbox hashes.
featureGateTemplateSha256: ["3a402736ff8a2e02b5b26382521b4a4b9774046856c42f5be093b56480d6711e"],
version: "0.1.2",
},
] as const;
Expand Down Expand Up @@ -696,6 +700,9 @@ function validateTrustedRelease(release: OpenShellReleaseTrust): void {
release.installerTemplateSha256.some((sha256) => !SHA256_PATTERN.test(sha256)) ||
release.brevTemplateSha256.length === 0 ||
release.brevTemplateSha256.some((sha256) => !SHA256_PATTERN.test(sha256)) ||
(release.featureGateTemplateSha256 !== undefined &&
(release.featureGateTemplateSha256.length === 0 ||
release.featureGateTemplateSha256.some((sha256) => !SHA256_PATTERN.test(sha256)))) ||
release.sandboxBuilds.some((pin) => !SHA256_PATTERN.test(pin.sha256))
) {
fail(`trusted OpenShell v${release.version} template or sandbox record is invalid`);
Expand Down Expand Up @@ -1764,15 +1771,14 @@ function parseCliOptions(argv: string[]): CliOptions {
return { blueprint, brevInstaller, format, installer, supervisorRuntime };
}

function runCli(): void {
const options = parseCliOptions(process.argv.slice(2));
const blueprintSource = readInstallerInput(options.blueprint, "blueprint");
const installerSource = readInstallerInput(options.installer, "installer");
const brevInstallerSource = readInstallerInput(options.brevInstaller, "Brev launchable");
const supervisorRuntimeSource = readInstallerInput(
options.supervisorRuntime,
"supervisor runtime",
);
export function validateInstallerSources(sources: {
blueprintSource: string;
installerSource: string;
brevInstallerSource: string;
supervisorRuntimeSource: string;
}) {
const { blueprintSource, installerSource, brevInstallerSource, supervisorRuntimeSource } =
sources;
const installerPins = extractInstallerPins(installerSource, {
functionName: "openshell_pinned_sha256",
sourceLabel: "installer",
Expand Down Expand Up @@ -1851,6 +1857,65 @@ function runCli(): void {
fail(`installer pin-table release ${releaseVersion} must match ${label} ${runtimeVersion}`);
}
}
return { releaseVersion, pins, installerReleases, installerTemplateSha256, brevTemplateSha256 };
}

/** Validate the host feature-check module before protected E2E adopts its template. */
export function validateOpenShellFeatureGateSource(source: string, releaseVersion: string): void {
const release = trustedRelease(releaseVersion);
if (Buffer.byteLength(source) > MAX_INSTALLER_INPUT_BYTES || source.includes("\0")) {
fail("feature gate source is invalid or too large");
}
const header = "const PINNED_SANDBOX_BUILD_VERSIONS = new Map<string, string>([\n";
const start = source.indexOf(header);
if (start < 0 || source.indexOf(header, start + header.length) !== -1) {
fail("feature gate must contain one literal sandbox build map");
}
const bodyStart = start + header.length;
const end = source.indexOf("\n]);", bodyStart);
if (end < 0) fail("feature gate sandbox build map is unterminated");
const pins = source
.slice(bodyStart, end)
.split("\n")
.flatMap((line) => {
if (/^ \/\/[^\r\n]*$/u.test(line)) return [];
const match = /^ \["([a-f0-9]{64})", "([0-9]+\.[0-9]+\.[0-9]+)"\],$/u.exec(line);
if (!match) fail("feature gate sandbox build map must contain only literal pins");
return [{ sha256: match[1]!, version: match[2]! }];
});
const allowed = new Set(
TRUSTED_OPENSHELL_RELEASES.flatMap((record) =>
record.sandboxBuilds.map((pin) => `${record.version}:${pin.sha256}`),
),
);
const actual = new Set(pins.map((pin) => `${pin.version}:${pin.sha256}`));
if (
new Set(pins.map((pin) => pin.sha256)).size !== pins.length ||
pins.some((pin) => !allowed.has(`${pin.version}:${pin.sha256}`)) ||
release.sandboxBuilds.length === 0 ||
release.sandboxBuilds.some((pin) => !actual.has(`${releaseVersion}:${pin.sha256}`))
) {
fail(
"feature gate sandbox identities must be unique, base-trusted and include the selected release",
);
}
const normalized =
source.slice(0, bodyStart) + "<normalized-sandbox-build-pins>" + source.slice(end);
const digest = createHash("sha256").update(normalized).digest("hex");
if (!release.featureGateTemplateSha256?.includes(digest)) {
fail(`feature gate operational template is not base-trusted; actual_sha256=${digest}`);
}
}

function runCli(): void {
const options = parseCliOptions(process.argv.slice(2));
const { pins, installerReleases, installerTemplateSha256, brevTemplateSha256 } =
validateInstallerSources({
blueprintSource: readInstallerInput(options.blueprint, "blueprint"),
installerSource: readInstallerInput(options.installer, "installer"),
brevInstallerSource: readInstallerInput(options.brevInstaller, "Brev launchable"),
supervisorRuntimeSource: readInstallerInput(options.supervisorRuntime, "supervisor runtime"),
});
if (options.format === "json") {
process.stdout.write(
`${JSON.stringify(
Expand Down
Loading
Loading