Skip to content
Closed
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
48 changes: 39 additions & 9 deletions .github/workflows/regression-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -336,28 +336,58 @@ jobs:
github.repository == 'NVIDIA/NemoClaw' &&
needs.select_regression_jobs.outputs.model_router_provider_routed_inference == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: "22"
cache: npm

- name: Install root dependencies
run: npm ci --ignore-scripts

- name: Build CLI
run: npm run build:cli

- name: Run Model Router provider-routed inference E2E test
- name: Install OpenShell
env:
NEMOCLAW_NON_INTERACTIVE: "1"
run: |
set -euo pipefail
bash scripts/install-openshell.sh
echo "${HOME}/.local/bin" >> "$GITHUB_PATH"

- name: Run Model Router provider-routed inference Vitest E2E test
env:
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
NEMOCLAW_NON_INTERACTIVE: "1"
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1"
run: bash test/e2e/test-model-router-provider-routed-inference.sh
NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js
NEMOCLAW_RUN_E2E_SCENARIOS: "1"
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/vitest/model-router-provider-routed-inference
run: |
set -euo pipefail
npx vitest run --project e2e-scenarios-live \
test/e2e-scenario/live/model-router-provider-routed-inference.test.ts \
--silent=false --reporter=default

- name: Upload Model Router provider-routed inference logs on failure
if: failure()
- name: Upload Model Router provider-routed inference artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: model-router-provider-routed-inference-logs
path: |
/tmp/nemoclaw-e2e-model-router-onboard.log
/tmp/nemoclaw-e2e-model-router-health.log
/tmp/nemoclaw-e2e-model-router-response.log
name: model-router-provider-routed-inference-artifacts
path: e2e-artifacts/vitest/model-router-provider-routed-inference/
include-hidden-files: false
if-no-files-found: ignore
retention-days: 14

# ── OpenClaw plugin runtime-deps EXDEV E2E ─────────────────────
# Coverage guard for #3513 / #3127. On Ubuntu/OpenShell sandbox layouts
Expand Down
4 changes: 2 additions & 2 deletions test/e2e-scenario-advisor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ describe("Vitest E2E scenario advisor — prompt construction", () => {
const prompt = buildPrompt({
baseRef: "origin/main",
headRef: "HEAD",
changedFiles: ["test/e2e-scenario/framework/phases/onboarding.ts"],
changedFiles: ["test/e2e-scenario/fixtures/phases/onboarding.ts"],
diff: "+ echo ok",
});
// Caller of normalizeScenarioAdvisorResult re-injects metadata, but the
// prompt must still surface enough context for the model to reason.
expect(prompt).toContain("origin/main");
expect(prompt).toContain("test/e2e-scenario/framework/phases/onboarding.ts");
expect(prompt).toContain("test/e2e-scenario/fixtures/phases/onboarding.ts");
expect(prompt).toContain("+ echo ok");
});

Expand Down
21 changes: 15 additions & 6 deletions test/e2e-scenario/docs/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The scenario runner cutover is complete:
- `e2e-vitest-scenarios.yaml` is the scenario workflow.
- `test/e2e-scenario/live/registry-scenarios.test.ts` is the registry-driven
live scenario entrypoint.
- `test/e2e-scenario/framework/` owns phase fixtures, clients, artifact
- `test/e2e-scenario/fixtures/` owns phase fixtures, clients, artifact
capture, redaction, cleanup, and shell-probe bridges.
- `test/e2e-scenario/scenarios/run.ts` only lists scenarios and emits the live
Vitest matrix.
Expand All @@ -44,8 +44,8 @@ The durable E2E system has one execution path:
- NemoClaw fixtures own setup, onboarding, lifecycle mutations,
expected-state probes, assertion helpers, expected-failure evidence,
cleanup, artifacts, and secret redaction.
- The historical `test/e2e-scenario/framework/` path is fixture/support code,
not a separate E2E framework or runner.
- `test/e2e-scenario/fixtures/` is fixture/support code, not a test harness
or runner.
- Typed scenario definitions and matrix helpers describe stable scenario IDs
and supported combinations without becoming a second runner.
- Product-facing manifests describe desired setup/onboarding state, not test
Expand All @@ -64,9 +64,18 @@ The useful deletion invariant is smaller:
> A PR that deletes a legacy E2E script must show the replacement Vitest
> coverage or explain the retirement rationale.

Record that evidence in the PR body and linked issue. The evidence should name
the legacy contract, the replacement Vitest coverage, any intentionally retired
behavior, and the verification that preserves fidelity.
Record that evidence in the PR body, which is the machine-checkable boundary for
the deletion. Link or summarize that PR evidence from the issue when useful. For
each deleted script, include a `Legacy E2E deletion evidence` block with:

- `Script:` the deleted `test/e2e/test-*.sh` path.
- `Legacy contract:` the observable behavior the shell script protected.
- `Replacement Vitest coverage:` an existing `.test.ts` path, or `Retirement
rationale:` when the behavior is intentionally retired instead of replaced.
- `Intentionally retired behavior:` any assertions, probes, or workflow hooks
that are deliberately not preserved.
- `Fidelity verification:` the command, CI check, or review evidence proving the
Vitest coverage keeps the same contract value.

## Migration Pattern

Expand Down
16 changes: 9 additions & 7 deletions test/e2e-scenario/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# NemoClaw E2E Vitest Fixtures

NemoClaw E2E now has one target execution model: **Vitest as the harness** and
NemoClaw E2E now has one target execution model, Vitest as the harness and
GitHub Actions as the matrix. Vitest owns discovery, filtering, timeouts,
reporters, fixture lifecycle, skips, and CI integration. NemoClaw owns the
domain layer: scenario metadata, phase fixtures, product clients, evidence
Expand All @@ -25,7 +25,7 @@ runner cutover; migrate them by contract using the rules in `MIGRATION.md`.
| Live scenario IDs and metadata | `test/e2e-scenario/scenarios/registry.ts`, `test/e2e-scenario/scenarios/scenarios/baseline.ts` |
| GitHub Actions matrix emission | `test/e2e-scenario/scenarios/run.ts --emit-live-matrix` |
| Live scenario execution | `test/e2e-scenario/live/registry-scenarios.test.ts` |
| Phase fixtures and clients | `test/e2e-scenario/framework/` |
| Phase fixtures and clients | `test/e2e-scenario/fixtures/` |
| Expected-state probes | `test/e2e-scenario/scenarios/expected-states.ts` |
| Product-facing setup/onboarding state | `test/e2e-scenario/manifests/*.yaml` |
| Legacy direct E2E coverage | `test/e2e/test-*.sh` and their workflows |
Expand All @@ -52,8 +52,8 @@ Live execution happens through Vitest fixtures:
- `artifacts`, `secrets`, `cleanup`, and `shellProbe` provide shared fixture
services.

The historical `test/e2e-scenario/framework/` path is a fixture/support layer,
not a separate E2E framework or runner. Vitest remains the only test harness.
The `test/e2e-scenario/fixtures/` path is fixture/support code, not a test
harness or runner. Vitest remains the only test harness.

`suiteIds` remain metadata for reporting and migration planning. They do not
dispatch shell validation suites.
Expand Down Expand Up @@ -86,7 +86,7 @@ paths must not be reintroduced.
```text
test/e2e-scenario/
docs/ # Fixture guide, migration notes, retirement record
framework/ # Vitest fixtures, clients, redaction, artifacts, cleanup
fixtures/ # Vitest fixtures, clients, redaction, artifacts, cleanup
live/ # Opt-in live Vitest scenario tests
manifests/ # Product-facing NemoClawInstance desired state
scenarios/ # Typed registry, matrix helpers, expected states
Expand Down Expand Up @@ -121,8 +121,10 @@ GitHub issues and PRs own changing migration status. The key issues are:
The former repo-local `legacy-inventory.json` ledger and generated legacy
assertion inventories are removed because they duplicated live GitHub state and
drifted quickly. A PR that deletes a legacy E2E script must show the replacement
Vitest coverage or explain the retirement rationale in the PR body and linked
issue.
Vitest coverage or explain the retirement rationale in a per-script PR-body
`Legacy E2E deletion evidence` block, with the legacy contract, intentionally
retired behavior, and fidelity verification kept next to the deletion. The
replacement coverage path must point at an existing `.test.ts` file.

Prefer new E2E coverage in Vitest fixtures. When shell, installer, process,
platform, or full user-flow behavior is the contract, invoke that real boundary
Expand Down
2 changes: 1 addition & 1 deletion test/e2e-scenario/docs/RETIREMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ and artifact shape operators needed from the retired workflows:
- `.github/workflows/e2e-vitest-scenarios.yaml` runs the live matrix.
- `test/e2e-scenario/live/registry-scenarios.test.ts` executes supported
registry scenarios through Vitest.
- `test/e2e-scenario/framework/` owns fixtures, clients, shell-probe bridges,
- `test/e2e-scenario/fixtures/` owns fixtures, clients, shell-probe bridges,
artifact writing, cleanup, and redaction.

## What Was Not Removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export function buildAvailabilityProbeEnv(
): NodeJS.ProcessEnv {
// Availability probes run outside live scenario phases, but they need
// the same child-env and PATH policy. Add only Docker
// discovery knobs on top of the shared framework boundary.
// discovery knobs on top of the shared fixture boundary.
return buildChildEnv(base, {
additionalAllowedEnv: AVAILABILITY_PROBE_EXTRA_ENV_KEYS,
frameworkOverlay: {},
fixtureOverlay: {},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface TrustedProviderEndpoint {

export interface TrustedProviderEndpointOptions {
/**
* Static framework-owned trust configuration for external HTTPS provider
* Static fixture-owned trust configuration for external HTTPS provider
* endpoints. Do not populate this from scenario manifests or user input.
*/
allowedHosts?: readonly string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class LifecyclePhaseFixture {
// Final step: drive the user-visible action that exposed #4423.
// We invoke status through the host CLI client so artifacts are
// captured and the command goes through the same
// shellProbe/redaction layer the rest of the framework uses.
// shellProbe/redaction layer the rest of the fixture code uses.
// Status is allowed to fail (exit non-zero) because on unfixed
// code it intentionally fails after destroying state — the
// post-action invariants are checked by state-validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { ExpectedState, StateProbeId } from "../../scenarios/types.ts";
import type { NemoClawInstance } from "./onboarding.ts";

// Mirror of `src/lib/state/registry.ts::REGISTRY_FILE`. The fixture
// owns its own copy because the framework code must not import from
// owns its own copy because the fixture code must not import from
// `src/lib/**` (CLI source) — that boundary keeps the live runner
// honest about probing only host-observable state.
const NEMOCLAW_REGISTRY_RELPATH = [".nemoclaw", "sandboxes.json"] as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0

/**
* Framework-owned secret hygiene at the spawn boundary.
* Fixture-owned secret hygiene at the spawn boundary.
*
* Spec ownership: redaction and child-env minimization are FRAMEWORK
* Spec ownership: redaction and child-env minimization are FIXTURE
* INFRASTRUCTURE, not a per-action / per-script / per-workflow concern.
* Children spawned by framework command boundaries must (a) receive a minimal,
* typed env (framework allowlist + per-action declared `secretEnv`
* Children spawned by fixture command boundaries must (a) receive a minimal,
* typed env (fixture allowlist + per-action declared `secretEnv`
* passthrough only), and (b) have their stdout/stderr passed through
* redaction before any byte reaches an evidence log or
* PhaseResult.message. There is no opt-out flag, no env switch, no
Expand All @@ -16,26 +16,26 @@
* rest of this PR.
*
* Pattern source-of-truth: src/lib/security/secret-patterns.ts. We
* import the canonical regex sets and apply them here so framework
* import the canonical regex sets and apply them here so fixture-layer
* redaction stays in lockstep with product-runtime redaction without
* coupling the framework to product runtime modules.
* coupling the fixture layer to product runtime modules.
*
* Tests:
* test/e2e-scenario/support-tests/e2e-redaction-entry.test.ts
* test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts
* test/e2e-scenario/support-tests/e2e-phase-environment.test.ts
* - canonical token redaction parity with product runtime patterns
* - explicit per-test redaction values
* - child-env allowlist filtering for framework probes
* - child-env allowlist filtering for fixture probes
*/

import type { Readable, Writable } from "node:stream";

const REDACTED = "<REDACTED>";
const EXPLICIT_REDACTED = "[REDACTED]";

// Framework-local mirror of src/lib/security/secret-patterns.ts. The
// framework deliberately does not import from src/lib/security/ so it
// Fixture-local mirror of src/lib/security/secret-patterns.ts. The
// fixture layer deliberately does not import from src/lib/security/ so it
// stays decoupled from product runtime modules and the cross-tsconfig
// boundary. A parity test
// (test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts)
Expand All @@ -46,7 +46,7 @@ const EXPLICIT_REDACTED = "[REDACTED]";
// (test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts) can
// import the actual RegExp values rather than parsing source text.
// Production code in this module continues to use them via the local
// binding; nothing in the framework runtime imports these.
// binding; nothing in the fixture runtime imports these.
export const TOKEN_PREFIX_PATTERNS: RegExp[] = [
/nvapi-[A-Za-z0-9_-]{10,}/g,
/nvcf-[A-Za-z0-9_-]{10,}/g,
Expand Down Expand Up @@ -110,11 +110,11 @@ export function redactString(text: string, explicitValues?: Iterable<string>): s
return out;
}

// Env keys the framework guarantees children may always see. Anything
// outside this set, outside FRAMEWORK_ENV_PREFIXES, and not declared
// Env keys the fixture layer guarantees children may always see. Anything
// outside this set, outside FIXTURE_ENV_PREFIXES, and not declared
// in PhaseAction.secretEnv / AssertionStep.secretEnv is dropped before
// the child spawns.
const FRAMEWORK_ENV_ALLOWLIST: ReadonlySet<string> = new Set([
const FIXTURE_ENV_ALLOWLIST: ReadonlySet<string> = new Set([
"PATH",
"HOME",
"SHELL",
Expand All @@ -134,12 +134,12 @@ const FRAMEWORK_ENV_ALLOWLIST: ReadonlySet<string> = new Set([
"NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE",
]);

const FRAMEWORK_ENV_PREFIXES: readonly string[] = ["E2E_", "NEMOCLAW_LOG_"];
const FIXTURE_ENV_PREFIXES: readonly string[] = ["E2E_", "NEMOCLAW_LOG_"];

// Shape required of any declared secretEnv key — must look like a
// secret-bearing variable. Prevents accidental allowlisting of
// non-secret values via the secretEnv channel and keeps the
// "framework-allowlist vs declared-secret" distinction honest.
// "fixture-allowlist vs declared-secret" distinction honest.
const SECRET_ENV_KEY_SHAPE =
/^[A-Z][A-Z0-9_]*(?:API[_]?KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL|PASSPHRASE|PRIVATE[_]?KEY|ACCESS[_]?KEY)$/;

Expand All @@ -150,20 +150,20 @@ export function isValidSecretEnvKey(key: string): boolean {
export interface BuildChildEnvOptions {
/** Per-action / per-step declared secret-bearing env keys to pass through. */
secretEnv?: readonly string[];
/** Additional non-secret env keys required by a framework-owned spawn helper. */
/** Additional non-secret env keys required by a fixture-owned spawn helper. */
additionalAllowedEnv?: readonly string[];
/** Framework-controlled overlay (E2E_CONTEXT_DIR, E2E_PHASE, E2E_*_ID). */
frameworkOverlay: NodeJS.ProcessEnv;
/** Fixture-controlled overlay (E2E_CONTEXT_DIR, E2E_PHASE, E2E_*_ID). */
fixtureOverlay: NodeJS.ProcessEnv;
}

/**
* Build the child's env from `base` (typically `process.env`) by
* keeping only:
* 1. keys in FRAMEWORK_ENV_ALLOWLIST
* 2. keys starting with one of FRAMEWORK_ENV_PREFIXES
* 1. keys in FIXTURE_ENV_ALLOWLIST
* 2. keys starting with one of FIXTURE_ENV_PREFIXES
* 3. non-secret keys explicitly declared in `opts.additionalAllowedEnv`
* 4. keys explicitly declared in `opts.secretEnv` (validated shape)
* then layering `opts.frameworkOverlay` on top.
* then layering `opts.fixtureOverlay` on top.
*
* Throws if a `secretEnv` entry doesn't match the secret-key shape;
* better to fail loudly at compile/runtime than silently leak a
Expand All @@ -176,11 +176,11 @@ export function buildChildEnv(
const out: NodeJS.ProcessEnv = {};
for (const [key, value] of Object.entries(base)) {
if (value === undefined) continue;
if (FRAMEWORK_ENV_ALLOWLIST.has(key)) {
if (FIXTURE_ENV_ALLOWLIST.has(key)) {
out[key] = value;
continue;
}
if (FRAMEWORK_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))) {
if (FIXTURE_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))) {
out[key] = value;
continue;
}
Expand Down Expand Up @@ -208,14 +208,14 @@ export function buildChildEnv(
out[key] = base[key];
}
}
Object.assign(out, opts.frameworkOverlay);
Object.assign(out, opts.fixtureOverlay);
// The install action drops nemoclaw / openshell shims under
// ~/.local/bin (the historical repo-current install location).
// On Ubuntu GH runners ~/.local/bin is on the default PATH; on
// self-hosted GPU runners and inside WSL it often is not, so the
// onboarding action's child runs without nemoclaw on PATH and
// dies with 'nemoclaw: command not found'. Add ~/.local/bin to
// every child's PATH at the framework boundary so the install
// every child's PATH at the fixture boundary so the install
// location is consistent across phases. Idempotent equivalent of
// the install-path-refresh.sh nemoclaw_ensure_local_bin_on_path
// helper, applied centrally instead of per-script.
Expand Down Expand Up @@ -250,15 +250,15 @@ export function pipeRedacted(
}

/**
* Compact array of all framework env keys the child sees by default.
* Compact array of all fixture env keys the child sees by default.
* Exported for tests/diagnostics; do not use to bypass the boundary.
*/
export function frameworkEnvAllowlistSnapshot(): {
export function fixtureEnvAllowlistSnapshot(): {
keys: string[];
prefixes: string[];
} {
return {
keys: [...FRAMEWORK_ENV_ALLOWLIST].sort(),
prefixes: [...FRAMEWORK_ENV_PREFIXES],
keys: [...FIXTURE_ENV_ALLOWLIST].sort(),
prefixes: [...FIXTURE_ENV_PREFIXES],
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const SENSITIVE_NAME_PATTERN = /(api[_-]?key|token|secret|password|credential)/i
*
* Holds the per-test view of `process.env` and lets fixtures discover
* sensitive values by name. Redaction itself is owned by the canonical
* entry point in framework/redaction.ts; this class only
* entry point in fixtures/redaction.ts; this class only
* supplies the explicit values it knows about and delegates. There is
* no separate fixture redaction pattern source.
*/
Expand Down
Loading
Loading