Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 7 additions & 4 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1260,10 +1260,13 @@ No PR E2E controller dispatches the risk plan.
The `full-e2e` target enforces a separate hard acceptance contract for the
first fresh onboarding path in that job. It measures from the onboard root span
(a conservative anchor before wizard step `[1/8]`) through the first non-empty
agent response, requires the local BuildKit prebuild for the NemoClaw-generated
context without a gateway-builder fallback, enforces the calibrated root and
phase limits in the budget file, and limits the longest onboard output gap to
60 seconds. A violation fails
agent response and reads the registered workload receipt. A `legacy-dockerfile`
receipt requires the local BuildKit prebuild without a gateway-builder fallback.
A `managed-image` receipt instead requires an exact digest that matches the
registered sandbox image tag, a non-empty publication cohort, and an exact
40-character source revision, and it forbids a local BuildKit prebuild. Both
paths enforce the calibrated root and phase limits in the budget file and limit
the longest onboard output gap to 60 seconds. A violation fails
`full-e2e`, and the target writes its evidence to `onboard-progress-budget.json`.
The artifact records the first-turn command wall clock and OpenClaw's internal
agent duration separately. Older or malformed OpenClaw output records an
Expand Down
91 changes: 91 additions & 0 deletions test/e2e/live/full-e2e-workload-evidence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

export type FullE2eColdWorkloadEvidence =
| {
readonly kind: "legacy-dockerfile";
readonly reference: string | null;
}
| {
readonly kind: "managed-image";
readonly reference: string;
readonly sourceCohort: string;
readonly sourceRevision: string;
};

function record(value: unknown, label: string): Record<string, unknown> {
if (typeof value !== "object" || value === null || Array.isArray(value)) {
throw new Error(`${label} must be an object`);
}
return value as Record<string, unknown>;
}

function nonEmptyString(value: unknown): value is string {
return typeof value === "string" && value.trim().length > 0;
}

export function resolveFullE2eColdWorkloadEvidence(input: {
readonly registry: unknown;
readonly sandboxName: string;
readonly usedBuildKitPrebuild: boolean;
}): FullE2eColdWorkloadEvidence {
const registry = record(input.registry, "sandbox registry");
const sandboxes = record(registry.sandboxes, "sandbox registry sandboxes");
const sandbox = record(sandboxes[input.sandboxName], `sandbox registry row ${input.sandboxName}`);
const workload = record(sandbox.workload, `sandbox workload receipt ${input.sandboxName}`);

if (workload.schemaVersion !== 1) {
throw new Error("sandbox workload receipt must use schema version 1");
}

if (workload.kind === "legacy-dockerfile") {
if (
workload.shared !== false ||
(workload.reference !== null && !nonEmptyString(workload.reference))
) {
throw new Error("legacy Dockerfile workload receipt is invalid");
}
if (!input.usedBuildKitPrebuild) {
throw new Error("legacy Dockerfile cold onboarding must use the local BuildKit prebuild");
}
return {
kind: "legacy-dockerfile",
reference: workload.reference as string | null,
};
}

if (workload.kind !== "managed-image") {
throw new Error(`unsupported cold onboarding workload kind: ${String(workload.kind)}`);
}
if (workload.shared !== true) {
throw new Error("managed-image workload receipt must be shared");
}
if (
!nonEmptyString(workload.reference) ||
!/^[^@\s]+@sha256:[0-9a-f]{64}$/u.test(workload.reference)
) {
throw new Error("managed-image workload receipt must select an exact digest reference");
}
if (sandbox.imageTag !== workload.reference) {
throw new Error("managed-image workload reference must match the registered sandbox image tag");
}
if (!nonEmptyString(workload.sourceCohort)) {
throw new Error("managed-image workload receipt must identify its publication cohort");
}
if (
!nonEmptyString(workload.sourceRevision) ||
!/^[0-9a-f]{40}$/u.test(workload.sourceRevision)
) {
throw new Error("managed-image workload receipt must identify its exact source revision");
}
if (input.usedBuildKitPrebuild) {
throw new Error("managed-image cold onboarding must not use a local BuildKit prebuild");
}

return {
kind: "managed-image",
reference: workload.reference,
sourceCohort: workload.sourceCohort,
sourceRevision: workload.sourceRevision,
};
}
10 changes: 9 additions & 1 deletion test/e2e/live/full-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
fullE2eInferenceProbeEvidence,
runFullE2eInferenceProbe,
} from "./full-e2e-inference-probe.ts";
import { resolveFullE2eColdWorkloadEvidence } from "./full-e2e-workload-evidence.ts";
import { runOpenClawLaunchReadinessLeaseTurns } from "./launch-agent-turn.ts";
import { bindApprovedPrBaseForBaseImageComparison } from "./pr-base-comparison.ts";

Expand Down Expand Up @@ -263,6 +264,13 @@ async function assertColdOnboardPerformance(input: {
const maxSilenceMs = maximumOutputSilenceMs(traceWindow, input.outputEvents);
const maxSilenceSecs = Math.ceil(maxSilenceMs / 1_000);
const rootEndToInstallCompletionMs = input.installCompletedAtMs - traceWindow.finishedAtMs;
const workload = resolveFullE2eColdWorkloadEvidence({
registry: JSON.parse(
fs.readFileSync(path.join(os.homedir(), ".nemoclaw", "sandboxes.json"), "utf8"),
) as unknown,
sandboxName: SANDBOX_NAME,
usedBuildKitPrebuild,
});

const firstTurnStartedAtMs = Date.now();
const turn = await input.sandbox.execShell(
Expand Down Expand Up @@ -333,13 +341,13 @@ async function assertColdOnboardPerformance(input: {
maxSilenceBudgetSecs: MAX_SILENCE_SECS,
buildKitFallback,
usedBuildKitPrebuild,
workload,
classicBuildSteps,
responseChars,
});

expect(plain, "expected literal wizard step [1/8] in installer output").toContain("[1/8]");
expect(buildKitFallback, "expected no fallback from BuildKit to the gateway builder").toBe(false);
expect(usedBuildKitPrebuild, "expected the cold install to use BuildKit").toBe(true);
expect(classicBuildSteps, "expected no classic per-instruction build steps").toBe(0);
expect(
maxSilenceSecs,
Expand Down
12 changes: 0 additions & 12 deletions test/e2e/live/hermes-gpu-startup-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ export async function assertHermesGpuStartupProof({
expect(installText).not.toContain("Reusing existing Docker-driver gateway");
expect(installText).not.toContain("[reuse] Skipping gateway (running)");
if (gpuRoute === "compatibility-only") {
expect(installText).toContain(
"Recreating OpenShell Docker sandbox container with NVIDIA GPU access",
);
expect(installText).toContain("Docker container mode selected:");
for (const fragment of HERMES_GPU_FALLBACK_DISCLOSURE_FRAGMENTS) {
expect(installText).not.toContain(fragment);
Expand All @@ -65,20 +62,11 @@ export async function assertHermesGpuStartupProof({
for (const fragment of HERMES_GPU_FALLBACK_DISCLOSURE_FRAGMENTS) {
expect(installText).toContain(fragment);
}
expect(installText).toContain(
"Recreating OpenShell Docker sandbox container with NVIDIA GPU access",
);
expect(installText).toContain("Docker container mode selected:");
} else {
expect(installText).toContain(
"Direct sandbox GPU enabled; allowing OpenShell GPU policy enrichment.",
);
expect(installText).not.toContain(
"Recreating OpenShell Docker sandbox container with NVIDIA GPU access",
);
expect(installText).toContain(
"Recreating OpenShell Docker sandbox container with restart-safe startup",
);
expect(installText).toContain(
"Docker container mode selected: persistent sandbox startup command",
);
Expand Down
117 changes: 117 additions & 0 deletions test/e2e/support/full-e2e-workload-evidence.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { describe, expect, it } from "vitest";

import { resolveFullE2eColdWorkloadEvidence } from "../live/full-e2e-workload-evidence";

const MANAGED_REFERENCE = `ghcr.io/nvidia/nemoclaw/openclaw@sha256:${"a".repeat(64)}`;
const SOURCE_REVISION = "b".repeat(40);

function registry(workload: Record<string, unknown>, imageTag: unknown = workload.reference) {
return {
sandboxes: {
"e2e-full": {
imageTag,
workload,
},
},
};
}

describe("full E2E cold workload evidence", () => {
it("requires BuildKit for the registered legacy Dockerfile workload (#9362)", () => {
const evidence = resolveFullE2eColdWorkloadEvidence({
registry: registry({
schemaVersion: 1,
kind: "legacy-dockerfile",
reference: "nemoclaw-sandbox-e2e-full:latest",
shared: false,
}),
sandboxName: "e2e-full",
usedBuildKitPrebuild: true,
});

expect(evidence).toEqual({
kind: "legacy-dockerfile",
reference: "nemoclaw-sandbox-e2e-full:latest",
});
});

it("requires an exact registered digest and no build for managed onboarding (#9362)", () => {
const evidence = resolveFullE2eColdWorkloadEvidence({
registry: registry({
schemaVersion: 1,
kind: "managed-image",
reference: MANAGED_REFERENCE,
sourceCohort: "all-agents-2026-08-17",
sourceRevision: SOURCE_REVISION,
shared: true,
}),
sandboxName: "e2e-full",
usedBuildKitPrebuild: false,
});

expect(evidence).toEqual({
kind: "managed-image",
reference: MANAGED_REFERENCE,
sourceCohort: "all-agents-2026-08-17",
sourceRevision: SOURCE_REVISION,
});
});

it.each([
{
name: "legacy onboarding without BuildKit",
receipt: {
schemaVersion: 1,
kind: "legacy-dockerfile",
reference: "nemoclaw-sandbox-e2e-full:latest",
shared: false,
},
usedBuildKitPrebuild: false,
message: "legacy Dockerfile cold onboarding must use the local BuildKit prebuild",
},
{
name: "managed onboarding with BuildKit",
receipt: {
schemaVersion: 1,
kind: "managed-image",
reference: MANAGED_REFERENCE,
sourceCohort: "all-agents-2026-08-17",
sourceRevision: SOURCE_REVISION,
shared: true,
},
usedBuildKitPrebuild: true,
message: "managed-image cold onboarding must not use a local BuildKit prebuild",
},
])("rejects $name (#9362)", ({ message, receipt, usedBuildKitPrebuild }) => {
expect(() =>
resolveFullE2eColdWorkloadEvidence({
registry: registry(receipt),
sandboxName: "e2e-full",
usedBuildKitPrebuild,
}),
).toThrow(message);
});

it("rejects a managed receipt that does not match the registered image tag (#9362)", () => {
expect(() =>
resolveFullE2eColdWorkloadEvidence({
registry: registry(
{
schemaVersion: 1,
kind: "managed-image",
reference: MANAGED_REFERENCE,
sourceCohort: "all-agents-2026-08-17",
sourceRevision: SOURCE_REVISION,
shared: true,
},
`ghcr.io/nvidia/nemoclaw/openclaw@sha256:${"c".repeat(64)}`,
),
sandboxName: "e2e-full",
usedBuildKitPrebuild: false,
}),
).toThrow("managed-image workload reference must match the registered sandbox image tag");
});
});
Loading