From 3dd40cb8caab4724d2379ca013983b68bed4850b Mon Sep 17 00:00:00 2001 From: Prekshi Vyas Date: Sun, 22 Nov 2026 16:24:36 -0800 Subject: [PATCH 1/4] test(e2e): require installed skill fixture evidence Signed-off-by: Prekshi Vyas --- test/e2e/live/skill-agent.test.ts | 2 +- test/e2e/support/skill-agent-classifiers.test.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/e2e/live/skill-agent.test.ts b/test/e2e/live/skill-agent.test.ts index ff5d1f0e9f3..39337c58415 100644 --- a/test/e2e/live/skill-agent.test.ts +++ b/test/e2e/live/skill-agent.test.ts @@ -71,7 +71,7 @@ function buildVerifySkillFixtureScript(): string { 'test -f "$path"', 'grep -Fq "$token" "$path"', 'echo "SKILL_TOKEN_PATH=$path"', - ].join("; "); + ].join(" && "); } async function verifySkillFixturePresent( diff --git a/test/e2e/support/skill-agent-classifiers.test.ts b/test/e2e/support/skill-agent-classifiers.test.ts index a3ac8bc1682..61573331651 100644 --- a/test/e2e/support/skill-agent-classifiers.test.ts +++ b/test/e2e/support/skill-agent-classifiers.test.ts @@ -71,6 +71,7 @@ describe("skill-agent live test local classifiers", () => { encoding: "utf8", env: { PATH: `${path.dirname(process.execPath)}:/usr/bin:/bin`, + TMPDIR: fixtureDir, SANDBOX_NAME: "test-sandbox", SKILL_FILE: skillFile, SKILL_ID: "expected-skill", From 18b2d1f8fe192dd42179886c50d95a8eb0b0799d Mon Sep 17 00:00:00 2001 From: Prekshi Vyas Date: Sun, 22 Nov 2026 17:10:53 -0800 Subject: [PATCH 2/4] test(e2e): cover skill fixture probe failure states Signed-off-by: Prekshi Vyas --- test/e2e/live/skill-agent.test.ts | 19 ++-------- .../support/skill-agent-classifiers.test.ts | 37 +++++++++++++++++++ test/e2e/support/skill-agent-classifiers.ts | 14 ++++++- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/test/e2e/live/skill-agent.test.ts b/test/e2e/live/skill-agent.test.ts index 39337c58415..4cf3b58f9b1 100644 --- a/test/e2e/live/skill-agent.test.ts +++ b/test/e2e/live/skill-agent.test.ts @@ -4,7 +4,6 @@ import { approveOpenClawAdminScope } from "./openclaw-admin-scope.ts"; import fs from "node:fs"; import path from "node:path"; -import { shellQuote } from "../../../src/lib/core/shell-quote"; import { execTimeout, testTimeout } from "../../helpers/timeouts.ts"; import { buildAvailabilityProbeEnv } from "../fixtures/availability-env.ts"; import { resultText } from "../fixtures/clients/command.ts"; @@ -18,6 +17,7 @@ import { requireHostedInferenceConfig } from "../fixtures/hosted-inference.ts"; import { CLI_ENTRYPOINT, REPO_ROOT } from "../fixtures/paths.ts"; import { agentSectionContainsToken, + buildVerifySkillFixtureScript, isAgentVerificationFailClosed, isExternalProviderValidationFailure, shouldSkipExternalAgentVerificationFailure, @@ -61,26 +61,15 @@ function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } -function buildVerifySkillFixtureScript(): string { - // Keep this readable as discrete clauses while emitting one atomic `sh -lc` - // expression with consistent error propagation. - const skillPath = `/sandbox/.openclaw/workspace/skills/${SKILL_ID}/SKILL.md`; - return [ - `token=${shellQuote(VERIFY_PHRASE)}`, - `path=${shellQuote(skillPath)}`, - 'test -f "$path"', - 'grep -Fq "$token" "$path"', - 'echo "SKILL_TOKEN_PATH=$path"', - ].join(" && "); -} - async function verifySkillFixturePresent( sandbox: SandboxClient, sandboxName: string, ): Promise { const result = await sandbox.execShell( sandboxName, - trustedSandboxShellScript(buildVerifySkillFixtureScript()), + trustedSandboxShellScript( + buildVerifySkillFixtureScript(`/sandbox/.openclaw/workspace/skills/${SKILL_ID}/SKILL.md`), + ), { artifactName: "verify-skill-fixture-present", env: buildAvailabilityProbeEnv(), diff --git a/test/e2e/support/skill-agent-classifiers.test.ts b/test/e2e/support/skill-agent-classifiers.test.ts index 61573331651..8e30a25193f 100644 --- a/test/e2e/support/skill-agent-classifiers.test.ts +++ b/test/e2e/support/skill-agent-classifiers.test.ts @@ -10,6 +10,7 @@ import { describe, expect, it } from "vitest"; import { agentSectionContainsToken, + buildVerifySkillFixtureScript, isAgentVerificationFailClosed, isExternalProviderValidationFailure, shouldSkipExternalAgentVerificationFailure, @@ -23,6 +24,42 @@ const ADD_SKILL_SCRIPT = path.join( ); describe("skill-agent live test local classifiers", () => { + it.each([ + ["missing", "missing/SKILL.md", 1, false], + ["tokenless", "tokenless/SKILL.md", 1, false], + ["matching", "matching/SKILL.md", 0, true], + ] as const)( + "requires the verification token in a %s fixture", + (_name, file, exitCode, present) => { + const fixtureDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-skill-presence-")); + try { + fs.mkdirSync(path.join(fixtureDir, "tokenless")); + fs.mkdirSync(path.join(fixtureDir, "matching")); + fs.writeFileSync( + path.join(fixtureDir, "tokenless/SKILL.md"), + "No verification token here.\n", + ); + fs.writeFileSync(path.join(fixtureDir, "matching/SKILL.md"), `${VERIFY_PHRASE}\n`); + const result = spawnSync( + "/bin/sh", + ["-lc", buildVerifySkillFixtureScript(path.join(fixtureDir, file))], + { + encoding: "utf8", + env: { PATH: "/usr/bin:/bin", HOME: fixtureDir, TMPDIR: fixtureDir }, + }, + ); + + expect(result.status).toBe(exitCode); + expect(result.stdout.includes("SKILL_TOKEN_PATH=")).toBe(present); + expect( + shouldSkipExternalAgentVerificationFailure("LLM idle timeout", result.status === 0), + ).toBe(present); + } finally { + fs.rmSync(fixtureDir, { recursive: true, force: true }); + } + }, + ); + it("does not treat helper fail-closed output as a skippable provider flake", () => { const output = `--- agent stdout/stderr\nSsrFBlockedError\n${VERIFY_PHRASE}\n--- end ---`; diff --git a/test/e2e/support/skill-agent-classifiers.ts b/test/e2e/support/skill-agent-classifiers.ts index 415b3931f63..4245981e6f4 100644 --- a/test/e2e/support/skill-agent-classifiers.ts +++ b/test/e2e/support/skill-agent-classifiers.ts @@ -1,13 +1,25 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -// Pure predicate helpers shared by the skill-agent live E2E target and its +import { shellQuote } from "../../../src/lib/core/shell-quote"; + +// Fixture probe and predicate helpers shared by the skill-agent live E2E target and its // PR-collected unit tests. Keeping them here lets the fast e2e-support project // exercise the classification logic without gating on NEMOCLAW_RUN_LIVE_E2E=1. // Token the injected skill fixture must echo back through the agent transcript. export const VERIFY_PHRASE = "SKILL_SMOKE_VERIFY_K9X2"; +export function buildVerifySkillFixtureScript(skillPath: string): string { + return [ + `token=${shellQuote(VERIFY_PHRASE)}`, + `path=${shellQuote(skillPath)}`, + 'test -f "$path"', + 'grep -Fq "$token" "$path"', + 'echo "SKILL_TOKEN_PATH=$path"', + ].join(" && "); +} + export function isExternalAgentVerificationFlake(text: string): boolean { // Only provider/model/transport timeout signatures are skippable, and only // after the fixture is proven present. OpenClaw tool/runtime errors must fail From 5d2c96e3713cb040fecc7522a4faca681397b7fd Mon Sep 17 00:00:00 2001 From: Prekshi Vyas Date: Sun, 22 Nov 2026 17:50:35 -0800 Subject: [PATCH 3/4] test(e2e): verify the complete skill fixture evidence path Signed-off-by: Prekshi Vyas --- test/e2e/support/skill-agent-classifiers.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/support/skill-agent-classifiers.test.ts b/test/e2e/support/skill-agent-classifiers.test.ts index 8e30a25193f..dbcd20458ab 100644 --- a/test/e2e/support/skill-agent-classifiers.test.ts +++ b/test/e2e/support/skill-agent-classifiers.test.ts @@ -50,7 +50,9 @@ describe("skill-agent live test local classifiers", () => { ); expect(result.status).toBe(exitCode); - expect(result.stdout.includes("SKILL_TOKEN_PATH=")).toBe(present); + expect(result.stdout).toBe( + present ? `SKILL_TOKEN_PATH=${path.join(fixtureDir, file)}\n` : "", + ); expect( shouldSkipExternalAgentVerificationFailure("LLM idle timeout", result.status === 0), ).toBe(present); From 2ddd50230a2cfa1ecd98cfbf0ac398c12dde8b84 Mon Sep 17 00:00:00 2001 From: Prekshi Vyas Date: Sun, 22 Nov 2026 18:35:10 -0800 Subject: [PATCH 4/4] test(e2e): select skill agent when its shared probe changes Signed-off-by: Prekshi Vyas --- test/e2e/support/workflow-plan.test.ts | 6 +++--- tools/e2e/target-catalogue.mts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/e2e/support/workflow-plan.test.ts b/test/e2e/support/workflow-plan.test.ts index 39374593cda..80e6ac003e0 100644 --- a/test/e2e/support/workflow-plan.test.ts +++ b/test/e2e/support/workflow-plan.test.ts @@ -863,10 +863,10 @@ describe("E2E workflow plan", () => { it.each([ "test/e2e/e2e-cloud-experimental/features/skill/add-sandbox-skill.sh", "test/e2e/e2e-cloud-experimental/features/skill/verify-sandbox-skill-via-agent.sh", + "test/e2e/support/skill-agent-classifiers.ts", ])("selects the skill-agent target when its shared helper %s changes", (changedFile) => { - expect(catalogueTargetsForChangedFiles([changedFile]).map((target) => target.id)).toContain( - "skill-agent", - ); + const targets = catalogueTargetsForChangedFiles([changedFile]); + expect(targets).toContainEqual(catalogueTarget("skill-agent")); }); it.each([ diff --git a/tools/e2e/target-catalogue.mts b/tools/e2e/target-catalogue.mts index d4a0ef41b8d..8c1d1b79966 100644 --- a/tools/e2e/target-catalogue.mts +++ b/tools/e2e/target-catalogue.mts @@ -1695,6 +1695,7 @@ export const E2E_TARGET_CATALOGUE: readonly E2eCatalogueTarget[] = [ restoreCli: true, exposeCliBin: true, owningPaths: [ + "test/e2e/support/skill-agent-classifiers.ts", "test/e2e/e2e-cloud-experimental/features/skill/add-sandbox-skill.sh", "test/e2e/e2e-cloud-experimental/features/skill/verify-sandbox-skill-via-agent.sh", ],