From ba4bb37882e33b3c542fe9c6b0e341ae4f38c61c Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:02:38 -0400 Subject: [PATCH 01/22] test(e2e): add skill agent Vitest coverage --- test/e2e-scenario/live/skill-agent.test.ts | 280 +++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 test/e2e-scenario/live/skill-agent.test.ts diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts new file mode 100644 index 00000000000..19e1d2da0e4 --- /dev/null +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -0,0 +1,280 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import fs from "node:fs"; +import path from "node:path"; + +import { buildAvailabilityProbeEnv } from "../fixtures/availability-env.ts"; +import { type SandboxClient, trustedSandboxShellScript } from "../fixtures/clients/sandbox.ts"; +import { expect, test } from "../fixtures/e2e-test.ts"; +import { shouldRunLiveE2EScenarios } from "../fixtures/live-project-gate.ts"; + +// Focused Vitest live replacement coverage for test/e2e/test-skill-agent-e2e.sh. +// Keep this as a direct live test: the legacy contract is skill fixture +// injection into a real OpenClaw sandbox plus an agent turn that must read +// SKILL.md and return the verification token. The retained legacy bash lane +// remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. + +const REPO_ROOT = path.resolve(import.meta.dirname, "../../.."); +const CLI_ENTRYPOINT = path.join(REPO_ROOT, "bin", "nemoclaw.js"); +const ADD_SKILL_SCRIPT = path.join( + REPO_ROOT, + "test", + "e2e", + "e2e-cloud-experimental", + "features", + "skill", + "add-sandbox-skill.sh", +); +const VERIFY_SKILL_SCRIPT = path.join( + REPO_ROOT, + "test", + "e2e", + "e2e-cloud-experimental", + "features", + "skill", + "verify-sandbox-skill-via-agent.sh", +); +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-skill-agent"; +const SKILL_ID = "skill-smoke-fixture"; +const VERIFY_PHRASE = "SKILL_SMOKE_VERIFY_K9X2"; +const ONBOARD_TIMEOUT_MS = 20 * 60_000; +const AGENT_VERIFY_TIMEOUT_MS = 4 * 60_000; +const MAX_ATTEMPTS = Number.parseInt(process.env.E2E_SKILL_AGENT_MAX_ATTEMPTS ?? "3", 10); +const RETRY_SLEEP_MS = + Number.parseInt(process.env.E2E_SKILL_AGENT_RETRY_SLEEP_SEC ?? "15", 10) * 1_000; + +process.env.NEMOCLAW_CLI_BIN ??= CLI_ENTRYPOINT; + +function resultText(result: { stdout: string; stderr: string }): string { + return [result.stdout, result.stderr].filter(Boolean).join("\n"); +} + +function sleep(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function shellQuote(value: string): string { + return `'${value.replaceAll("'", `'\\''`)}'`; +} + +function isExternalAgentVerificationFlake(text: string): boolean { + return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|tool_search_code failed|describe id must be a string|openclaw\.tools\.[A-Za-z0-9_]+ is not a function|call id must be a string|ReferenceError: require is not defined|ssh\/agent exit 124|exit 124/i.test( + text, + ); +} + +function agentSectionContainsToken(agentOutput: string): boolean { + const match = agentOutput.match(/--- agent stdout\/stderr[\s\S]*?--- end ---/); + if (!match) return false; + const collapsed = match[0].replace(/[\n\r`"']/g, "").toLowerCase(); + return collapsed.includes(VERIFY_PHRASE.toLowerCase()); +} + +async function verifySkillFixturePresent( + sandbox: SandboxClient, + sandboxName: string, +): Promise { + const script = `token=${shellQuote(VERIFY_PHRASE)}; skill=${shellQuote(SKILL_ID)}; found=0; for path in "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md"; do if [ -f "$path" ] && grep -Fq "$token" "$path"; then echo "SKILL_TOKEN_PATH=$path"; found=1; fi; done; test "$found" = 1`; + const result = await sandbox.execShell(sandboxName, trustedSandboxShellScript(script), { + artifactName: "verify-skill-fixture-present", + env: buildAvailabilityProbeEnv(), + timeoutMs: 30_000, + }); + return result.exitCode === 0; +} + +async function ignoreCleanupError(run: () => Promise): Promise { + try { + await run(); + } catch { + // Best-effort cleanup only; the test may be running before OpenShell exists + // or after onboarding already removed part of the runtime state. + } +} + +const runSkillAgentTest = shouldRunLiveE2EScenarios() ? test : test.skip; + +runSkillAgentTest( + "skill-agent: injected sandbox skill is read by a real OpenClaw agent turn", + async ({ artifacts, cleanup, host, sandbox, secrets, skip }) => { + expect( + fs.existsSync(CLI_ENTRYPOINT), + "run `npm run build:cli` before live repo CLI scenarios", + ).toBe(true); + expect(fs.existsSync(ADD_SKILL_SCRIPT), `missing skill add helper: ${ADD_SKILL_SCRIPT}`).toBe( + true, + ); + expect( + fs.existsSync(VERIFY_SKILL_SCRIPT), + `missing skill verify helper: ${VERIFY_SKILL_SCRIPT}`, + ).toBe(true); + + const docker = await host.command("docker", ["info"], { + artifactName: "prereq-docker-info-skill-agent", + env: buildAvailabilityProbeEnv(), + timeoutMs: 30_000, + }); + if (docker.exitCode !== 0) { + if (process.env.GITHUB_ACTIONS === "true") { + throw new Error(`Docker is required for skill-agent E2E: ${resultText(docker)}`); + } + skip("Docker is required for skill-agent E2E"); + } + + const apiKey = secrets.required("NVIDIA_API_KEY"); + expect(apiKey.startsWith("nvapi-"), "NVIDIA_API_KEY must start with nvapi-").toBe(true); + + await artifacts.writeJson("scenario.json", { + id: "skill-agent", + runner: "vitest", + boundary: "direct-cli-onboard-sandbox-skill-and-agent-turn", + legacySource: "test/e2e/test-skill-agent-e2e.sh", + contract: [ + "Docker is available before onboarding", + "NVIDIA_API_KEY is present and nvapi-prefixed", + "nemoclaw onboard creates/recreates a real OpenClaw sandbox", + "skill-smoke-fixture is injected into sandbox and home skill roots", + "openclaw agent reads SKILL.md and returns SKILL_SMOKE_VERIFY_K9X2", + "provider/tool-call transport flakes only skip after the skill fixture is proven present", + ], + }); + + const cleanupEnv = buildAvailabilityProbeEnv(); + await ignoreCleanupError(() => + host.command("node", [CLI_ENTRYPOINT, SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "pre-cleanup-nemoclaw-destroy-skill-agent", + env: cleanupEnv, + timeoutMs: 120_000, + }), + ); + await ignoreCleanupError(() => + sandbox.openshell(["sandbox", "delete", SANDBOX_NAME], { + artifactName: "pre-cleanup-openshell-sandbox-delete-skill-agent", + env: cleanupEnv, + timeoutMs: 60_000, + }), + ); + + cleanup.add(`destroy skill-agent sandbox ${SANDBOX_NAME}`, async () => { + await ignoreCleanupError(() => + host.command("node", [CLI_ENTRYPOINT, SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "cleanup-nemoclaw-destroy-skill-agent", + env: buildAvailabilityProbeEnv(), + timeoutMs: 120_000, + }), + ); + await ignoreCleanupError(() => + sandbox.openshell(["sandbox", "delete", SANDBOX_NAME], { + artifactName: "cleanup-openshell-sandbox-delete-skill-agent", + env: buildAvailabilityProbeEnv(), + timeoutMs: 60_000, + }), + ); + }); + + const onboard = await host.command( + "node", + [ + CLI_ENTRYPOINT, + "onboard", + "--fresh", + "--non-interactive", + "--yes", + "--yes-i-accept-third-party-software", + ], + { + artifactName: "onboard-skill-agent", + env: { + ...buildAvailabilityProbeEnv(), + NVIDIA_API_KEY: apiKey, + NEMOCLAW_AGENT: "openclaw", + NEMOCLAW_PROVIDER: "cloud", + NEMOCLAW_SANDBOX_NAME: SANDBOX_NAME, + NEMOCLAW_RECREATE_SANDBOX: "1", + NEMOCLAW_POLICY_MODE: "skip", + }, + redactionValues: [apiKey], + timeoutMs: ONBOARD_TIMEOUT_MS, + }, + ); + expect(onboard.exitCode, resultText(onboard)).toBe(0); + + const addSkill = await host.command("bash", [ADD_SKILL_SCRIPT], { + artifactName: "add-sandbox-skill-fixture", + cwd: REPO_ROOT, + env: { + ...buildAvailabilityProbeEnv(), + SANDBOX_NAME, + SKILL_ID, + SKILL_DESCRIPTION: "E2E smoke skill injected for agent verification", + }, + timeoutMs: 120_000, + }); + expect(addSkill.exitCode, resultText(addSkill)).toBe(0); + expect(addSkill.stdout).toContain(`QUERY_PATH=/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md`); + expect(addSkill.stdout).toContain("HOME_QUERY_PATH="); + expect(await verifySkillFixturePresent(sandbox, SANDBOX_NAME)).toBe(true); + + let lastAgentOutput = ""; + let agentOk = false; + let lastExitCode: number | null = null; + const attempts = Math.max(1, Number.isFinite(MAX_ATTEMPTS) ? MAX_ATTEMPTS : 3); + + for (let attempt = 1; attempt <= attempts; attempt += 1) { + const verify = await host.command("bash", [VERIFY_SKILL_SCRIPT], { + artifactName: `verify-sandbox-skill-via-agent-${attempt}`, + cwd: REPO_ROOT, + env: { + ...buildAvailabilityProbeEnv(), + NVIDIA_API_KEY: apiKey, + SANDBOX_NAME, + SKILL_ID, + VERIFY_TOKEN: VERIFY_PHRASE, + SKILL_VERIFY_SESSION_ID: `skill-agent-vitest-${process.pid}-${attempt}`, + }, + redactionValues: [apiKey], + timeoutMs: AGENT_VERIFY_TIMEOUT_MS, + }); + lastAgentOutput = resultText(verify); + lastExitCode = verify.exitCode; + if (verify.exitCode === 0 || agentSectionContainsToken(lastAgentOutput)) { + agentOk = true; + break; + } + if (attempt < attempts) await sleep(RETRY_SLEEP_MS); + } + + if (!agentOk && isExternalAgentVerificationFlake(lastAgentOutput)) { + const fixturePresent = await verifySkillFixturePresent(sandbox, SANDBOX_NAME); + if (fixturePresent) { + await artifacts.writeJson("scenario-result.json", { + id: "skill-agent", + status: "skipped", + reason: "external-agent-verification-flake-after-fixture-present", + lastExitCode, + }); + skip( + "agent verification inconclusive due to model/tool-call behavior; skill fixture is present", + ); + } + } + + expect( + agentOk, + `Agent did not return ${VERIFY_PHRASE}; last exit ${lastExitCode}\n${lastAgentOutput.slice(-12_000)}`, + ).toBe(true); + + await artifacts.writeJson("scenario-result.json", { + id: "skill-agent", + status: "passed", + assertions: { + dockerRunning: docker.exitCode === 0, + onboardCompleted: onboard.exitCode === 0, + skillInjected: addSkill.exitCode === 0, + agentReturnedVerificationToken: agentOk, + }, + }); + }, + 30 * 60_000, +); From 3d90c7bfaa241cc535936dae307e680893bd62c2 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:21:55 -0400 Subject: [PATCH 02/22] test(e2e): address skill agent review feedback --- test/e2e-scenario/live/skill-agent.test.ts | 51 ++++++++++++++++++---- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index 19e1d2da0e4..d45a5c76cc0 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -5,7 +5,11 @@ import fs from "node:fs"; import path from "node:path"; import { buildAvailabilityProbeEnv } from "../fixtures/availability-env.ts"; -import { type SandboxClient, trustedSandboxShellScript } from "../fixtures/clients/sandbox.ts"; +import { + type SandboxClient, + trustedSandboxShellScript, + validateSandboxName, +} from "../fixtures/clients/sandbox.ts"; import { expect, test } from "../fixtures/e2e-test.ts"; import { shouldRunLiveE2EScenarios } from "../fixtures/live-project-gate.ts"; @@ -36,6 +40,7 @@ const VERIFY_SKILL_SCRIPT = path.join( "verify-sandbox-skill-via-agent.sh", ); const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-skill-agent"; +validateSandboxName(SANDBOX_NAME); const SKILL_ID = "skill-smoke-fixture"; const VERIFY_PHRASE = "SKILL_SMOKE_VERIFY_K9X2"; const ONBOARD_TIMEOUT_MS = 20 * 60_000; @@ -59,7 +64,10 @@ function shellQuote(value: string): string { } function isExternalAgentVerificationFlake(text: string): boolean { - return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|tool_search_code failed|describe id must be a string|openclaw\.tools\.[A-Za-z0-9_]+ is not a function|call id must be a string|ReferenceError: require is not defined|ssh\/agent exit 124|exit 124/i.test( + // Only provider/model/transport timeout signatures are skippable. OpenClaw + // tool/runtime errors must fail this migration guard because the contract is + // that the real agent can read SKILL.md and return the token. + return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|ssh\/agent exit 124|exit 124/i.test( text, ); } @@ -71,16 +79,39 @@ function agentSectionContainsToken(agentOutput: string): boolean { return collapsed.includes(VERIFY_PHRASE.toLowerCase()); } +function buildVerifySkillFixtureScript(): string { + return ` +token=${shellQuote(VERIFY_PHRASE)} +skill=${shellQuote(SKILL_ID)} +found=0 +for path in \ + "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ + "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" \ + "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ + "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md" +do + if [ -f "$path" ] && grep -Fq "$token" "$path"; then + echo "SKILL_TOKEN_PATH=$path" + found=1 + fi +done +test "$found" = 1 +`.trim(); +} + async function verifySkillFixturePresent( sandbox: SandboxClient, sandboxName: string, ): Promise { - const script = `token=${shellQuote(VERIFY_PHRASE)}; skill=${shellQuote(SKILL_ID)}; found=0; for path in "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md"; do if [ -f "$path" ] && grep -Fq "$token" "$path"; then echo "SKILL_TOKEN_PATH=$path"; found=1; fi; done; test "$found" = 1`; - const result = await sandbox.execShell(sandboxName, trustedSandboxShellScript(script), { - artifactName: "verify-skill-fixture-present", - env: buildAvailabilityProbeEnv(), - timeoutMs: 30_000, - }); + const result = await sandbox.execShell( + sandboxName, + trustedSandboxShellScript(buildVerifySkillFixtureScript()), + { + artifactName: "verify-skill-fixture-present", + env: buildAvailabilityProbeEnv(), + timeoutMs: 30_000, + }, + ); return result.exitCode === 0; } @@ -192,6 +223,10 @@ runSkillAgentTest( NEMOCLAW_PROVIDER: "cloud", NEMOCLAW_SANDBOX_NAME: SANDBOX_NAME, NEMOCLAW_RECREATE_SANDBOX: "1", + // This migration targets skill injection + agent skill discovery, not + // policy rendering/enforcement. Dedicated policy E2Es own that + // boundary; skipping policies keeps this live guard focused and avoids + // conflating policy setup failures with the skill-agent contract. NEMOCLAW_POLICY_MODE: "skip", }, redactionValues: [apiKey], From 5a3f792bf85503501285ac4636ef3343ef5a7e99 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:23:26 -0400 Subject: [PATCH 03/22] ci(e2e): wire skill agent Vitest job --- .github/workflows/e2e-vitest-scenarios.yaml | 73 +++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 07bb8c54f54..869c6b71df4 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -250,6 +250,79 @@ jobs: if-no-files-found: ignore retention-days: 14 + # Focused coverage for test/e2e/test-skill-agent-e2e.sh's live skill + # injection + real OpenClaw agent-turn contract. The retained legacy bash + # lane remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. + skill-agent-vitest: + if: ${{ inputs.scenarios == '' }} + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/vitest/skill-agent + NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js + NEMOCLAW_RUN_E2E_SCENARIOS: "1" + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + + - name: Authenticate to Docker Hub + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + shell: bash + run: | + set -euo pipefail + if [[ -z "${DOCKERHUB_USERNAME}" || -z "${DOCKERHUB_TOKEN}" ]]; then + echo "::notice::Docker Hub credentials not configured; continuing with anonymous pulls." + exit 0 + fi + login_succeeded=0 + for attempt in 1 2 3; do + if echo "${DOCKERHUB_TOKEN}" | timeout 30s docker login docker.io --username "${DOCKERHUB_USERNAME}" --password-stdin; then + login_succeeded=1 + break + fi + if [[ "$attempt" -lt 3 ]]; then + echo "::warning::Docker Hub login attempt ${attempt} failed; retrying." + sleep 5 + fi + done + if [[ "$login_succeeded" -ne 1 ]]; then + echo "::warning::Docker Hub login failed after 3 attempts; continuing with anonymous pulls." + fi + + - name: Set up Node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0 + 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 skill-agent live test + env: + NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }} + run: | + set -euo pipefail + npx vitest run --project e2e-scenarios-live \ + test/e2e-scenario/live/skill-agent.test.ts \ + --silent=false --reporter=default + + - name: Upload skill-agent artifacts + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: e2e-vitest-scenarios-skill-agent + path: e2e-artifacts/vitest/skill-agent/ + include-hidden-files: false + if-no-files-found: ignore + retention-days: 14 + # Focused coverage slice for the #2603/#3145 OpenClaw websocket # protocol/history contract. The retained legacy bash lane remains the # source for full closeout until a later PR proves replacement and deletes it. From b282f161a23b09b64f2b3246be1c73aa9a95c41e Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:43:58 -0400 Subject: [PATCH 04/22] test(e2e): keep skill probe command single-line --- test/e2e-scenario/live/skill-agent.test.ts | 37 ++++++++++++---------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index d45a5c76cc0..c1cdf093b8e 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -80,23 +80,26 @@ function agentSectionContainsToken(agentOutput: string): boolean { } function buildVerifySkillFixtureScript(): string { - return ` -token=${shellQuote(VERIFY_PHRASE)} -skill=${shellQuote(SKILL_ID)} -found=0 -for path in \ - "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ - "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" \ - "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ - "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md" -do - if [ -f "$path" ] && grep -Fq "$token" "$path"; then - echo "SKILL_TOKEN_PATH=$path" - found=1 - fi -done -test "$found" = 1 -`.trim(); + // OpenShell rejects newline-bearing command args, so keep this readable as + // discrete clauses while emitting a single-line `sh -lc` script. + const skillPaths = [ + `/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md`, + `\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md`, + `/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md`, + `/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md`, + ]; + return [ + `token=${shellQuote(VERIFY_PHRASE)}`, + `skill=${shellQuote(SKILL_ID)}`, + "found=0", + `for path in ${skillPaths.map(shellQuote).join(" ")}; do`, + 'if [ -f "$path" ] && grep -Fq "$token" "$path"; then', + 'echo "SKILL_TOKEN_PATH=$path"', + "found=1", + "fi", + "done", + 'test "$found" = 1', + ].join("; "); } async function verifySkillFixturePresent( From 7d27cd7c3a7b8c76dbf1ab69eaf9728098036b12 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:55:51 -0400 Subject: [PATCH 05/22] test(e2e): fix skill probe shell syntax --- test/e2e-scenario/live/skill-agent.test.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index c1cdf093b8e..55eaf2ef5c0 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -92,12 +92,7 @@ function buildVerifySkillFixtureScript(): string { `token=${shellQuote(VERIFY_PHRASE)}`, `skill=${shellQuote(SKILL_ID)}`, "found=0", - `for path in ${skillPaths.map(shellQuote).join(" ")}; do`, - 'if [ -f "$path" ] && grep -Fq "$token" "$path"; then', - 'echo "SKILL_TOKEN_PATH=$path"', - "found=1", - "fi", - "done", + `for path in ${skillPaths.map(shellQuote).join(" ")}; do if [ -f "$path" ] && grep -Fq "$token" "$path"; then echo "SKILL_TOKEN_PATH=$path"; found=1; fi; done`, 'test "$found" = 1', ].join("; "); } From 5750bba6aa6001ef5cf5035ad3bcd5ebb5a8fdd8 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 10:07:27 -0400 Subject: [PATCH 06/22] test(e2e): skip skill agent on provider outage --- test/e2e-scenario/live/skill-agent.test.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index 55eaf2ef5c0..95e4df296c3 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -72,6 +72,13 @@ function isExternalAgentVerificationFlake(text: string): boolean { ); } +function isExternalProviderValidationFailure(text: string): boolean { + return ( + /NVIDIA Endpoints endpoint validation failed/i.test(text) && + /HTTP 429|rate limit|quota|temporarily unavailable|timed out|timeout/i.test(text) + ); +} + function agentSectionContainsToken(agentOutput: string): boolean { const match = agentOutput.match(/--- agent stdout\/stderr[\s\S]*?--- end ---/); if (!match) return false; @@ -231,7 +238,17 @@ runSkillAgentTest( timeoutMs: ONBOARD_TIMEOUT_MS, }, ); - expect(onboard.exitCode, resultText(onboard)).toBe(0); + const onboardText = resultText(onboard); + if (onboard.exitCode !== 0 && isExternalProviderValidationFailure(onboardText)) { + await artifacts.writeJson("scenario-result.json", { + id: "skill-agent", + status: "skipped", + reason: "external-provider-validation-unavailable-before-sandbox-skill-check", + onboardExitCode: onboard.exitCode, + }); + skip("NVIDIA endpoint validation was unavailable/rate-limited during onboarding"); + } + expect(onboard.exitCode, onboardText).toBe(0); const addSkill = await host.command("bash", [ADD_SKILL_SCRIPT], { artifactName: "add-sandbox-skill-fixture", From 50ceb08341f5e43236081190aee25fb0cd574da6 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 10:28:08 -0400 Subject: [PATCH 07/22] ci(e2e): allow selective Vitest jobs --- .github/workflows/e2e-vitest-scenarios.yaml | 19 ++++++++++++--- .../e2e-scenarios-workflow.test.ts | 6 +++-- tools/e2e-scenarios/workflow-boundary.mts | 24 ++++++++++++------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 869c6b71df4..f02b08e71d7 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -11,12 +11,17 @@ on: required: false default: "" type: string + jobs: + description: "Optional comma-separated free-standing live Vitest job ids. Empty runs all enabled jobs." + required: false + default: "" + type: string permissions: contents: read concurrency: - group: e2e-vitest-scenarios-${{ github.ref }}-${{ inputs.scenarios || 'supported' }} + group: e2e-vitest-scenarios-${{ github.ref }}-${{ inputs.scenarios || 'supported' }}-${{ inputs.jobs || 'all-jobs' }} cancel-in-progress: false jobs: @@ -42,6 +47,7 @@ jobs: name: Generate Vitest scenario matrix env: SCENARIOS: ${{ inputs.scenarios }} + JOBS: ${{ inputs.jobs }} run: | set -euo pipefail args=(--emit-live-matrix) @@ -52,6 +58,10 @@ jobs: fi args+=(--scenarios "${SCENARIOS}") fi + if [ -n "${JOBS}" ] && [[ ! "${JOBS}" =~ ^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$ ]]; then + echo "::error::Invalid jobs input: ${JOBS}" >&2 + exit 1 + fi matrix="$(npx tsx test/e2e-scenario/scenarios/run.ts "${args[@]}")" echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" MATRIX_JSON="${matrix}" python - <<'PY' >> "$GITHUB_STEP_SUMMARY" @@ -69,6 +79,7 @@ jobs: live-scenarios: needs: generate-matrix + if: ${{ inputs.jobs == '' }} runs-on: ${{ matrix.runner }} timeout-minutes: 45 strategy: @@ -169,6 +180,7 @@ jobs: # because the matrix above only runs registry-scenarios.test.ts. Modeled on # #5049's free-standing pattern. openshell-version-pin-vitest: + if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',openshell-version-pin-vitest,') }} runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -208,6 +220,7 @@ jobs: retention-days: 14 onboard-negative-paths-vitest: + if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',onboard-negative-paths-vitest,') }} runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -254,7 +267,7 @@ jobs: # injection + real OpenClaw agent-turn contract. The retained legacy bash # lane remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. skill-agent-vitest: - if: ${{ inputs.scenarios == '' }} + if: ${{ inputs.scenarios == '' && (inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',skill-agent-vitest,')) }} runs-on: ubuntu-latest timeout-minutes: 30 env: @@ -327,7 +340,7 @@ jobs: # protocol/history contract. The retained legacy bash lane remains the # source for full closeout until a later PR proves replacement and deletes it. openclaw-tui-chat-correlation-vitest: - if: ${{ inputs.scenarios == '' }} + if: ${{ inputs.scenarios == '' && inputs.jobs == '' }} runs-on: ubuntu-latest timeout-minutes: 75 env: diff --git a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts index bacbbfd3697..c106c6086b5 100644 --- a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts +++ b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts @@ -120,11 +120,13 @@ jobs: expect(errors).toEqual( expect.arrayContaining([ "workflow_dispatch missing input: scenarios", + "workflow_dispatch missing input: jobs", "workflow_dispatch must not expose legacy test_filter input", "workflow missing generate-matrix job", "generate-matrix job must run on ubuntu-latest", "live-scenarios job must run on the matrix runner", "live-scenarios job must depend on generate-matrix", + "live-scenarios job must not run when a free-standing job selector is provided", "live-scenarios strategy.fail-fast must be false", "live-scenarios matrix.include must come from generate-matrix output", "live-scenarios job must write artifacts under e2e-artifacts/vitest", @@ -154,7 +156,7 @@ jobs: "artifact upload retention-days must be 14", "upload-artifact action must be pinned to a full commit SHA", "openshell-version-pin-vitest job must run independently of generate-matrix", - "openshell-version-pin-vitest job must run independently of workflow dispatch scenario filters", + "openshell-version-pin-vitest job must use the approved jobs selector", "openshell-version-pin-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", "openshell-version-pin-vitest job must write artifacts under e2e-artifacts/vitest/openshell-version-pin", "openshell-version-pin-vitest job env must not include NVIDIA_API_KEY", @@ -173,7 +175,7 @@ jobs: "openshell-version-pin-vitest artifact upload must ignore missing fixture artifacts", "openshell-version-pin-vitest artifact upload retention-days must be 14", "onboard-negative-paths-vitest job must run independently of generate-matrix", - "onboard-negative-paths-vitest job must run independently of workflow dispatch scenario filters", + "onboard-negative-paths-vitest job must use the approved jobs selector", "onboard-negative-paths-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", "onboard-negative-paths-vitest job must write artifacts under e2e-artifacts/vitest/onboard-negative-paths", "onboard-negative-paths-vitest job env must not include NVIDIA_API_KEY", diff --git a/tools/e2e-scenarios/workflow-boundary.mts b/tools/e2e-scenarios/workflow-boundary.mts index 9b06e6d219d..5f6c705af68 100644 --- a/tools/e2e-scenarios/workflow-boundary.mts +++ b/tools/e2e-scenarios/workflow-boundary.mts @@ -122,6 +122,10 @@ function requireNoDispatchInputInterpolation( } } +function expectedFreeStandingJobSelector(jobName: string): string { + return `\${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',${jobName},') }}`; +} + function validateOpenShellVersionPinVitestJob(errors: string[], jobs: WorkflowRecord): void { const jobName = "openshell-version-pin-vitest"; const job = asRecord(jobs[jobName]); @@ -136,10 +140,8 @@ function validateOpenShellVersionPinVitestJob(errors: string[], jobs: WorkflowRe if (Object.hasOwn(job, "needs")) { errors.push("openshell-version-pin-vitest job must run independently of generate-matrix"); } - if (Object.hasOwn(job, "if")) { - errors.push( - "openshell-version-pin-vitest job must run independently of workflow dispatch scenario filters", - ); + if (job.if !== expectedFreeStandingJobSelector(jobName)) { + errors.push("openshell-version-pin-vitest job must use the approved jobs selector"); } const jobEnv = asRecord(job.env); @@ -224,10 +226,8 @@ function validateOnboardNegativePathsVitestJob(errors: string[], jobs: WorkflowR if (Object.hasOwn(job, "needs")) { errors.push("onboard-negative-paths-vitest job must run independently of generate-matrix"); } - if (Object.hasOwn(job, "if")) { - errors.push( - "onboard-negative-paths-vitest job must run independently of workflow dispatch scenario filters", - ); + if (job.if !== expectedFreeStandingJobSelector(jobName)) { + errors.push("onboard-negative-paths-vitest job must use the approved jobs selector"); } const jobEnv = asRecord(job.env); @@ -312,6 +312,7 @@ export function validateE2eVitestScenariosWorkflowBoundary( const dispatchInputs = asRecord(workflowDispatch.inputs); requireInput(errors, dispatchInputs, "scenarios"); + requireInput(errors, dispatchInputs, "jobs"); if (Object.hasOwn(dispatchInputs, "test_filter")) { errors.push("workflow_dispatch must not expose legacy test_filter input"); } @@ -341,10 +342,14 @@ export function validateE2eVitestScenariosWorkflowBoundary( if (generateEnv.SCENARIOS !== "${{ inputs.scenarios }}") { errors.push("matrix generation step must pass scenarios through SCENARIOS env"); } + if (generateEnv.JOBS !== "${{ inputs.jobs }}") { + errors.push("matrix generation step must pass jobs through JOBS env"); + } requireRunContains(errors, generate, "npx tsx test/e2e-scenario/scenarios/run.ts"); requireRunContains(errors, generate, "--emit-live-matrix"); requireRunContains(errors, generate, "--scenarios"); requireRunContains(errors, generate, "^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$"); + requireRunContains(errors, generate, "Invalid jobs input"); requireRunDoesNotContain(errors, generate, "^[A-Za-z0-9._-]+"); requireRunContains(errors, generate, "## Vitest E2E Scenario Matrix"); requireRunContains(errors, generate, "| Scenario | Runner | Label |"); @@ -357,6 +362,9 @@ export function validateE2eVitestScenariosWorkflowBoundary( if (liveScenarios.needs !== "generate-matrix") { errors.push("live-scenarios job must depend on generate-matrix"); } + if (liveScenarios.if !== "${{ inputs.jobs == '' }}") { + errors.push("live-scenarios job must not run when a free-standing job selector is provided"); + } const strategy = asRecord(liveScenarios.strategy); if (strategy["fail-fast"] !== false) { errors.push("live-scenarios strategy.fail-fast must be false"); From dc492b89327233cf952c8ee2bc2b3b708e320ea9 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:02:38 -0400 Subject: [PATCH 08/22] test(e2e): add skill agent Vitest coverage --- test/e2e-scenario/live/skill-agent.test.ts | 280 +++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 test/e2e-scenario/live/skill-agent.test.ts diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts new file mode 100644 index 00000000000..19e1d2da0e4 --- /dev/null +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -0,0 +1,280 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import fs from "node:fs"; +import path from "node:path"; + +import { buildAvailabilityProbeEnv } from "../fixtures/availability-env.ts"; +import { type SandboxClient, trustedSandboxShellScript } from "../fixtures/clients/sandbox.ts"; +import { expect, test } from "../fixtures/e2e-test.ts"; +import { shouldRunLiveE2EScenarios } from "../fixtures/live-project-gate.ts"; + +// Focused Vitest live replacement coverage for test/e2e/test-skill-agent-e2e.sh. +// Keep this as a direct live test: the legacy contract is skill fixture +// injection into a real OpenClaw sandbox plus an agent turn that must read +// SKILL.md and return the verification token. The retained legacy bash lane +// remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. + +const REPO_ROOT = path.resolve(import.meta.dirname, "../../.."); +const CLI_ENTRYPOINT = path.join(REPO_ROOT, "bin", "nemoclaw.js"); +const ADD_SKILL_SCRIPT = path.join( + REPO_ROOT, + "test", + "e2e", + "e2e-cloud-experimental", + "features", + "skill", + "add-sandbox-skill.sh", +); +const VERIFY_SKILL_SCRIPT = path.join( + REPO_ROOT, + "test", + "e2e", + "e2e-cloud-experimental", + "features", + "skill", + "verify-sandbox-skill-via-agent.sh", +); +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-skill-agent"; +const SKILL_ID = "skill-smoke-fixture"; +const VERIFY_PHRASE = "SKILL_SMOKE_VERIFY_K9X2"; +const ONBOARD_TIMEOUT_MS = 20 * 60_000; +const AGENT_VERIFY_TIMEOUT_MS = 4 * 60_000; +const MAX_ATTEMPTS = Number.parseInt(process.env.E2E_SKILL_AGENT_MAX_ATTEMPTS ?? "3", 10); +const RETRY_SLEEP_MS = + Number.parseInt(process.env.E2E_SKILL_AGENT_RETRY_SLEEP_SEC ?? "15", 10) * 1_000; + +process.env.NEMOCLAW_CLI_BIN ??= CLI_ENTRYPOINT; + +function resultText(result: { stdout: string; stderr: string }): string { + return [result.stdout, result.stderr].filter(Boolean).join("\n"); +} + +function sleep(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function shellQuote(value: string): string { + return `'${value.replaceAll("'", `'\\''`)}'`; +} + +function isExternalAgentVerificationFlake(text: string): boolean { + return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|tool_search_code failed|describe id must be a string|openclaw\.tools\.[A-Za-z0-9_]+ is not a function|call id must be a string|ReferenceError: require is not defined|ssh\/agent exit 124|exit 124/i.test( + text, + ); +} + +function agentSectionContainsToken(agentOutput: string): boolean { + const match = agentOutput.match(/--- agent stdout\/stderr[\s\S]*?--- end ---/); + if (!match) return false; + const collapsed = match[0].replace(/[\n\r`"']/g, "").toLowerCase(); + return collapsed.includes(VERIFY_PHRASE.toLowerCase()); +} + +async function verifySkillFixturePresent( + sandbox: SandboxClient, + sandboxName: string, +): Promise { + const script = `token=${shellQuote(VERIFY_PHRASE)}; skill=${shellQuote(SKILL_ID)}; found=0; for path in "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md"; do if [ -f "$path" ] && grep -Fq "$token" "$path"; then echo "SKILL_TOKEN_PATH=$path"; found=1; fi; done; test "$found" = 1`; + const result = await sandbox.execShell(sandboxName, trustedSandboxShellScript(script), { + artifactName: "verify-skill-fixture-present", + env: buildAvailabilityProbeEnv(), + timeoutMs: 30_000, + }); + return result.exitCode === 0; +} + +async function ignoreCleanupError(run: () => Promise): Promise { + try { + await run(); + } catch { + // Best-effort cleanup only; the test may be running before OpenShell exists + // or after onboarding already removed part of the runtime state. + } +} + +const runSkillAgentTest = shouldRunLiveE2EScenarios() ? test : test.skip; + +runSkillAgentTest( + "skill-agent: injected sandbox skill is read by a real OpenClaw agent turn", + async ({ artifacts, cleanup, host, sandbox, secrets, skip }) => { + expect( + fs.existsSync(CLI_ENTRYPOINT), + "run `npm run build:cli` before live repo CLI scenarios", + ).toBe(true); + expect(fs.existsSync(ADD_SKILL_SCRIPT), `missing skill add helper: ${ADD_SKILL_SCRIPT}`).toBe( + true, + ); + expect( + fs.existsSync(VERIFY_SKILL_SCRIPT), + `missing skill verify helper: ${VERIFY_SKILL_SCRIPT}`, + ).toBe(true); + + const docker = await host.command("docker", ["info"], { + artifactName: "prereq-docker-info-skill-agent", + env: buildAvailabilityProbeEnv(), + timeoutMs: 30_000, + }); + if (docker.exitCode !== 0) { + if (process.env.GITHUB_ACTIONS === "true") { + throw new Error(`Docker is required for skill-agent E2E: ${resultText(docker)}`); + } + skip("Docker is required for skill-agent E2E"); + } + + const apiKey = secrets.required("NVIDIA_API_KEY"); + expect(apiKey.startsWith("nvapi-"), "NVIDIA_API_KEY must start with nvapi-").toBe(true); + + await artifacts.writeJson("scenario.json", { + id: "skill-agent", + runner: "vitest", + boundary: "direct-cli-onboard-sandbox-skill-and-agent-turn", + legacySource: "test/e2e/test-skill-agent-e2e.sh", + contract: [ + "Docker is available before onboarding", + "NVIDIA_API_KEY is present and nvapi-prefixed", + "nemoclaw onboard creates/recreates a real OpenClaw sandbox", + "skill-smoke-fixture is injected into sandbox and home skill roots", + "openclaw agent reads SKILL.md and returns SKILL_SMOKE_VERIFY_K9X2", + "provider/tool-call transport flakes only skip after the skill fixture is proven present", + ], + }); + + const cleanupEnv = buildAvailabilityProbeEnv(); + await ignoreCleanupError(() => + host.command("node", [CLI_ENTRYPOINT, SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "pre-cleanup-nemoclaw-destroy-skill-agent", + env: cleanupEnv, + timeoutMs: 120_000, + }), + ); + await ignoreCleanupError(() => + sandbox.openshell(["sandbox", "delete", SANDBOX_NAME], { + artifactName: "pre-cleanup-openshell-sandbox-delete-skill-agent", + env: cleanupEnv, + timeoutMs: 60_000, + }), + ); + + cleanup.add(`destroy skill-agent sandbox ${SANDBOX_NAME}`, async () => { + await ignoreCleanupError(() => + host.command("node", [CLI_ENTRYPOINT, SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "cleanup-nemoclaw-destroy-skill-agent", + env: buildAvailabilityProbeEnv(), + timeoutMs: 120_000, + }), + ); + await ignoreCleanupError(() => + sandbox.openshell(["sandbox", "delete", SANDBOX_NAME], { + artifactName: "cleanup-openshell-sandbox-delete-skill-agent", + env: buildAvailabilityProbeEnv(), + timeoutMs: 60_000, + }), + ); + }); + + const onboard = await host.command( + "node", + [ + CLI_ENTRYPOINT, + "onboard", + "--fresh", + "--non-interactive", + "--yes", + "--yes-i-accept-third-party-software", + ], + { + artifactName: "onboard-skill-agent", + env: { + ...buildAvailabilityProbeEnv(), + NVIDIA_API_KEY: apiKey, + NEMOCLAW_AGENT: "openclaw", + NEMOCLAW_PROVIDER: "cloud", + NEMOCLAW_SANDBOX_NAME: SANDBOX_NAME, + NEMOCLAW_RECREATE_SANDBOX: "1", + NEMOCLAW_POLICY_MODE: "skip", + }, + redactionValues: [apiKey], + timeoutMs: ONBOARD_TIMEOUT_MS, + }, + ); + expect(onboard.exitCode, resultText(onboard)).toBe(0); + + const addSkill = await host.command("bash", [ADD_SKILL_SCRIPT], { + artifactName: "add-sandbox-skill-fixture", + cwd: REPO_ROOT, + env: { + ...buildAvailabilityProbeEnv(), + SANDBOX_NAME, + SKILL_ID, + SKILL_DESCRIPTION: "E2E smoke skill injected for agent verification", + }, + timeoutMs: 120_000, + }); + expect(addSkill.exitCode, resultText(addSkill)).toBe(0); + expect(addSkill.stdout).toContain(`QUERY_PATH=/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md`); + expect(addSkill.stdout).toContain("HOME_QUERY_PATH="); + expect(await verifySkillFixturePresent(sandbox, SANDBOX_NAME)).toBe(true); + + let lastAgentOutput = ""; + let agentOk = false; + let lastExitCode: number | null = null; + const attempts = Math.max(1, Number.isFinite(MAX_ATTEMPTS) ? MAX_ATTEMPTS : 3); + + for (let attempt = 1; attempt <= attempts; attempt += 1) { + const verify = await host.command("bash", [VERIFY_SKILL_SCRIPT], { + artifactName: `verify-sandbox-skill-via-agent-${attempt}`, + cwd: REPO_ROOT, + env: { + ...buildAvailabilityProbeEnv(), + NVIDIA_API_KEY: apiKey, + SANDBOX_NAME, + SKILL_ID, + VERIFY_TOKEN: VERIFY_PHRASE, + SKILL_VERIFY_SESSION_ID: `skill-agent-vitest-${process.pid}-${attempt}`, + }, + redactionValues: [apiKey], + timeoutMs: AGENT_VERIFY_TIMEOUT_MS, + }); + lastAgentOutput = resultText(verify); + lastExitCode = verify.exitCode; + if (verify.exitCode === 0 || agentSectionContainsToken(lastAgentOutput)) { + agentOk = true; + break; + } + if (attempt < attempts) await sleep(RETRY_SLEEP_MS); + } + + if (!agentOk && isExternalAgentVerificationFlake(lastAgentOutput)) { + const fixturePresent = await verifySkillFixturePresent(sandbox, SANDBOX_NAME); + if (fixturePresent) { + await artifacts.writeJson("scenario-result.json", { + id: "skill-agent", + status: "skipped", + reason: "external-agent-verification-flake-after-fixture-present", + lastExitCode, + }); + skip( + "agent verification inconclusive due to model/tool-call behavior; skill fixture is present", + ); + } + } + + expect( + agentOk, + `Agent did not return ${VERIFY_PHRASE}; last exit ${lastExitCode}\n${lastAgentOutput.slice(-12_000)}`, + ).toBe(true); + + await artifacts.writeJson("scenario-result.json", { + id: "skill-agent", + status: "passed", + assertions: { + dockerRunning: docker.exitCode === 0, + onboardCompleted: onboard.exitCode === 0, + skillInjected: addSkill.exitCode === 0, + agentReturnedVerificationToken: agentOk, + }, + }); + }, + 30 * 60_000, +); From 422abb0273f3cae57de07bc81672a7e4b5d48faa Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:21:55 -0400 Subject: [PATCH 09/22] test(e2e): address skill agent review feedback --- test/e2e-scenario/live/skill-agent.test.ts | 51 ++++++++++++++++++---- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index 19e1d2da0e4..d45a5c76cc0 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -5,7 +5,11 @@ import fs from "node:fs"; import path from "node:path"; import { buildAvailabilityProbeEnv } from "../fixtures/availability-env.ts"; -import { type SandboxClient, trustedSandboxShellScript } from "../fixtures/clients/sandbox.ts"; +import { + type SandboxClient, + trustedSandboxShellScript, + validateSandboxName, +} from "../fixtures/clients/sandbox.ts"; import { expect, test } from "../fixtures/e2e-test.ts"; import { shouldRunLiveE2EScenarios } from "../fixtures/live-project-gate.ts"; @@ -36,6 +40,7 @@ const VERIFY_SKILL_SCRIPT = path.join( "verify-sandbox-skill-via-agent.sh", ); const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-skill-agent"; +validateSandboxName(SANDBOX_NAME); const SKILL_ID = "skill-smoke-fixture"; const VERIFY_PHRASE = "SKILL_SMOKE_VERIFY_K9X2"; const ONBOARD_TIMEOUT_MS = 20 * 60_000; @@ -59,7 +64,10 @@ function shellQuote(value: string): string { } function isExternalAgentVerificationFlake(text: string): boolean { - return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|tool_search_code failed|describe id must be a string|openclaw\.tools\.[A-Za-z0-9_]+ is not a function|call id must be a string|ReferenceError: require is not defined|ssh\/agent exit 124|exit 124/i.test( + // Only provider/model/transport timeout signatures are skippable. OpenClaw + // tool/runtime errors must fail this migration guard because the contract is + // that the real agent can read SKILL.md and return the token. + return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|ssh\/agent exit 124|exit 124/i.test( text, ); } @@ -71,16 +79,39 @@ function agentSectionContainsToken(agentOutput: string): boolean { return collapsed.includes(VERIFY_PHRASE.toLowerCase()); } +function buildVerifySkillFixtureScript(): string { + return ` +token=${shellQuote(VERIFY_PHRASE)} +skill=${shellQuote(SKILL_ID)} +found=0 +for path in \ + "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ + "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" \ + "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ + "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md" +do + if [ -f "$path" ] && grep -Fq "$token" "$path"; then + echo "SKILL_TOKEN_PATH=$path" + found=1 + fi +done +test "$found" = 1 +`.trim(); +} + async function verifySkillFixturePresent( sandbox: SandboxClient, sandboxName: string, ): Promise { - const script = `token=${shellQuote(VERIFY_PHRASE)}; skill=${shellQuote(SKILL_ID)}; found=0; for path in "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md"; do if [ -f "$path" ] && grep -Fq "$token" "$path"; then echo "SKILL_TOKEN_PATH=$path"; found=1; fi; done; test "$found" = 1`; - const result = await sandbox.execShell(sandboxName, trustedSandboxShellScript(script), { - artifactName: "verify-skill-fixture-present", - env: buildAvailabilityProbeEnv(), - timeoutMs: 30_000, - }); + const result = await sandbox.execShell( + sandboxName, + trustedSandboxShellScript(buildVerifySkillFixtureScript()), + { + artifactName: "verify-skill-fixture-present", + env: buildAvailabilityProbeEnv(), + timeoutMs: 30_000, + }, + ); return result.exitCode === 0; } @@ -192,6 +223,10 @@ runSkillAgentTest( NEMOCLAW_PROVIDER: "cloud", NEMOCLAW_SANDBOX_NAME: SANDBOX_NAME, NEMOCLAW_RECREATE_SANDBOX: "1", + // This migration targets skill injection + agent skill discovery, not + // policy rendering/enforcement. Dedicated policy E2Es own that + // boundary; skipping policies keeps this live guard focused and avoids + // conflating policy setup failures with the skill-agent contract. NEMOCLAW_POLICY_MODE: "skip", }, redactionValues: [apiKey], From 74887990084e68dde5a12359483d4a467fd193a5 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:23:26 -0400 Subject: [PATCH 10/22] ci(e2e): wire skill agent Vitest job --- .github/workflows/e2e-vitest-scenarios.yaml | 73 +++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 360cbb19fbc..6b14ae444ad 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -255,6 +255,79 @@ jobs: if-no-files-found: ignore retention-days: 14 + # Focused coverage for test/e2e/test-skill-agent-e2e.sh's live skill + # injection + real OpenClaw agent-turn contract. The retained legacy bash + # lane remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. + skill-agent-vitest: + if: ${{ inputs.scenarios == '' }} + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/vitest/skill-agent + NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js + NEMOCLAW_RUN_E2E_SCENARIOS: "1" + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + + - name: Authenticate to Docker Hub + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + shell: bash + run: | + set -euo pipefail + if [[ -z "${DOCKERHUB_USERNAME}" || -z "${DOCKERHUB_TOKEN}" ]]; then + echo "::notice::Docker Hub credentials not configured; continuing with anonymous pulls." + exit 0 + fi + login_succeeded=0 + for attempt in 1 2 3; do + if echo "${DOCKERHUB_TOKEN}" | timeout 30s docker login docker.io --username "${DOCKERHUB_USERNAME}" --password-stdin; then + login_succeeded=1 + break + fi + if [[ "$attempt" -lt 3 ]]; then + echo "::warning::Docker Hub login attempt ${attempt} failed; retrying." + sleep 5 + fi + done + if [[ "$login_succeeded" -ne 1 ]]; then + echo "::warning::Docker Hub login failed after 3 attempts; continuing with anonymous pulls." + fi + + - name: Set up Node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0 + 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 skill-agent live test + env: + NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }} + run: | + set -euo pipefail + npx vitest run --project e2e-scenarios-live \ + test/e2e-scenario/live/skill-agent.test.ts \ + --silent=false --reporter=default + + - name: Upload skill-agent artifacts + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: e2e-vitest-scenarios-skill-agent + path: e2e-artifacts/vitest/skill-agent/ + include-hidden-files: false + if-no-files-found: ignore + retention-days: 14 + # Focused coverage slice for the #2603/#3145 OpenClaw websocket # protocol/history contract. The retained legacy bash lane remains the # source for full closeout until a later PR proves replacement and deletes it. From ef802219565fc633e89669936a8d918c33dc924f Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:43:58 -0400 Subject: [PATCH 11/22] test(e2e): keep skill probe command single-line --- test/e2e-scenario/live/skill-agent.test.ts | 37 ++++++++++++---------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index d45a5c76cc0..c1cdf093b8e 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -80,23 +80,26 @@ function agentSectionContainsToken(agentOutput: string): boolean { } function buildVerifySkillFixtureScript(): string { - return ` -token=${shellQuote(VERIFY_PHRASE)} -skill=${shellQuote(SKILL_ID)} -found=0 -for path in \ - "/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ - "\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md" \ - "/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md" \ - "/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md" -do - if [ -f "$path" ] && grep -Fq "$token" "$path"; then - echo "SKILL_TOKEN_PATH=$path" - found=1 - fi -done -test "$found" = 1 -`.trim(); + // OpenShell rejects newline-bearing command args, so keep this readable as + // discrete clauses while emitting a single-line `sh -lc` script. + const skillPaths = [ + `/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md`, + `\${HOME:-/home/sandbox}/.openclaw/skills/${SKILL_ID}/SKILL.md`, + `/home/sandbox/.openclaw/skills/${SKILL_ID}/SKILL.md`, + `/home/openclaw/.openclaw/skills/${SKILL_ID}/SKILL.md`, + ]; + return [ + `token=${shellQuote(VERIFY_PHRASE)}`, + `skill=${shellQuote(SKILL_ID)}`, + "found=0", + `for path in ${skillPaths.map(shellQuote).join(" ")}; do`, + 'if [ -f "$path" ] && grep -Fq "$token" "$path"; then', + 'echo "SKILL_TOKEN_PATH=$path"', + "found=1", + "fi", + "done", + 'test "$found" = 1', + ].join("; "); } async function verifySkillFixturePresent( From 449c8d619f50959c42be0c87bdd4fc7186387071 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 09:55:51 -0400 Subject: [PATCH 12/22] test(e2e): fix skill probe shell syntax --- test/e2e-scenario/live/skill-agent.test.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index c1cdf093b8e..55eaf2ef5c0 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -92,12 +92,7 @@ function buildVerifySkillFixtureScript(): string { `token=${shellQuote(VERIFY_PHRASE)}`, `skill=${shellQuote(SKILL_ID)}`, "found=0", - `for path in ${skillPaths.map(shellQuote).join(" ")}; do`, - 'if [ -f "$path" ] && grep -Fq "$token" "$path"; then', - 'echo "SKILL_TOKEN_PATH=$path"', - "found=1", - "fi", - "done", + `for path in ${skillPaths.map(shellQuote).join(" ")}; do if [ -f "$path" ] && grep -Fq "$token" "$path"; then echo "SKILL_TOKEN_PATH=$path"; found=1; fi; done`, 'test "$found" = 1', ].join("; "); } From 8ebd2c5f15540ae372c4ae7e9c87d7333749ac91 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 10:07:27 -0400 Subject: [PATCH 13/22] test(e2e): skip skill agent on provider outage --- test/e2e-scenario/live/skill-agent.test.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index 55eaf2ef5c0..95e4df296c3 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -72,6 +72,13 @@ function isExternalAgentVerificationFlake(text: string): boolean { ); } +function isExternalProviderValidationFailure(text: string): boolean { + return ( + /NVIDIA Endpoints endpoint validation failed/i.test(text) && + /HTTP 429|rate limit|quota|temporarily unavailable|timed out|timeout/i.test(text) + ); +} + function agentSectionContainsToken(agentOutput: string): boolean { const match = agentOutput.match(/--- agent stdout\/stderr[\s\S]*?--- end ---/); if (!match) return false; @@ -231,7 +238,17 @@ runSkillAgentTest( timeoutMs: ONBOARD_TIMEOUT_MS, }, ); - expect(onboard.exitCode, resultText(onboard)).toBe(0); + const onboardText = resultText(onboard); + if (onboard.exitCode !== 0 && isExternalProviderValidationFailure(onboardText)) { + await artifacts.writeJson("scenario-result.json", { + id: "skill-agent", + status: "skipped", + reason: "external-provider-validation-unavailable-before-sandbox-skill-check", + onboardExitCode: onboard.exitCode, + }); + skip("NVIDIA endpoint validation was unavailable/rate-limited during onboarding"); + } + expect(onboard.exitCode, onboardText).toBe(0); const addSkill = await host.command("bash", [ADD_SKILL_SCRIPT], { artifactName: "add-sandbox-skill-fixture", From d4550b7647710b00330dfc2c0b33346d5987744f Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 10:28:08 -0400 Subject: [PATCH 14/22] ci(e2e): allow selective Vitest jobs --- .github/workflows/e2e-vitest-scenarios.yaml | 25 ++++++++++++++++--- .../e2e-scenarios-workflow.test.ts | 6 +++-- tools/e2e-scenarios/workflow-boundary.mts | 24 ++++++++++++------ 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 6b14ae444ad..41cc16334c4 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -16,12 +16,17 @@ on: required: false type: string default: "" + jobs: + description: "Optional comma-separated free-standing live Vitest job ids. Empty runs all enabled jobs." + required: false + default: "" + type: string permissions: contents: read concurrency: - group: e2e-vitest-scenarios-${{ github.ref }}-${{ inputs.scenarios || 'supported' }} + group: e2e-vitest-scenarios-${{ github.ref }}-${{ inputs.scenarios || 'supported' }}-${{ inputs.jobs || 'all-jobs' }} cancel-in-progress: false jobs: @@ -47,6 +52,7 @@ jobs: name: Generate Vitest scenario matrix env: SCENARIOS: ${{ inputs.scenarios }} + JOBS: ${{ inputs.jobs }} run: | set -euo pipefail args=(--emit-live-matrix) @@ -57,6 +63,10 @@ jobs: fi args+=(--scenarios "${SCENARIOS}") fi + if [ -n "${JOBS}" ] && [[ ! "${JOBS}" =~ ^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$ ]]; then + echo "::error::Invalid jobs input: ${JOBS}" >&2 + exit 1 + fi matrix="$(npx tsx test/e2e-scenario/scenarios/run.ts "${args[@]}")" echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" MATRIX_JSON="${matrix}" python - <<'PY' >> "$GITHUB_STEP_SUMMARY" @@ -74,6 +84,7 @@ jobs: live-scenarios: needs: generate-matrix + if: ${{ inputs.jobs == '' }} runs-on: ${{ matrix.runner }} timeout-minutes: 45 strategy: @@ -174,6 +185,7 @@ jobs: # because the matrix above only runs registry-scenarios.test.ts. Modeled on # #5049's free-standing pattern. openshell-version-pin-vitest: + if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',openshell-version-pin-vitest,') }} runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -213,6 +225,7 @@ jobs: retention-days: 14 onboard-negative-paths-vitest: + if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',onboard-negative-paths-vitest,') }} runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -259,7 +272,7 @@ jobs: # injection + real OpenClaw agent-turn contract. The retained legacy bash # lane remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. skill-agent-vitest: - if: ${{ inputs.scenarios == '' }} + if: ${{ inputs.scenarios == '' && (inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',skill-agent-vitest,')) }} runs-on: ubuntu-latest timeout-minutes: 30 env: @@ -332,7 +345,7 @@ jobs: # protocol/history contract. The retained legacy bash lane remains the # source for full closeout until a later PR proves replacement and deletes it. openclaw-tui-chat-correlation-vitest: - if: ${{ inputs.scenarios == '' }} + if: ${{ inputs.scenarios == '' && inputs.jobs == '' }} runs-on: ubuntu-latest timeout-minutes: 75 env: @@ -411,6 +424,7 @@ jobs: # restore the /tmp guard chain after pod recreate). Will fail on `main` # until the #2701 fix lands; flips green afterwards. gateway-guard-recovery: + if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',gateway-guard-recovery,') }} runs-on: ubuntu-latest timeout-minutes: 45 env: @@ -507,6 +521,7 @@ jobs: live-scenarios, openshell-version-pin-vitest, onboard-negative-paths-vitest, + skill-agent-vitest, openclaw-tui-chat-correlation-vitest, gateway-guard-recovery, ] @@ -524,6 +539,7 @@ jobs: const workflowBranch = context.ref.replace('refs/heads/', ''); const prNumberInput = ${{ toJSON(inputs.pr_number) }} || ''; const requestedScenarios = ${{ toJSON(inputs.scenarios) }} || ''; + const requestedJobs = ${{ toJSON(inputs.jobs) }} || ''; let prNumber = prNumberInput ? Number.parseInt(prNumberInput, 10) : undefined; if (!prNumber) { @@ -564,6 +580,9 @@ jobs: requestedScenarios ? `**Requested scenarios:** \`${requestedScenarios}\`` : '**Requested scenarios:** _(default — all supported)_', + requestedJobs + ? `**Requested jobs:** \`${requestedJobs}\`` + : '**Requested jobs:** _(default — all enabled)_', `**Summary:** ${passed.length} passed, ${failed.length} failed, ${skipped.length} skipped`, '', '| Job | Result |', diff --git a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts index bacbbfd3697..c106c6086b5 100644 --- a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts +++ b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts @@ -120,11 +120,13 @@ jobs: expect(errors).toEqual( expect.arrayContaining([ "workflow_dispatch missing input: scenarios", + "workflow_dispatch missing input: jobs", "workflow_dispatch must not expose legacy test_filter input", "workflow missing generate-matrix job", "generate-matrix job must run on ubuntu-latest", "live-scenarios job must run on the matrix runner", "live-scenarios job must depend on generate-matrix", + "live-scenarios job must not run when a free-standing job selector is provided", "live-scenarios strategy.fail-fast must be false", "live-scenarios matrix.include must come from generate-matrix output", "live-scenarios job must write artifacts under e2e-artifacts/vitest", @@ -154,7 +156,7 @@ jobs: "artifact upload retention-days must be 14", "upload-artifact action must be pinned to a full commit SHA", "openshell-version-pin-vitest job must run independently of generate-matrix", - "openshell-version-pin-vitest job must run independently of workflow dispatch scenario filters", + "openshell-version-pin-vitest job must use the approved jobs selector", "openshell-version-pin-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", "openshell-version-pin-vitest job must write artifacts under e2e-artifacts/vitest/openshell-version-pin", "openshell-version-pin-vitest job env must not include NVIDIA_API_KEY", @@ -173,7 +175,7 @@ jobs: "openshell-version-pin-vitest artifact upload must ignore missing fixture artifacts", "openshell-version-pin-vitest artifact upload retention-days must be 14", "onboard-negative-paths-vitest job must run independently of generate-matrix", - "onboard-negative-paths-vitest job must run independently of workflow dispatch scenario filters", + "onboard-negative-paths-vitest job must use the approved jobs selector", "onboard-negative-paths-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", "onboard-negative-paths-vitest job must write artifacts under e2e-artifacts/vitest/onboard-negative-paths", "onboard-negative-paths-vitest job env must not include NVIDIA_API_KEY", diff --git a/tools/e2e-scenarios/workflow-boundary.mts b/tools/e2e-scenarios/workflow-boundary.mts index 9b06e6d219d..5f6c705af68 100644 --- a/tools/e2e-scenarios/workflow-boundary.mts +++ b/tools/e2e-scenarios/workflow-boundary.mts @@ -122,6 +122,10 @@ function requireNoDispatchInputInterpolation( } } +function expectedFreeStandingJobSelector(jobName: string): string { + return `\${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',${jobName},') }}`; +} + function validateOpenShellVersionPinVitestJob(errors: string[], jobs: WorkflowRecord): void { const jobName = "openshell-version-pin-vitest"; const job = asRecord(jobs[jobName]); @@ -136,10 +140,8 @@ function validateOpenShellVersionPinVitestJob(errors: string[], jobs: WorkflowRe if (Object.hasOwn(job, "needs")) { errors.push("openshell-version-pin-vitest job must run independently of generate-matrix"); } - if (Object.hasOwn(job, "if")) { - errors.push( - "openshell-version-pin-vitest job must run independently of workflow dispatch scenario filters", - ); + if (job.if !== expectedFreeStandingJobSelector(jobName)) { + errors.push("openshell-version-pin-vitest job must use the approved jobs selector"); } const jobEnv = asRecord(job.env); @@ -224,10 +226,8 @@ function validateOnboardNegativePathsVitestJob(errors: string[], jobs: WorkflowR if (Object.hasOwn(job, "needs")) { errors.push("onboard-negative-paths-vitest job must run independently of generate-matrix"); } - if (Object.hasOwn(job, "if")) { - errors.push( - "onboard-negative-paths-vitest job must run independently of workflow dispatch scenario filters", - ); + if (job.if !== expectedFreeStandingJobSelector(jobName)) { + errors.push("onboard-negative-paths-vitest job must use the approved jobs selector"); } const jobEnv = asRecord(job.env); @@ -312,6 +312,7 @@ export function validateE2eVitestScenariosWorkflowBoundary( const dispatchInputs = asRecord(workflowDispatch.inputs); requireInput(errors, dispatchInputs, "scenarios"); + requireInput(errors, dispatchInputs, "jobs"); if (Object.hasOwn(dispatchInputs, "test_filter")) { errors.push("workflow_dispatch must not expose legacy test_filter input"); } @@ -341,10 +342,14 @@ export function validateE2eVitestScenariosWorkflowBoundary( if (generateEnv.SCENARIOS !== "${{ inputs.scenarios }}") { errors.push("matrix generation step must pass scenarios through SCENARIOS env"); } + if (generateEnv.JOBS !== "${{ inputs.jobs }}") { + errors.push("matrix generation step must pass jobs through JOBS env"); + } requireRunContains(errors, generate, "npx tsx test/e2e-scenario/scenarios/run.ts"); requireRunContains(errors, generate, "--emit-live-matrix"); requireRunContains(errors, generate, "--scenarios"); requireRunContains(errors, generate, "^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$"); + requireRunContains(errors, generate, "Invalid jobs input"); requireRunDoesNotContain(errors, generate, "^[A-Za-z0-9._-]+"); requireRunContains(errors, generate, "## Vitest E2E Scenario Matrix"); requireRunContains(errors, generate, "| Scenario | Runner | Label |"); @@ -357,6 +362,9 @@ export function validateE2eVitestScenariosWorkflowBoundary( if (liveScenarios.needs !== "generate-matrix") { errors.push("live-scenarios job must depend on generate-matrix"); } + if (liveScenarios.if !== "${{ inputs.jobs == '' }}") { + errors.push("live-scenarios job must not run when a free-standing job selector is provided"); + } const strategy = asRecord(liveScenarios.strategy); if (strategy["fail-fast"] !== false) { errors.push("live-scenarios strategy.fail-fast must be false"); From 2095029ed4b79c3899b515d184e50063cab3cc6d Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 10:41:18 -0400 Subject: [PATCH 15/22] ci(e2e): allow selective Vitest job dispatch --- .github/workflows/e2e-vitest-scenarios.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 41cc16334c4..462821d6f49 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -272,7 +272,7 @@ jobs: # injection + real OpenClaw agent-turn contract. The retained legacy bash # lane remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. skill-agent-vitest: - if: ${{ inputs.scenarios == '' && (inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',skill-agent-vitest,')) }} + if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',skill-agent-vitest,') }} runs-on: ubuntu-latest timeout-minutes: 30 env: @@ -345,7 +345,7 @@ jobs: # protocol/history contract. The retained legacy bash lane remains the # source for full closeout until a later PR proves replacement and deletes it. openclaw-tui-chat-correlation-vitest: - if: ${{ inputs.scenarios == '' && inputs.jobs == '' }} + if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',openclaw-tui-chat-correlation-vitest,') }} runs-on: ubuntu-latest timeout-minutes: 75 env: From e7152aa1bd893d88c3e10a18789909c9ca734cd0 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 10:49:24 -0400 Subject: [PATCH 16/22] test(e2e): preserve skill agent fail-closed checks --- test/e2e-scenario/live/skill-agent.test.ts | 55 ++++++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index 95e4df296c3..bf037ebe598 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -3,7 +3,7 @@ import fs from "node:fs"; import path from "node:path"; - +import { describe, it } from "vitest"; import { buildAvailabilityProbeEnv } from "../fixtures/availability-env.ts"; import { type SandboxClient, @@ -72,6 +72,22 @@ function isExternalAgentVerificationFlake(text: string): boolean { ); } +function isAgentVerificationFailClosed(text: string): boolean { + // Preserve the existing helper's fail-closed ordering: a non-zero helper + // result that reports tool/security/runtime failure must not be turned into + // success just because the agent transcript also echoed the token. + return /SsrFBlockedError|Blocked hostname|Blocked: resolves to|transport error|provider error|ECONNREFUSED|EAI_AGAIN|gateway unavailable/i.test( + text, + ); +} + +function shouldSkipExternalAgentVerificationFailure( + text: string, + fixturePresent: boolean, +): boolean { + return fixturePresent && isExternalAgentVerificationFlake(text); +} + function isExternalProviderValidationFailure(text: string): boolean { return ( /NVIDIA Endpoints endpoint validation failed/i.test(text) && @@ -129,6 +145,30 @@ async function ignoreCleanupError(run: () => Promise): Promise { } } +describe("skill-agent live test local classifiers", () => { + it("does not treat helper fail-closed output as a skippable provider flake", () => { + const output = `--- agent stdout/stderr\nSsrFBlockedError\n${VERIFY_PHRASE}\n--- end ---`; + + expect(isAgentVerificationFailClosed(output)).toBe(true); + expect(shouldSkipExternalAgentVerificationFailure(output, true)).toBe(false); + }); + + it("skips only timeout-like agent verification failures after fixture presence is proven", () => { + const timeoutOutput = `--- agent stdout/stderr\nLLM idle timeout\n--- end ---`; + + expect(shouldSkipExternalAgentVerificationFailure(timeoutOutput, false)).toBe(false); + expect(shouldSkipExternalAgentVerificationFailure(timeoutOutput, true)).toBe(true); + expect(shouldSkipExternalAgentVerificationFailure("require is not defined", true)).toBe(false); + }); + + it("matches the token only inside the delimited agent section", () => { + expect(agentSectionContainsToken(`helper echoed ${VERIFY_PHRASE}`)).toBe(false); + expect( + agentSectionContainsToken(`--- agent stdout/stderr\n\`${VERIFY_PHRASE}\`\n--- end ---`), + ).toBe(true); + }); +}); + const runSkillAgentTest = shouldRunLiveE2EScenarios() ? test : test.skip; runSkillAgentTest( @@ -288,16 +328,23 @@ runSkillAgentTest( }); lastAgentOutput = resultText(verify); lastExitCode = verify.exitCode; - if (verify.exitCode === 0 || agentSectionContainsToken(lastAgentOutput)) { + if (verify.exitCode === 0) { + agentOk = true; + break; + } + if (isAgentVerificationFailClosed(lastAgentOutput)) { + break; + } + if (agentSectionContainsToken(lastAgentOutput)) { agentOk = true; break; } if (attempt < attempts) await sleep(RETRY_SLEEP_MS); } - if (!agentOk && isExternalAgentVerificationFlake(lastAgentOutput)) { + if (!agentOk) { const fixturePresent = await verifySkillFixturePresent(sandbox, SANDBOX_NAME); - if (fixturePresent) { + if (shouldSkipExternalAgentVerificationFailure(lastAgentOutput, fixturePresent)) { await artifacts.writeJson("scenario-result.json", { id: "skill-agent", status: "skipped", From cf2a3f74300b8b77ad51af54d6fcb3c8013802fa Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 11:04:38 -0400 Subject: [PATCH 17/22] test(e2e): harden skill agent workflow guards --- .github/workflows/e2e-vitest-scenarios.yaml | 29 +++++- test/e2e-scenario/live/skill-agent.test.ts | 45 ++++++--- .../e2e-scenarios-workflow.test.ts | 49 ++++++++++ tools/e2e-scenarios/workflow-boundary.mts | 98 +++++++++++++++++++ 4 files changed, 205 insertions(+), 16 deletions(-) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 462821d6f49..24f96ef7d5b 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -63,9 +63,32 @@ jobs: fi args+=(--scenarios "${SCENARIOS}") fi - if [ -n "${JOBS}" ] && [[ ! "${JOBS}" =~ ^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$ ]]; then - echo "::error::Invalid jobs input: ${JOBS}" >&2 - exit 1 + if [ -n "${JOBS}" ]; then + if [[ ! "${JOBS}" =~ ^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$ ]]; then + echo "::error::Invalid jobs input: ${JOBS}" >&2 + exit 1 + fi + allowed_jobs=( + openshell-version-pin-vitest + onboard-negative-paths-vitest + skill-agent-vitest + openclaw-tui-chat-correlation-vitest + gateway-guard-recovery + ) + IFS=',' read -r -a requested_jobs <<< "${JOBS}" + for requested_job in "${requested_jobs[@]}"; do + known_job=0 + for allowed_job in "${allowed_jobs[@]}"; do + if [[ "${requested_job}" == "${allowed_job}" ]]; then + known_job=1 + break + fi + done + if [[ "${known_job}" -ne 1 ]]; then + echo "::error::Unknown jobs input: ${requested_job}" >&2 + exit 1 + fi + done fi matrix="$(npx tsx test/e2e-scenario/scenarios/run.ts "${args[@]}")" echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index bf037ebe598..389af7624b7 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -64,9 +64,11 @@ function shellQuote(value: string): string { } function isExternalAgentVerificationFlake(text: string): boolean { - // Only provider/model/transport timeout signatures are skippable. OpenClaw - // tool/runtime errors must fail this migration guard because the contract is - // that the real agent can read SKILL.md and return the token. + // Only provider/model/transport timeout signatures are skippable, and only + // after the fixture is proven present. OpenClaw tool/runtime errors must fail + // this migration guard because the contract is that the real agent can read + // SKILL.md and return the token. This tolerance can be narrowed once the live + // provider/agent turn is consistently non-429/non-timeout in scheduled runs. return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|ssh\/agent exit 124|exit 124/i.test( text, ); @@ -89,6 +91,11 @@ function shouldSkipExternalAgentVerificationFailure( } function isExternalProviderValidationFailure(text: string): boolean { + // Onboarding can fail before sandbox creation when the external NVIDIA + // endpoint validation is rate-limited or unavailable. Treat only those + // live-service states as inconclusive; repo-local onboarding errors still + // fail. This can be narrowed when endpoint validation stops producing + // intermittent 429/timeout failures in scheduled live runs. return ( /NVIDIA Endpoints endpoint validation failed/i.test(text) && /HTTP 429|rate limit|quota|temporarily unavailable|timed out|timeout/i.test(text) @@ -216,6 +223,7 @@ runSkillAgentTest( ], }); + let sandboxProvisioned = false; const cleanupEnv = buildAvailabilityProbeEnv(); await ignoreCleanupError(() => host.command("node", [CLI_ENTRYPOINT, SANDBOX_NAME, "destroy", "--yes"], { @@ -233,20 +241,30 @@ runSkillAgentTest( ); cleanup.add(`destroy skill-agent sandbox ${SANDBOX_NAME}`, async () => { - await ignoreCleanupError(() => - host.command("node", [CLI_ENTRYPOINT, SANDBOX_NAME, "destroy", "--yes"], { + const destroy = await host.command( + "node", + [CLI_ENTRYPOINT, SANDBOX_NAME, "destroy", "--yes"], + { artifactName: "cleanup-nemoclaw-destroy-skill-agent", env: buildAvailabilityProbeEnv(), timeoutMs: 120_000, - }), - ); - await ignoreCleanupError(() => - sandbox.openshell(["sandbox", "delete", SANDBOX_NAME], { - artifactName: "cleanup-openshell-sandbox-delete-skill-agent", - env: buildAvailabilityProbeEnv(), - timeoutMs: 60_000, - }), + }, ); + const deleteSandbox = await sandbox.openshell(["sandbox", "delete", SANDBOX_NAME], { + artifactName: "cleanup-openshell-sandbox-delete-skill-agent", + env: buildAvailabilityProbeEnv(), + timeoutMs: 60_000, + }); + await artifacts.writeJson("cleanup-skill-agent-summary.json", { + sandboxProvisioned, + destroyExitCode: destroy.exitCode, + deleteExitCode: deleteSandbox.exitCode, + }); + if (sandboxProvisioned && destroy.exitCode !== 0 && deleteSandbox.exitCode !== 0) { + throw new Error( + `skill-agent cleanup failed\n${resultText(destroy)}\n${resultText(deleteSandbox)}`, + ); + } }); const onboard = await host.command( @@ -289,6 +307,7 @@ runSkillAgentTest( skip("NVIDIA endpoint validation was unavailable/rate-limited during onboarding"); } expect(onboard.exitCode, onboardText).toBe(0); + sandboxProvisioned = true; const addSkill = await host.command("bash", [ADD_SKILL_SCRIPT], { artifactName: "add-sandbox-skill-fixture", diff --git a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts index c106c6086b5..e12bd1abf9a 100644 --- a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts +++ b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts @@ -112,6 +112,37 @@ jobs: path: .e2e/onboard-negative-paths/ include-hidden-files: true if-no-files-found: error + skill-agent-vitest: + runs-on: ubuntu-latest + needs: generate-matrix + if: \${{ inputs.scenarios != '' }} + env: + E2E_ARTIFACT_DIR: \${{ github.workspace }}/.e2e/skill-agent + NEMOCLAW_RUN_E2E_SCENARIOS: "0" + NVIDIA_API_KEY: \${{ secrets.NVIDIA_API_KEY }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: true + - name: Set up Node + uses: actions/setup-node@v4 + env: + NVIDIA_API_KEY: \${{ secrets.NVIDIA_API_KEY }} + - name: Install root dependencies + run: npm install + - name: Build CLI + run: echo skip + - name: Run skill-agent live test + env: + NVIDIA_API_KEY: \${{ secrets.NVIDIA_API_KEY }} + run: npx vitest run --project e2e-scenarios-live "\${{ inputs.test_filter }}" + - name: Upload skill-agent artifacts + uses: actions/upload-artifact@v4 + with: + name: skill-agent + path: .e2e/skill-agent/ + include-hidden-files: true + if-no-files-found: error `, ); @@ -193,6 +224,24 @@ jobs: "onboard-negative-paths-vitest artifact upload must set include-hidden-files: false", "onboard-negative-paths-vitest artifact upload must ignore missing fixture artifacts", "onboard-negative-paths-vitest artifact upload retention-days must be 14", + "skill-agent-vitest job must run independently of generate-matrix", + "skill-agent-vitest job must use the approved jobs selector", + "skill-agent-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", + "skill-agent-vitest job must write artifacts under e2e-artifacts/vitest/skill-agent", + "skill-agent-vitest job must point NEMOCLAW_CLI_BIN at the repo CLI", + "skill-agent-vitest job env must not include NVIDIA_API_KEY", + "skill-agent-vitest checkout action must be pinned to a full commit SHA", + "skill-agent-vitest checkout step must set persist-credentials=false", + "skill-agent-vitest step 'Set up Node' env must not include NVIDIA_API_KEY", + "skill-agent-vitest setup-node action must be pinned to a full commit SHA", + "step 'Run skill-agent live test' run script must not interpolate dispatch inputs directly", + "step 'Run skill-agent live test' run script must include test/e2e-scenario/live/skill-agent.test.ts", + "skill-agent-vitest upload-artifact action must be pinned to a full commit SHA", + "skill-agent-vitest artifact upload name must be stable", + "artifact upload path must include e2e-artifacts/vitest/skill-agent/", + "skill-agent-vitest artifact upload must set include-hidden-files: false", + "skill-agent-vitest artifact upload must ignore missing fixture artifacts", + "skill-agent-vitest artifact upload retention-days must be 14", ]), ); } finally { diff --git a/tools/e2e-scenarios/workflow-boundary.mts b/tools/e2e-scenarios/workflow-boundary.mts index 5f6c705af68..9cab5430efc 100644 --- a/tools/e2e-scenarios/workflow-boundary.mts +++ b/tools/e2e-scenarios/workflow-boundary.mts @@ -212,6 +212,93 @@ function validateOpenShellVersionPinVitestJob(errors: string[], jobs: WorkflowRe } +function validateSkillAgentVitestJob(errors: string[], jobs: WorkflowRecord): void { + const jobName = "skill-agent-vitest"; + const job = asRecord(jobs[jobName]); + if (Object.keys(job).length === 0) { + errors.push("workflow missing skill-agent-vitest job"); + return; + } + + if (job["runs-on"] !== "ubuntu-latest") { + errors.push("skill-agent-vitest job must run on ubuntu-latest"); + } + if (Object.hasOwn(job, "needs")) { + errors.push("skill-agent-vitest job must run independently of generate-matrix"); + } + if (job.if !== expectedFreeStandingJobSelector(jobName)) { + errors.push("skill-agent-vitest job must use the approved jobs selector"); + } + + const jobEnv = asRecord(job.env); + if (jobEnv.NEMOCLAW_RUN_E2E_SCENARIOS !== "1") { + errors.push("skill-agent-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1"); + } + if (jobEnv.E2E_ARTIFACT_DIR !== "${{ github.workspace }}/e2e-artifacts/vitest/skill-agent") { + errors.push("skill-agent-vitest job must write artifacts under e2e-artifacts/vitest/skill-agent"); + } + if (!stringValue(jobEnv.NEMOCLAW_CLI_BIN).includes("bin/nemoclaw.js")) { + errors.push("skill-agent-vitest job must point NEMOCLAW_CLI_BIN at the repo CLI"); + } + requireEnvDoesNotExposeSecret(errors, "skill-agent-vitest job", jobEnv, "NVIDIA_API_KEY"); + + const steps = asSteps(job.steps); + requireNoDispatchInputInterpolation(errors, steps); + for (const step of steps) { + if (step.name !== "Run skill-agent live test") { + requireEnvDoesNotExposeSecret( + errors, + `skill-agent-vitest step '${step.name ?? step.uses ?? ""}'`, + asRecord(step.env), + "NVIDIA_API_KEY", + ); + } + } + + const checkout = steps.find((step) => stringValue(step.uses).startsWith("actions/checkout@")); + if (!checkout) errors.push("skill-agent-vitest job missing checkout step"); + requireFullShaAction(errors, checkout, "skill-agent-vitest checkout"); + if (asRecord(checkout?.with)["persist-credentials"] !== false) { + errors.push("skill-agent-vitest checkout step must set persist-credentials=false"); + } + + const setupNode = namedStep(steps, "Set up Node"); + if (!setupNode) errors.push("skill-agent-vitest job missing step: Set up Node"); + requireFullShaAction(errors, setupNode, "skill-agent-vitest setup-node"); + + const installRootDependencies = requireJobStep(errors, jobName, steps, "Install root dependencies"); + requireRunContains(errors, installRootDependencies, "npm ci --ignore-scripts"); + + const buildCli = requireJobStep(errors, jobName, steps, "Build CLI"); + requireRunContains(errors, buildCli, "npm run build:cli"); + + const runVitest = requireJobStep(errors, jobName, steps, "Run skill-agent live test"); + const runEnv = asRecord(runVitest?.env); + if (runEnv.NVIDIA_API_KEY !== "${{ secrets.NVIDIA_API_KEY }}") { + errors.push("skill-agent-vitest run step must receive NVIDIA_API_KEY from secrets"); + } + requireRunContains(errors, runVitest, "npx vitest run --project e2e-scenarios-live"); + requireRunContains(errors, runVitest, "test/e2e-scenario/live/skill-agent.test.ts"); + + const upload = requireJobStep(errors, jobName, steps, "Upload skill-agent artifacts"); + requireFullShaAction(errors, upload, "skill-agent-vitest upload-artifact"); + const uploadWith = asRecord(upload?.with); + if (uploadWith.name !== "e2e-vitest-scenarios-skill-agent") { + errors.push("skill-agent-vitest artifact upload name must be stable"); + } + const uploadPath = stringValue(uploadWith.path); + requireUploadPathContains(errors, uploadPath, "e2e-artifacts/vitest/skill-agent/"); + if (uploadWith["include-hidden-files"] !== false) { + errors.push("skill-agent-vitest artifact upload must set include-hidden-files: false"); + } + if (uploadWith["if-no-files-found"] !== "ignore") { + errors.push("skill-agent-vitest artifact upload must ignore missing fixture artifacts"); + } + if (uploadWith["retention-days"] !== 14) { + errors.push("skill-agent-vitest artifact upload retention-days must be 14"); + } +} + function validateOnboardNegativePathsVitestJob(errors: string[], jobs: WorkflowRecord): void { const jobName = "onboard-negative-paths-vitest"; const job = asRecord(jobs[jobName]); @@ -350,6 +437,16 @@ export function validateE2eVitestScenariosWorkflowBoundary( requireRunContains(errors, generate, "--scenarios"); requireRunContains(errors, generate, "^[A-Za-z0-9_-]+(,[A-Za-z0-9_-]+)*$"); requireRunContains(errors, generate, "Invalid jobs input"); + requireRunContains(errors, generate, "Unknown jobs input"); + for (const jobName of [ + "openshell-version-pin-vitest", + "onboard-negative-paths-vitest", + "skill-agent-vitest", + "openclaw-tui-chat-correlation-vitest", + "gateway-guard-recovery", + ]) { + requireRunContains(errors, generate, jobName); + } requireRunDoesNotContain(errors, generate, "^[A-Za-z0-9._-]+"); requireRunContains(errors, generate, "## Vitest E2E Scenario Matrix"); requireRunContains(errors, generate, "| Scenario | Runner | Label |"); @@ -490,6 +587,7 @@ export function validateE2eVitestScenariosWorkflowBoundary( validateOpenShellVersionPinVitestJob(errors, jobs); validateOnboardNegativePathsVitestJob(errors, jobs); + validateSkillAgentVitestJob(errors, jobs); return errors; } From 8e12853d1ede85f84c4f9f08cfd94cd19a1afed0 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 11:20:13 -0400 Subject: [PATCH 18/22] test(e2e): narrow skill agent selectors --- .github/workflows/e2e-vitest-scenarios.yaml | 16 ++++++++++----- test/e2e-scenario/live/skill-agent.test.ts | 12 +++++++++++ .../e2e-scenarios-workflow.test.ts | 2 +- tools/e2e-scenarios/workflow-boundary.mts | 20 ++++++++++++++++--- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 24f96ef7d5b..5eced683d1a 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -72,8 +72,6 @@ jobs: openshell-version-pin-vitest onboard-negative-paths-vitest skill-agent-vitest - openclaw-tui-chat-correlation-vitest - gateway-guard-recovery ) IFS=',' read -r -a requested_jobs <<< "${JOBS}" for requested_job in "${requested_jobs[@]}"; do @@ -359,7 +357,15 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: e2e-vitest-scenarios-skill-agent - path: e2e-artifacts/vitest/skill-agent/ + path: | + e2e-artifacts/vitest/skill-agent/*/artifact-summary.json + e2e-artifacts/vitest/skill-agent/*/cleanup.json + e2e-artifacts/vitest/skill-agent/*/cleanup-skill-agent-summary.json + e2e-artifacts/vitest/skill-agent/*/scenario.json + e2e-artifacts/vitest/skill-agent/*/scenario-result.json + e2e-artifacts/vitest/skill-agent/*/shell/*.result.json + e2e-artifacts/vitest/skill-agent/*/shell/*.stdout.txt + e2e-artifacts/vitest/skill-agent/*/shell/*.stderr.txt include-hidden-files: false if-no-files-found: ignore retention-days: 14 @@ -368,7 +374,7 @@ jobs: # protocol/history contract. The retained legacy bash lane remains the # source for full closeout until a later PR proves replacement and deletes it. openclaw-tui-chat-correlation-vitest: - if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',openclaw-tui-chat-correlation-vitest,') }} + if: ${{ inputs.jobs == '' }} runs-on: ubuntu-latest timeout-minutes: 75 env: @@ -447,7 +453,7 @@ jobs: # restore the /tmp guard chain after pod recreate). Will fail on `main` # until the #2701 fix lands; flips green afterwards. gateway-guard-recovery: - if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',gateway-guard-recovery,') }} + if: ${{ inputs.jobs == '' }} runs-on: ubuntu-latest timeout-minutes: 45 env: diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index 389af7624b7..48e60a10bbe 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -168,6 +168,18 @@ describe("skill-agent live test local classifiers", () => { expect(shouldSkipExternalAgentVerificationFailure("require is not defined", true)).toBe(false); }); + it("skips only NVIDIA endpoint validation outages during onboarding", () => { + expect( + isExternalProviderValidationFailure( + "NVIDIA Endpoints endpoint validation failed.\nChat Completions API validation returned HTTP 429", + ), + ).toBe(true); + expect(isExternalProviderValidationFailure("local docker preflight timed out")).toBe(false); + expect( + isExternalProviderValidationFailure("NVIDIA Endpoints endpoint validation failed."), + ).toBe(false); + }); + it("matches the token only inside the delimited agent section", () => { expect(agentSectionContainsToken(`helper echoed ${VERIFY_PHRASE}`)).toBe(false); expect( diff --git a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts index e12bd1abf9a..8a47109990c 100644 --- a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts +++ b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts @@ -238,7 +238,7 @@ jobs: "step 'Run skill-agent live test' run script must include test/e2e-scenario/live/skill-agent.test.ts", "skill-agent-vitest upload-artifact action must be pinned to a full commit SHA", "skill-agent-vitest artifact upload name must be stable", - "artifact upload path must include e2e-artifacts/vitest/skill-agent/", + "artifact upload path must include e2e-artifacts/vitest/skill-agent/*/scenario-result.json", "skill-agent-vitest artifact upload must set include-hidden-files: false", "skill-agent-vitest artifact upload must ignore missing fixture artifacts", "skill-agent-vitest artifact upload retention-days must be 14", diff --git a/tools/e2e-scenarios/workflow-boundary.mts b/tools/e2e-scenarios/workflow-boundary.mts index 9cab5430efc..00a9b41bb65 100644 --- a/tools/e2e-scenarios/workflow-boundary.mts +++ b/tools/e2e-scenarios/workflow-boundary.mts @@ -287,7 +287,23 @@ function validateSkillAgentVitestJob(errors: string[], jobs: WorkflowRecord): vo errors.push("skill-agent-vitest artifact upload name must be stable"); } const uploadPath = stringValue(uploadWith.path); - requireUploadPathContains(errors, uploadPath, "e2e-artifacts/vitest/skill-agent/"); + for (const expected of [ + "e2e-artifacts/vitest/skill-agent/*/artifact-summary.json", + "e2e-artifacts/vitest/skill-agent/*/cleanup.json", + "e2e-artifacts/vitest/skill-agent/*/cleanup-skill-agent-summary.json", + "e2e-artifacts/vitest/skill-agent/*/scenario.json", + "e2e-artifacts/vitest/skill-agent/*/scenario-result.json", + "e2e-artifacts/vitest/skill-agent/*/shell/*.result.json", + "e2e-artifacts/vitest/skill-agent/*/shell/*.stdout.txt", + "e2e-artifacts/vitest/skill-agent/*/shell/*.stderr.txt", + ]) { + requireUploadPathContains(errors, uploadPath, expected); + } + for (const line of uploadPath.split("\n")) { + if (line.trim() === "e2e-artifacts/vitest/skill-agent/") { + errors.push("skill-agent-vitest artifact upload path must not list the whole skill-agent artifact directory"); + } + } if (uploadWith["include-hidden-files"] !== false) { errors.push("skill-agent-vitest artifact upload must set include-hidden-files: false"); } @@ -442,8 +458,6 @@ export function validateE2eVitestScenariosWorkflowBoundary( "openshell-version-pin-vitest", "onboard-negative-paths-vitest", "skill-agent-vitest", - "openclaw-tui-chat-correlation-vitest", - "gateway-guard-recovery", ]) { requireRunContains(errors, generate, jobName); } From 5ae97ec50c14baa5cb17adf0a703a599f377fcbf Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 11:49:30 -0400 Subject: [PATCH 19/22] ci(e2e): validate Vitest job selectors --- .github/workflows/e2e-vitest-scenarios.yaml | 15 +++++++++----- test/e2e-scenario/live/skill-agent.test.ts | 10 ++++++++-- .../e2e-scenarios-workflow.test.ts | 9 +++------ tools/e2e-scenarios/workflow-boundary.mts | 20 +++++++++---------- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index 5eced683d1a..6539e2b3f4b 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -206,7 +206,8 @@ jobs: # because the matrix above only runs registry-scenarios.test.ts. Modeled on # #5049's free-standing pattern. openshell-version-pin-vitest: - if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',openshell-version-pin-vitest,') }} + needs: generate-matrix + if: ${{ needs.generate-matrix.result == 'success' && (inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',openshell-version-pin-vitest,')) }} runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -246,7 +247,8 @@ jobs: retention-days: 14 onboard-negative-paths-vitest: - if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',onboard-negative-paths-vitest,') }} + needs: generate-matrix + if: ${{ needs.generate-matrix.result == 'success' && (inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',onboard-negative-paths-vitest,')) }} runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -293,7 +295,8 @@ jobs: # injection + real OpenClaw agent-turn contract. The retained legacy bash # lane remains in nightly-e2e.yaml until #5098 Phase 11 shell retirement. skill-agent-vitest: - if: ${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',skill-agent-vitest,') }} + needs: generate-matrix + if: ${{ needs.generate-matrix.result == 'success' && (inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',skill-agent-vitest,')) }} runs-on: ubuntu-latest timeout-minutes: 30 env: @@ -374,7 +377,8 @@ jobs: # protocol/history contract. The retained legacy bash lane remains the # source for full closeout until a later PR proves replacement and deletes it. openclaw-tui-chat-correlation-vitest: - if: ${{ inputs.jobs == '' }} + needs: generate-matrix + if: ${{ needs.generate-matrix.result == 'success' && inputs.jobs == '' }} runs-on: ubuntu-latest timeout-minutes: 75 env: @@ -453,7 +457,8 @@ jobs: # restore the /tmp guard chain after pod recreate). Will fail on `main` # until the #2701 fix lands; flips green afterwards. gateway-guard-recovery: - if: ${{ inputs.jobs == '' }} + needs: generate-matrix + if: ${{ needs.generate-matrix.result == 'success' && inputs.jobs == '' }} runs-on: ubuntu-latest timeout-minutes: 45 env: diff --git a/test/e2e-scenario/live/skill-agent.test.ts b/test/e2e-scenario/live/skill-agent.test.ts index 48e60a10bbe..7aea5b070fa 100644 --- a/test/e2e-scenario/live/skill-agent.test.ts +++ b/test/e2e-scenario/live/skill-agent.test.ts @@ -69,7 +69,7 @@ function isExternalAgentVerificationFlake(text: string): boolean { // this migration guard because the contract is that the real agent can read // SKILL.md and return the token. This tolerance can be narrowed once the live // provider/agent turn is consistently non-429/non-timeout in scheduled runs. - return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|ssh\/agent exit 124|exit 124/i.test( + return /LLM idle timeout|request timed out|fetch timeout|model did not produce a response|ssh\/agent exit 124|exit 124|HTTP 429|\b429\b|rate[- ]?limit|quota|temporarily unavailable/i.test( text, ); } @@ -87,7 +87,9 @@ function shouldSkipExternalAgentVerificationFailure( text: string, fixturePresent: boolean, ): boolean { - return fixturePresent && isExternalAgentVerificationFlake(text); + return ( + fixturePresent && !isAgentVerificationFailClosed(text) && isExternalAgentVerificationFlake(text) + ); } function isExternalProviderValidationFailure(text: string): boolean { @@ -166,6 +168,10 @@ describe("skill-agent live test local classifiers", () => { expect(shouldSkipExternalAgentVerificationFailure(timeoutOutput, false)).toBe(false); expect(shouldSkipExternalAgentVerificationFailure(timeoutOutput, true)).toBe(true); expect(shouldSkipExternalAgentVerificationFailure("require is not defined", true)).toBe(false); + expect(shouldSkipExternalAgentVerificationFailure("HTTP 429 rate limit", true)).toBe(true); + expect( + shouldSkipExternalAgentVerificationFailure("SsrFBlockedError plus request timed out", true), + ).toBe(false); }); it("skips only NVIDIA endpoint validation outages during onboarding", () => { diff --git a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts index 8a47109990c..62b77a9279b 100644 --- a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts +++ b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts @@ -186,8 +186,7 @@ jobs: "artifact upload path must include e2e-artifacts/vitest/${{ matrix.id }}/shell/", "artifact upload retention-days must be 14", "upload-artifact action must be pinned to a full commit SHA", - "openshell-version-pin-vitest job must run independently of generate-matrix", - "openshell-version-pin-vitest job must use the approved jobs selector", + "openshell-version-pin-vitest job must use the approved validated jobs selector", "openshell-version-pin-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", "openshell-version-pin-vitest job must write artifacts under e2e-artifacts/vitest/openshell-version-pin", "openshell-version-pin-vitest job env must not include NVIDIA_API_KEY", @@ -205,8 +204,7 @@ jobs: "openshell-version-pin-vitest artifact upload must set include-hidden-files: false", "openshell-version-pin-vitest artifact upload must ignore missing fixture artifacts", "openshell-version-pin-vitest artifact upload retention-days must be 14", - "onboard-negative-paths-vitest job must run independently of generate-matrix", - "onboard-negative-paths-vitest job must use the approved jobs selector", + "onboard-negative-paths-vitest job must use the approved validated jobs selector", "onboard-negative-paths-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", "onboard-negative-paths-vitest job must write artifacts under e2e-artifacts/vitest/onboard-negative-paths", "onboard-negative-paths-vitest job env must not include NVIDIA_API_KEY", @@ -224,8 +222,7 @@ jobs: "onboard-negative-paths-vitest artifact upload must set include-hidden-files: false", "onboard-negative-paths-vitest artifact upload must ignore missing fixture artifacts", "onboard-negative-paths-vitest artifact upload retention-days must be 14", - "skill-agent-vitest job must run independently of generate-matrix", - "skill-agent-vitest job must use the approved jobs selector", + "skill-agent-vitest job must use the approved validated jobs selector", "skill-agent-vitest job must set NEMOCLAW_RUN_E2E_SCENARIOS=1", "skill-agent-vitest job must write artifacts under e2e-artifacts/vitest/skill-agent", "skill-agent-vitest job must point NEMOCLAW_CLI_BIN at the repo CLI", diff --git a/tools/e2e-scenarios/workflow-boundary.mts b/tools/e2e-scenarios/workflow-boundary.mts index 00a9b41bb65..4abac937741 100644 --- a/tools/e2e-scenarios/workflow-boundary.mts +++ b/tools/e2e-scenarios/workflow-boundary.mts @@ -123,7 +123,7 @@ function requireNoDispatchInputInterpolation( } function expectedFreeStandingJobSelector(jobName: string): string { - return `\${{ inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',${jobName},') }}`; + return `\${{ needs.generate-matrix.result == 'success' && (inputs.jobs == '' || contains(format(',{0},', inputs.jobs), ',${jobName},')) }}`; } function validateOpenShellVersionPinVitestJob(errors: string[], jobs: WorkflowRecord): void { @@ -137,11 +137,11 @@ function validateOpenShellVersionPinVitestJob(errors: string[], jobs: WorkflowRe if (job["runs-on"] !== "ubuntu-latest") { errors.push("openshell-version-pin-vitest job must run on ubuntu-latest"); } - if (Object.hasOwn(job, "needs")) { - errors.push("openshell-version-pin-vitest job must run independently of generate-matrix"); + if (job.needs !== "generate-matrix") { + errors.push("openshell-version-pin-vitest job must depend on generate-matrix validation"); } if (job.if !== expectedFreeStandingJobSelector(jobName)) { - errors.push("openshell-version-pin-vitest job must use the approved jobs selector"); + errors.push("openshell-version-pin-vitest job must use the approved validated jobs selector"); } const jobEnv = asRecord(job.env); @@ -223,11 +223,11 @@ function validateSkillAgentVitestJob(errors: string[], jobs: WorkflowRecord): vo if (job["runs-on"] !== "ubuntu-latest") { errors.push("skill-agent-vitest job must run on ubuntu-latest"); } - if (Object.hasOwn(job, "needs")) { - errors.push("skill-agent-vitest job must run independently of generate-matrix"); + if (job.needs !== "generate-matrix") { + errors.push("skill-agent-vitest job must depend on generate-matrix validation"); } if (job.if !== expectedFreeStandingJobSelector(jobName)) { - errors.push("skill-agent-vitest job must use the approved jobs selector"); + errors.push("skill-agent-vitest job must use the approved validated jobs selector"); } const jobEnv = asRecord(job.env); @@ -326,11 +326,11 @@ function validateOnboardNegativePathsVitestJob(errors: string[], jobs: WorkflowR if (job["runs-on"] !== "ubuntu-latest") { errors.push("onboard-negative-paths-vitest job must run on ubuntu-latest"); } - if (Object.hasOwn(job, "needs")) { - errors.push("onboard-negative-paths-vitest job must run independently of generate-matrix"); + if (job.needs !== "generate-matrix") { + errors.push("onboard-negative-paths-vitest job must depend on generate-matrix validation"); } if (job.if !== expectedFreeStandingJobSelector(jobName)) { - errors.push("onboard-negative-paths-vitest job must use the approved jobs selector"); + errors.push("onboard-negative-paths-vitest job must use the approved validated jobs selector"); } const jobEnv = asRecord(job.env); From ec346fe5893963688a4fcf51cff9820aabfcd6db Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 12:25:07 -0400 Subject: [PATCH 20/22] test(e2e): address recovery guard feedback --- test/e2e-scenario/fixtures/clients/gateway.ts | 2 +- test/e2e-scenario/live/gateway-guard-recovery.test.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/e2e-scenario/fixtures/clients/gateway.ts b/test/e2e-scenario/fixtures/clients/gateway.ts index c82fcd5ae5d..663a2bc15d5 100644 --- a/test/e2e-scenario/fixtures/clients/gateway.ts +++ b/test/e2e-scenario/fixtures/clients/gateway.ts @@ -218,7 +218,7 @@ export class GatewayClient { ); } - const samples = Math.max(1, Math.floor(options.durationSeconds / pollIntervalSeconds)); + const samples = Math.max(1, Math.ceil(options.durationSeconds / pollIntervalSeconds)); for (let i = 0; i < samples; i += 1) { await sleepSeconds(pollIntervalSeconds); const pid = await this.resolveGatewayPid(instance); diff --git a/test/e2e-scenario/live/gateway-guard-recovery.test.ts b/test/e2e-scenario/live/gateway-guard-recovery.test.ts index b8a56a83b17..8455dc30776 100644 --- a/test/e2e-scenario/live/gateway-guard-recovery.test.ts +++ b/test/e2e-scenario/live/gateway-guard-recovery.test.ts @@ -97,8 +97,11 @@ test("gateway recovery restores /tmp guard chain after pod-recreate wipe (#2701) cleanup.add(`recovery-result-${instance.sandboxName}`, async () => { await artifacts.writeJson("recovery-result.json", { exitCode: recoveryResult.exitCode, + signal: recoveryResult.signal, }); }); + expect(recoveryResult.exitCode).toBe(0); + expect(recoveryResult.signal).toBeNull(); // ── Assert #2701 contract ──────────────────────────────────────── // After recovery completes, the guard chain MUST be restored. Today From c415b1e2cd1db9c26c88bffe24895bf777b245e2 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 12:31:22 -0400 Subject: [PATCH 21/22] Revert "test(e2e): address recovery guard feedback" This reverts commit ec346fe5893963688a4fcf51cff9820aabfcd6db. --- test/e2e-scenario/fixtures/clients/gateway.ts | 2 +- test/e2e-scenario/live/gateway-guard-recovery.test.ts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/test/e2e-scenario/fixtures/clients/gateway.ts b/test/e2e-scenario/fixtures/clients/gateway.ts index 663a2bc15d5..c82fcd5ae5d 100644 --- a/test/e2e-scenario/fixtures/clients/gateway.ts +++ b/test/e2e-scenario/fixtures/clients/gateway.ts @@ -218,7 +218,7 @@ export class GatewayClient { ); } - const samples = Math.max(1, Math.ceil(options.durationSeconds / pollIntervalSeconds)); + const samples = Math.max(1, Math.floor(options.durationSeconds / pollIntervalSeconds)); for (let i = 0; i < samples; i += 1) { await sleepSeconds(pollIntervalSeconds); const pid = await this.resolveGatewayPid(instance); diff --git a/test/e2e-scenario/live/gateway-guard-recovery.test.ts b/test/e2e-scenario/live/gateway-guard-recovery.test.ts index 8455dc30776..b8a56a83b17 100644 --- a/test/e2e-scenario/live/gateway-guard-recovery.test.ts +++ b/test/e2e-scenario/live/gateway-guard-recovery.test.ts @@ -97,11 +97,8 @@ test("gateway recovery restores /tmp guard chain after pod-recreate wipe (#2701) cleanup.add(`recovery-result-${instance.sandboxName}`, async () => { await artifacts.writeJson("recovery-result.json", { exitCode: recoveryResult.exitCode, - signal: recoveryResult.signal, }); }); - expect(recoveryResult.exitCode).toBe(0); - expect(recoveryResult.signal).toBeNull(); // ── Assert #2701 contract ──────────────────────────────────────── // After recovery completes, the guard chain MUST be restored. Today From bdb68876e79c26a82b075c1f52939a126e9bc1ab Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Thu, 11 Jun 2026 15:11:04 -0400 Subject: [PATCH 22/22] test(e2e): install openshell for skill-agent vitest --- .github/workflows/e2e-vitest-scenarios.yaml | 20 +++++++++++++++++++ .../e2e-scenarios-workflow.test.ts | 2 ++ tools/e2e-scenarios/workflow-boundary.mts | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/.github/workflows/e2e-vitest-scenarios.yaml b/.github/workflows/e2e-vitest-scenarios.yaml index edad3c10b92..ab03698cb92 100644 --- a/.github/workflows/e2e-vitest-scenarios.yaml +++ b/.github/workflows/e2e-vitest-scenarios.yaml @@ -353,11 +353,31 @@ jobs: - name: Build CLI run: npm run build:cli + - name: Install OpenShell CLI + # The migrated skill-agent lane invokes helper scripts that call + # `openshell` after the repo CLI onboard command has returned. Install + # and resolve OpenShell in the workflow parent so PATH/OPENSHELL_BIN is + # available to both Vitest and the bash helpers. + run: bash scripts/install-openshell.sh + - name: Run skill-agent live test env: NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }} run: | set -euo pipefail + export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH" + if command -v openshell >/dev/null 2>&1; then + OPENSHELL_BIN="$(command -v openshell)" + elif [ -x "$HOME/.local/bin/openshell" ]; then + OPENSHELL_BIN="$HOME/.local/bin/openshell" + else + echo "::error::OpenShell CLI not found after install" + ls -la /usr/local/bin/openshell "$HOME/.local/bin/openshell" 2>&1 || true + exit 1 + fi + export OPENSHELL_BIN + echo "Using OPENSHELL_BIN=$OPENSHELL_BIN" + "$OPENSHELL_BIN" --version npx vitest run --project e2e-scenarios-live \ test/e2e-scenario/live/skill-agent.test.ts \ --silent=false --reporter=default diff --git a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts index 772ea4e509b..2e9f03b2387 100644 --- a/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts +++ b/test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts @@ -260,7 +260,9 @@ jobs: "skill-agent-vitest checkout step must set persist-credentials=false", "skill-agent-vitest step 'Set up Node' env must not include NVIDIA_API_KEY", "skill-agent-vitest setup-node action must be pinned to a full commit SHA", + "skill-agent-vitest job missing step: Install OpenShell CLI", "step 'Run skill-agent live test' run script must not interpolate dispatch inputs directly", + "step 'Run skill-agent live test' run script must include export OPENSHELL_BIN", "step 'Run skill-agent live test' run script must include test/e2e-scenario/live/skill-agent.test.ts", "skill-agent-vitest upload-artifact action must be pinned to a full commit SHA", "skill-agent-vitest artifact upload name must be stable", diff --git a/tools/e2e-scenarios/workflow-boundary.mts b/tools/e2e-scenarios/workflow-boundary.mts index fa80d003bba..2e3b3c8e390 100644 --- a/tools/e2e-scenarios/workflow-boundary.mts +++ b/tools/e2e-scenarios/workflow-boundary.mts @@ -308,11 +308,17 @@ function validateSkillAgentVitestJob(errors: string[], jobs: WorkflowRecord): vo const buildCli = requireJobStep(errors, jobName, steps, "Build CLI"); requireRunContains(errors, buildCli, "npm run build:cli"); + const installOpenShell = requireJobStep(errors, jobName, steps, "Install OpenShell CLI"); + requireRunContains(errors, installOpenShell, "bash scripts/install-openshell.sh"); + const runVitest = requireJobStep(errors, jobName, steps, "Run skill-agent live test"); const runEnv = asRecord(runVitest?.env); if (runEnv.NVIDIA_API_KEY !== "${{ secrets.NVIDIA_API_KEY }}") { errors.push("skill-agent-vitest run step must receive NVIDIA_API_KEY from secrets"); } + requireRunContains(errors, runVitest, "export PATH=\"$HOME/.local/bin:$HOME/.npm-global/bin:$PATH\""); + requireRunContains(errors, runVitest, "OPENSHELL_BIN=\"$(command -v openshell)\""); + requireRunContains(errors, runVitest, "export OPENSHELL_BIN"); requireRunContains(errors, runVitest, "npx vitest run --project e2e-scenarios-live"); requireRunContains(errors, runVitest, "test/e2e-scenario/live/skill-agent.test.ts");