Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
297 changes: 297 additions & 0 deletions .github/workflows/e2e.yaml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions ci/source-shape-test-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@
"test": "routes only the measured heavy lanes on trusted main (#7145)",
"category": "security"
},
{
"file": "test/e2e/support/trusted-hermes-swap-workflow-boundary.test.ts",
"test": "keeps the fixed privileged program before candidate checkout in every protected job (#7145)",
"category": "security"
},
{
"file": "test/fetch-guard-patch-regression.test.ts",
"test": "requires classifier review and integrity evidence when the OpenClaw build pin changes",
Expand Down
46 changes: 36 additions & 10 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,41 @@ standard runners even though they use the trusted workflow definition from
`main`.

Exact-head PR-gate dispatches use a bounded swap fallback for the hosted
Hermes image-building lanes that remain on those standard runners. The live
Vitest helper activates the fallback only when GitHub Actions supplies a
validated lowercase 40-hex checkout SHA. It reuses at least 32 GiB of active
swap when available; otherwise, it creates one fixed 32 GiB swap file under
`/mnt` before agent-turn latency, Hermes inference switch and shields, the
Hermes Bedrock and stable MCP shards, or the `hermes-e2e`, `hermes-dashboard`,
and Hermes security-posture tests. Setup failure stops before Vitest. Scheduled
and ordinary manual `main` runs, larger-runner executions, rebuild lanes with
Hermes image-building lanes that remain on those standard runners. The trusted
workflow provisions the fallback as the first job step, before checking out or
executing the candidate revision. It requires a controller-supplied lowercase
40-hex checkout SHA, matching trusted workflow and dispatch revisions, and an
ephemeral GitHub-hosted Linux x64 runner.

The trusted step requires at least 32 GiB (34,359,738,368 bytes) of usable swap.
It reuses active swap that meets this requirement.
Otherwise, it preserves at least 16 GiB of available disk capacity under
`/mnt`, creates a root-owned mode-`0700` directory, and creates an exclusive
randomized mode-`0600` file.
The file allocation is 32 GiB plus 4,096 bytes (34,359,742,464 bytes).
The additional 4,096 bytes keep the usable swap capacity at or above 32 GiB
after formatting.
Setup failure stops before candidate checkout and removes partial state only
after proving the file inactive or successfully disabling it.
Successful state is discarded with the ephemeral runner.

This rollout adds the trusted pre-checkout setup.
During rollout, the PR temporarily retains the reviewed live Vitest helper.
The helper exists only because the PR must validate against the older workflow
definition on `main` before this change lands.
The compatibility path runs only when GitHub Actions supplies a validated
lowercase 40-hex checkout SHA.
When the trusted step already provides 32 GiB of usable swap, the helper exits
before it creates its fixed swap file.
A follow-up must remove the candidate-side helper and its compatibility tests
after this change lands.

The fallback covers agent-turn latency, Hermes inference switch and shields,
the Hermes Bedrock and stable MCP shards, and the `hermes-e2e`,
`hermes-dashboard`, and Hermes security-posture tests. Scheduled and ordinary
manual `main` runs, larger-runner executions, rebuild lanes with
workflow-managed swap, dedicated-runner lanes, `mcp-bridge-dev`, and non-Hermes
shards do not use this fallback.
shards do not use it.

The fallback exists because the alternate-checkout trust boundary deliberately
keeps PR-authored code from selecting the administrator-managed larger-runner
Expand Down Expand Up @@ -709,7 +734,8 @@ provisions the same swap file on GitHub Actions when a trusted control-plane
run uses the workflow definition from `main`. Those paths build large Hermes
image layers and can otherwise exhaust the runner's default memory and swap
during Docker layer export. Other E2E jobs keep the standard runner memory
configuration.
configuration except for the exact-head Hermes PR-gate fallback described in
[Larger-runner routing](#larger-runner-routing).

These assertions run inside the existing `full-e2e` lifecycle instead of a
second standalone onboarding run. This keeps the measurement on the job's first
Expand Down
12 changes: 8 additions & 4 deletions test/e2e/support/live-vitest-invocation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
buildLiveVitestArgs,
HERMES_E2E_SWAP_BYTES,
HERMES_E2E_SWAP_FILE,
HERMES_E2E_SWAP_FILE_BYTES,
HERMES_E2E_SWAP_SCRIPT,
LIVE_VITEST_PROJECT,
type LiveVitestSpawner,
Expand Down Expand Up @@ -107,6 +108,7 @@ function runHermesSwapScriptFailure(options: FakeSwapScriptOptions = {}): FakeSw
"hermes-e2e-swap-test",
HERMES_E2E_SWAP_FILE,
String(HERMES_E2E_SWAP_BYTES),
String(HERMES_E2E_SWAP_FILE_BYTES),
],
{
encoding: "utf8",
Expand Down Expand Up @@ -377,6 +379,7 @@ describe("runLiveVitestCommand Hermes resource setup (#7145)", () => {
expect(calls).toHaveLength(2);
expect(calls[0]?.[0]).toBe("/usr/bin/sudo");
expect(HERMES_E2E_SWAP_BYTES).toBe(34_359_738_368);
expect(HERMES_E2E_SWAP_FILE_BYTES).toBe(34_359_742_464);
expect(HERMES_E2E_SWAP_FILE).toBe("/mnt/nemoclaw-hermes-e2e.swap");
expect(calls[0]?.[1].slice(0, 9)).toEqual([
"-n",
Expand All @@ -393,14 +396,15 @@ describe("runLiveVitestCommand Hermes resource setup (#7145)", () => {
"nemoclaw-hermes-e2e-swap",
HERMES_E2E_SWAP_FILE,
String(HERMES_E2E_SWAP_BYTES),
String(HERMES_E2E_SWAP_FILE_BYTES),
]);
const script = calls[0]?.[1][9] ?? "";
expect(
spawnSync("/bin/bash", ["--noprofile", "--norc", "-n"], {
input: script,
}).status,
).toBe(0);
expect(script).toContain("if (( active_swap_bytes >= swap_size_bytes )); then");
expect(script).toContain("if (( active_swap_bytes >= required_swap_bytes )); then");
expect(script).toContain(
'active_swap_names="$(swapon --show --noheadings --raw --output NAME)"',
);
Expand All @@ -416,8 +420,8 @@ describe("runLiveVitestCommand Hermes resource setup (#7145)", () => {
expect(script).toContain("Preserving Hermes E2E swap because active swap could not be queried");
expect(script).not.toContain('swapoff "$swap_file" 2>/dev/null || true');
expect(script).not.toContain("swap_enabled");
expect(script).toContain('fallocate -l "$swap_size_bytes" "$swap_file"');
expect(script).toContain("if (( active_swap_bytes < swap_size_bytes )); then");
expect(script).toContain('fallocate -l "$swap_file_bytes" "$swap_file"');
expect(script).toContain("if (( active_swap_bytes < required_swap_bytes )); then");
expect(calls[1]?.[0]).toBe("npx");
});

Expand Down Expand Up @@ -472,7 +476,7 @@ describe("HERMES_E2E_SWAP_SCRIPT failure cleanup (#7145)", () => {
"swapon:--show --noheadings --raw --output NAME",
"swapon-name-query:1:inactive",
`rm:-f -- ${HERMES_E2E_SWAP_FILE}`,
`fallocate:-l ${HERMES_E2E_SWAP_BYTES} ${HERMES_E2E_SWAP_FILE}`,
`fallocate:-l ${HERMES_E2E_SWAP_FILE_BYTES} ${HERMES_E2E_SWAP_FILE}`,
`chmod:0600 ${HERMES_E2E_SWAP_FILE}`,
`mkswap:${HERMES_E2E_SWAP_FILE}`,
`swapon:${HERMES_E2E_SWAP_FILE}`,
Expand Down
Loading
Loading