Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

feat(plugin): recognize native OpenClaw manifests in the private plugin helpers (#391)

Narendran Raghavanc1017906a385
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf4bbf1a..3d18efb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,25 @@ All notable changes to SkillEvaluator are documented in this file.
Your Agent" docs page shows how to install it in Codex, Claude Code, OpenCode,
OpenClaw, and other skill-aware agents.
+- Private plugin helpers recognize native OpenClaw manifests
+ (`openclaw.plugin.json`) after the existing manifest formats. `id` is the
+ plugin identity and `configSchema` must be an object. Only the `skills` roots
+ the manifest declares are members, searched recursively without implicit
+ `skills/` or hidden and `node_modules` children. `package.json#openclaw`
+ entrypoints are boundary-checked without being imported or run. Every native
+ manifest keeps an unsupported OpenClaw runtime row, so portable skill
+ results never certify tools, hooks, channels, providers or services. Inline
+ `mcpServers` follow OpenClaw's transport, SSE default and verbatim-URL rules;
+ disabled TLS verification and literal enterprise secrets are blocking.
+ Runtime preparation never copies the plugin root as a member, never starts
+ stdio servers whose plugin-root working directory cannot be kept, records
+ unapplied host options as incomplete, and keeps host metadata out of staged
+ manifests. Native Claude Code staging copies only the declared member
+ skills, never the plugin tree, so Claude Code's default skill, command,
+ agent, hook and `bin/` locations stay unloaded.
+ `scripts/ci/smoke_openclaw_plugins.py` repeats these checks against real
+ plugin sources without executing plugin code.
+
### Changed
- Align terminal grade and lift colors across compact, full, and direct Tier 3
@@ -79,6 +98,11 @@ All notable changes to SkillEvaluator are documented in this file.
### Fixed
+- Private native Claude Code staging keeps the source client's skill
+ declarations: Codex paths that Codex ignores are no longer copied into the
+ staged `plugin.json` (where Claude Code rejected or loaded them), and
+ undotted Cursor skill roots become `./` paths Claude Code accepts.
+
- Read JSON, JSONL and YAML evaluation datasets as UTF-8 so Unicode prompts and
answers load correctly on hosts with a non-UTF-8 default text encoding.
diff --git a/scripts/ci/smoke_openclaw_plugins.py b/scripts/ci/smoke_openclaw_plugins.py
new file mode 100644
index 00000000..74270d87
--- /dev/null
+++ b/scripts/ci/smoke_openclaw_plugins.py
@@ -0,0 +1,201 @@
+#!/usr/bin/env python3
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Repeat real OpenClaw manifest, profile and portable-staging checks without executing plugins.
+
+Use local, pristine source trees (for example ``git archive`` exports without
+dependencies or build artifacts). This is a pipeline compatibility smoke over
+the private plugin helpers, not a substitute for full static scanners,
+embeddings, agent evaluation, or native OpenClaw runtime tests. The JSON
+report holds relative identities only, so it can be attached to a public PR
+without host paths.
+
+ uv run --extra tier3 python scripts/ci/smoke_openclaw_plugins.py \\
+ --plugin kitchen-sink=/path/to/pristine/kitchen-sink --iterations 50 --output ./openclaw-smoke.json
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import math
+import statistics
+import tempfile
+import time
+import tracemalloc
+from collections import Counter
+from pathlib import Path
+from typing import Any
+
+from skillevaluator.constants import PLUGIN_OPENCLAW_MANIFEST_TYPE
+from skillevaluator.deduplication.plugin.profile import load_plugin_profile
+from skillevaluator.plugin_formats import parse_manifest_text
+from skillevaluator.plugin_inventory import plugin_inventory_for_root
+from skillevaluator.plugin_manifest import locate_plugin_manifest
+from skillevaluator.tier3.plugin_native import OPENCLAW_RUNTIME_NOT_LOADED
+from skillevaluator.tier3.plugin_prepare import prepare_runtime_package, stage_wrapper_skill
+from skillevaluator.validators.private_plugin_schema import validate_inventory_schema
+
+MAX_ITERATIONS = 200
+MAX_REPORT_BYTES = 4 * 1024 * 1024
+
+
+def inspect_plugin(root: Path) -> dict[str, Any]:
+ """Check that Tier 1, Tier 2 and Tier 3 agree; scanner findings are reported, never hidden."""
+ location = locate_plugin_manifest(root)
+ if location is None or location.manifest_type != PLUGIN_OPENCLAW_MANIFEST_TYPE:
+ raise ValueError("Expected a selected native OpenClaw manifest")
+ data = parse_manifest_text(location.manifest_type, location.read_text())
+ if not isinstance(data, dict):
+ raise ValueError("Expected a manifest object")
+ inventory = plugin_inventory_for_root(root)
+ if inventory is None:
+ raise ValueError("Expected a plugin inventory")
+ schema = validate_inventory_schema(inventory)
+ metadata = schema.metadata["plugin"]
+ [declared] = [row for row in metadata["manifest_declarations"] if row["selected"]]
+ if declared["name"] != data.get("id"):
+ raise AssertionError("Tier 1 identity differs from the native id")
+ invalid_contract = [
+ finding.check_name
+ for finding in schema.findings
+ if finding.check_name.startswith(("schema:id:", "schema:configSchema:"))
+ ]
+ if invalid_contract:
+ raise AssertionError(f"Invalid native contract: {invalid_contract}")
+ profile = load_plugin_profile(root)
+ if profile.name != data["id"]:
+ raise AssertionError("Tier 2 identity differs from the native id")
+ expected = sorted(skill.root_relative for skill in profile.bundled_skills)
+ inventoried = sorted(
+ row["path"]
+ for row in metadata["component_inventory"]["components"]
+ if row["type"] == "skill"
+ and row["support"] == "evaluated"
+ and "declared_by" not in row
+ and "problem" not in row
+ )
+ if inventoried != expected:
+ raise AssertionError("Tier 1 and Tier 2 disagree about declared skill membership")
+ # A root SKILL.md remains inventoried, but copying the whole plugin as a
+ # portable member would expose runtime metadata and evaluator data.
+ portable_expected = [path for path in expected if path != "."]
+ package = prepare_runtime_package(inventory)
+ staged = sorted(str(member.path) for member in package.skills)
+ if staged != portable_expected:
+ raise AssertionError("Tier 3 staged membership differs from the native declared skills")
+ native_members = sorted(path.relative_to(inventory.root).as_posix() for path in package.native_source.member_skills)
+ if native_members != portable_expected:
+ raise AssertionError("Native adapters would stage a different member set")
+ runtime = [row for row in package.audit if row.type == "extension"]
+ if not runtime or any(row.reason != OPENCLAW_RUNTIME_NOT_LOADED for row in runtime):
+ raise AssertionError("Portable staging must never claim native OpenClaw runtime execution")
+ if not package.runnable and package.complete:
+ raise AssertionError("A native OpenClaw package with nothing to evaluate must be INCOMPLETE")
+ if portable_expected and not package.runnable:
+ raise AssertionError("A plugin with portable skills was unexpectedly not runnable")
+ if not portable_expected and not data.get("mcpServers") and package.runnable:
+ raise AssertionError("A runtime-only plugin must not silently pass as evaluated")
+ wrapper_members: list[str] = []
+ if package.runnable and package.skills:
+ with tempfile.TemporaryDirectory(prefix="openclaw-portable-smoke-") as temp:
+ temporary = Path(temp)
+ dataset = temporary / "evals.json"
+ dataset.write_text(
+ json.dumps(
+ [
+ {
+ "id": "portable-stage",
+ "prompt": "Read the available guidance; do not call external services.",
+ "expected_output": "Describe the portable guidance without running plugin code.",
+ }
+ ]
+ ),
+ encoding="utf-8",
+ )
+ wrapper = stage_wrapper_skill(package, temporary / "wrapper", evals_source=dataset)
+ wrapper_members = sorted(path.name for path in (wrapper.path / "skills").iterdir())
+ if wrapper_members != sorted(Path(path).name for path in portable_expected):
+ raise AssertionError("The wrapper staged a different member set")
+ return {
+ "plugin_id": profile.name,
+ "manifest_type": location.manifest_type,
+ "declared_skill_paths": expected,
+ "portable_tier3_skill_paths": staged,
+ "tier1_schema_passed": schema.passed,
+ "tier1_findings": dict(sorted(Counter(finding.check_name for finding in schema.findings).items())),
+ "tier2_profile_members": list(profile.members),
+ "portable_tier3_runnable": package.runnable,
+ "portable_tier3_incomplete_reasons": list(package.incomplete_reasons),
+ "runtime_components_unsupported": len(runtime),
+ "native_runtime_executed": False,
+ }
+
+
+def run_smoke(plugins: dict[str, Path], *, iterations: int, trace_memory: bool = False) -> dict[str, Any]:
+ """Require repeatable identities, findings, membership and coverage."""
+ if not 1 <= iterations <= MAX_ITERATIONS:
+ raise ValueError(f"iterations must be between 1 and {MAX_ITERATIONS}")
+ results: dict[str, Any] = {}
+ if trace_memory:
+ tracemalloc.start()
+ peak = None
+ try:
+ for label, root in plugins.items():
+ durations = []
+ reference = None
+ for _attempt in range(iterations):
+ started = time.monotonic()
+ observed = inspect_plugin(root)
+ durations.append(time.monotonic() - started)
+ if reference is not None and observed != reference:
+ raise AssertionError(f"Non-deterministic plugin result: {label}")
+ reference = observed
+ ordered = sorted(durations)
+ results[label] = {
+ **(reference or {}),
+ "iterations_passed": len(durations),
+ "seconds_median": round(statistics.median(durations), 4),
+ "seconds_p95": round(ordered[max(0, math.ceil(len(ordered) * 0.95) - 1)], 4),
+ "seconds_max": round(max(durations), 4),
+ }
+ if trace_memory:
+ _current, peak = tracemalloc.get_traced_memory()
+ finally:
+ if trace_memory:
+ tracemalloc.stop()
+ return {
+ "scope": "native metadata, private schema, local profile and portable staging only",
+ "live_agent_executed": False,
+ "native_runtime_executed": False,
+ "observations_passed": len(plugins) * iterations,
+ "python_peak_traced_bytes": peak,
+ "plugins": results,
+ }
+
+
+def main(argv: list[str] | None = None) -> None:
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser.add_argument("--plugin", action="append", required=True, metavar="LABEL=PATH")
+ parser.add_argument("--iterations", type=int, default=10)
+ parser.add_argument("--trace-memory", action="store_true", help="Enable allocation profiling (slower)")
+ parser.add_argument("--output", type=Path, required=True)
+ args = parser.parse_args(argv)
+ plugins: dict[str, Path] = {}
+ for value in args.plugin:
+ label, separator, path = value.partition("=")
+ if not separator or not label or not path or label in plugins:
+ parser.error("Each --plugin must have a unique LABEL=PATH")
+ plugins[label] = Path(path).resolve()
+ result = run_smoke(plugins, iterations=args.iterations, trace_memory=args.trace_memory)
+ text = json.dumps(result, indent=2) + "\n"
+ if len(text.encode("utf-8")) > MAX_REPORT_BYTES:
+ raise SystemExit(f"Smoke report exceeds {MAX_REPORT_BYTES} bytes")
+ args.output.parent.mkdir(parents=True, exist_ok=True)
+ args.output.write_text(text, encoding="utf-8")
+ print(f"Passed {result['observations_passed']} pipeline observations across {len(plugins)} plugins")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/src/skillevaluator/constants.py b/src/skillevaluator/constants.py
index fc90eeab..b72c6d37 100644
--- a/src/skillevaluator/constants.py
+++ b/src/skillevaluator/constants.py
@@ -684,6 +684,9 @@ PLUGIN_CODEX_MANIFEST_DIR = ".codex-plugin"
PLUGIN_CODEX_MANIFEST_TYPE = "codex_plugin_json"
PLUGIN_CURSOR_MANIFEST_DIR = ".cursor-plugin"
PLUGIN_CURSOR_MANIFEST_TYPE = "cursor_plugin_json"
+# Native OpenClaw manifest at the plugin root (docs.openclaw.ai/plugins/manifest).
+PLUGIN_OPENCLAW_MANIFEST_FILE = "openclaw.plugin.json"
+PLUGIN_OPENCLAW_MANIFEST_TYPE = "openclaw_plugin_json"
# Passive plugin discovery contracts; public dispatch remains unchanged.
@@ -694,6 +697,7 @@ PLUGIN_MANIFEST_PRECEDENCE: tuple[tuple[str, str], ...] = (
(PLUGIN_AGENT_PLUGINS_V1_MANIFEST_FILE, PLUGIN_AGENT_PLUGINS_V1_MANIFEST_TYPE),
(f"{PLUGIN_CODEX_MANIFEST_DIR}/{PLUGIN_CONTAINED_MANIFEST_FILE}", PLUGIN_CODEX_MANIFEST_TYPE),
(f"{PLUGIN_CURSOR_MANIFEST_DIR}/{PLUGIN_CONTAINED_MANIFEST_FILE}", PLUGIN_CURSOR_MANIFEST_TYPE),
+ (PLUGIN_OPENCLAW_MANIFEST_FILE, PLUGIN_OPENCLAW_MANIFEST_TYPE),
)
PLUGIN_NATIVE_MANIFEST_DIRS: tuple[str, ...] = (
@@ -708,6 +712,7 @@ PLUGIN_CONTAINED_MANIFEST_TYPES = frozenset(
PLUGIN_AGENT_PLUGINS_V1_MANIFEST_TYPE,
PLUGIN_CODEX_MANIFEST_TYPE,
PLUGIN_CURSOR_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
}
)
diff --git a/src/skillevaluator/deduplication/plugin/catalog_checks.py b/src/skillevaluator/deduplication/plugin/catalog_checks.py
index aa55591d..6361cdf1 100644
--- a/src/skillevaluator/deduplication/plugin/catalog_checks.py
+++ b/src/skillevaluator/deduplication/plugin/catalog_checks.py
@@ -90,8 +90,9 @@ def check_catalog_skills(profile, catalog, *, threshold, top_k=INTER_SKILL_CATAL
self_paths = {(PurePosixPath(prefix) / skill.root_relative).as_posix() for prefix in prefixes}
fingerprint = None
else:
- # A v1 catalog can have been rooted at this bundle or its skills folder.
- self_paths = {skill.root_relative, skill.rel}
+ # A v1 catalog can have been rooted at this bundle, its skills folder,
+ # or (OpenClaw) one of its explicitly declared skill roots.
+ self_paths = {skill.root_relative, skill.rel, *skill.catalog_relative_paths}
fingerprint = hashlib.sha256(skill.entry.embedding_text.encode("utf-8")).hexdigest()
candidates = []
for entry, score in scored:
diff --git a/src/skillevaluator/deduplication/plugin/profile.py b/src/skillevaluator/deduplication/plugin/profile.py
index 5f442e6d..d23cc685 100644
--- a/src/skillevaluator/deduplication/plugin/profile.py
+++ b/src/skillevaluator/deduplication/plugin/profile.py
@@ -10,10 +10,11 @@ from dataclasses import dataclass
from pathlib import Path, PurePosixPath
from typing import Any
-from skillevaluator.constants import DESCRIPTION_MAX_LENGTH
+from skillevaluator.constants import DESCRIPTION_MAX_LENGTH, PLUGIN_OPENCLAW_MANIFEST_TYPE
from skillevaluator.embedding.extractor import ContentEntry
-from skillevaluator.plugin_formats import parse_manifest_text
+from skillevaluator.plugin_formats import manifest_identity, parse_manifest_text
from skillevaluator.plugin_manifest import PluginManifestPathError, locate_plugin_manifest
+from skillevaluator.plugin_paths import normalize_declared_path
from skillevaluator.plugin_refs import normalize_ref
from skillevaluator.utils.secure_fs import SecurePathError
from skillevaluator.utils.structured_data import require_bounded_string
@@ -38,6 +39,8 @@ class BundledSkill:
path: Path
entry: ContentEntry | None
skip_reason: str | None = None
+ #: Paths a skill-only catalog built from a declared native skill root records (OpenClaw).
+ catalog_relative_paths: tuple[str, ...] = ()
@property
def rel(self) -> str:
@@ -110,9 +113,26 @@ def load_plugin_profile(plugin_root: Path) -> PluginProfile:
data: Any = parse_manifest_text(located.manifest_type, raw.removeprefix("\ufeff"))
if not isinstance(data, dict):
raise ValueError("Bundle manifest could not be parsed")
+ openclaw = located.manifest_type == PLUGIN_OPENCLAW_MANIFEST_TYPE
+ # OpenClaw's name is display text; its id alone is the stable plugin identity.
+ raw_name = manifest_identity(located.manifest_type, data)
name = require_bounded_string(
- data.get("name") or inventory.root.name, "Bundle name", max_chars=PLUGIN_NAME_MAX_REPORT_CHARS
+ raw_name if openclaw else raw_name or inventory.root.name, "Bundle name", max_chars=PLUGIN_NAME_MAX_REPORT_CHARS
).strip()
+ if openclaw and not name:
+ raise ValueError("OpenClaw plugin id must be a non-empty string")
+ if openclaw and not isinstance(data.get("configSchema"), dict):
+ raise ValueError("OpenClaw configSchema must be an object")
+ # Catalog identities are portable POSIX paths, never host path flavours.
+ catalog_roots = (
+ [
+ declared.rel
+ for raw in data.get("skills", [])
+ if isinstance(raw, str) and (declared := normalize_declared_path(raw, ())).rel is not None
+ ]
+ if openclaw and isinstance(data.get("skills"), list)
+ else []
+ )
description = data.get("description")
if description is not None:
description = (
@@ -149,11 +169,16 @@ def load_plugin_profile(plugin_root: Path) -> PluginProfile:
skill_name, skill_description, str(inventory.root / skill.path), "skill", skill.text or ""
)
reason = None
- label = skill_name if isinstance(skill_name, str) and skill_name.strip() else relative.name or name
+ # An OpenClaw root SKILL.md without a name is labelled like its Tier 1 row (the plugin folder).
+ fallback = inventory.root.name if openclaw and skill.path == "." else relative.name or name
+ label = skill_name if isinstance(skill_name, str) and skill_name.strip() else fallback
members.add(_member(label))
- bundled.append(BundledSkill(relative.as_posix(), inventory.root / skill.path, entry, reason))
+ catalog_paths = tuple(
+ sorted({relative.relative_to(root).as_posix() for root in catalog_roots if relative.is_relative_to(root)})
+ )
+ bundled.append(BundledSkill(relative.as_posix(), inventory.root / skill.path, entry, reason, catalog_paths))
section = data.get("skills")
- refs = section.get("refs") if isinstance(section, dict) else None
+ refs = section.get("refs") if not openclaw and isinstance(section, dict) else None
if isinstance(refs, list):
if len(refs) > MAX_PLUGIN_MEMBERS:
raise ValueError("Bundle member reference limit exceeded")
diff --git a/src/skillevaluator/plugin_discovery.py b/src/skillevaluator/plugin_discovery.py
index 48ea0e28..f8629c66 100644
--- a/src/skillevaluator/plugin_discovery.py
+++ b/src/skillevaluator/plugin_discovery.py
@@ -29,6 +29,7 @@ from skillevaluator.constants import (
PLUGIN_CONTAINED_MANIFEST_TYPE,
PLUGIN_CURSOR_MANIFEST_TYPE,
PLUGIN_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
SCAN_ARTIFACT_DIRS,
SCAN_EXCLUDED_DIRS,
SKILL_MANIFEST_VARIANTS,
@@ -164,7 +165,27 @@ class _ResolvedPath(NamedTuple):
"""A declared component path that can be loaded (:meth:`_MemberCollector._resolve_component`)."""
rel: PurePosixPath # contained root-relative path
- kind: str # "file" or "dir"
+ kind: str # "file", "dir", or "missing" when the caller allows an absent path
+
+
+#: The unsupported inventory row every native OpenClaw manifest keeps.
+OPENCLAW_RUNTIME_NAME = "OpenClaw runtime"
+
+
+def _openclaw_built_entries(source: PurePosixPath) -> list[PurePosixPath]:
+ """Bounded built-runtime candidates for one TypeScript entry, in OpenClaw's lookup order."""
+ suffix = source.suffix.lower()
+ if suffix not in {".ts", ".tsx", ".mts", ".cts"}:
+ return []
+ stem = source.with_suffix("").as_posix()
+ dist_stem = f"dist/{stem.removeprefix('src/')}"
+ bases = [dist_stem, *([f"dist/{stem}"] if stem.startswith("src/") else []), stem]
+ suffixes = (
+ (".mjs", ".js", ".cjs")
+ if suffix == ".mts"
+ else ((".cjs", ".js", ".mjs") if suffix == ".cts" else (".js", ".mjs", ".cjs"))
+ )
+ return [PurePosixPath(base + extension) for base in bases for extension in suffixes]
def _section_refs(section: Any) -> list[Any]:
@@ -218,6 +239,7 @@ class _MemberCollector:
self.apps()
self.extensions()
self.openai_extension()
+ self.openclaw_runtime()
return self.inventory
@property
@@ -388,7 +410,7 @@ class _MemberCollector:
)
return declared, "invalid"
kind = self.reader.kind(declared.rel)
- if kind == "missing":
+ if kind == "missing" and "missing" not in kinds:
self.inventory.findings.append(
_path_problem_finding(self.reader, field_name, declared, self.manifest_rel, "missing")
)
@@ -599,6 +621,9 @@ class _MemberCollector:
declared_default = False
declared_value = self.manifest.get("skills") if self.manifest is not None else None
default_dir = PurePosixPath(DEFAULT_SKILLS_DIR)
+ if self.profile.explicit_skills_only:
+ self._explicit_skill_roots(declared_value)
+ return
if self.contained and self.manifest is not None:
for raw in self._declared_values("skills", declared_value):
resolved = self._resolve_component("skill", "skills", raw, kinds=("dir",))
@@ -650,6 +675,57 @@ class _MemberCollector:
)
self._read_member(component, skill_dir / manifest.relative_path.name)
+ def _explicit_skill_roots(self, declared_value: Any) -> None:
+ """Members of a format that loads only its declared skill roots (OpenClaw).
+
+ No implicit ``skills/`` root is added. Declared roots are searched
+ recursively and discovery stops below each skill's own ``SKILL.md``
+ (:func:`~skillevaluator.plugin_skills.discover_openclaw_skill_manifests`).
+ A root ``SKILL.md`` selected through ``.`` is inventoried like any member;
+ Tier 3 never copies the plugin root as a portable member skill.
+ """
+ from skillevaluator.plugin_skills import discover_openclaw_skill_manifests
+
+ if self.manifest is not None and "skills" in self.manifest and not isinstance(declared_value, list):
+ # OpenClaw declares skill roots only as an array; never reinterpret a
+ # scalar or null as a root (schema reports the field as well).
+ self.inventory.findings.append(
+ _plugin_finding(
+ Severity.HIGH,
+ "plugin_component_path_invalid",
+ "OpenClaw 'skills' must be an array of declared skill directory paths; no skill root was read",
+ self.manifest_display,
+ 'Declare skill roots as an array, for example "skills": ["./skills"].',
+ )
+ )
+ self._add(PluginMember("skill", "skills", "declared", None, "evaluated", problem="invalid"))
+ return
+ roots: list[str] = []
+ for raw in self._declared_values("skills", declared_value):
+ resolved = self._resolve_component("skill", "skills", raw, kinds=("dir",))
+ if resolved is not None:
+ roots.append(resolved.rel.as_posix())
+ try:
+ manifests = discover_openclaw_skill_manifests(self.reader.root, {"skills": roots})
+ except (ValueError, SecurePathError) as exc:
+ self.inventory.findings.append(
+ _plugin_finding(
+ Severity.HIGH,
+ "plugin_component_path_unsafe",
+ f"OpenClaw skill discovery failed closed: {exc}",
+ self.manifest_display,
+ "Use regular contained skill roots within the discovery bounds.",
+ )
+ )
+ self._add(PluginMember("skill", "skills", "declared", None, "evaluated", problem="unsafe"))
+ return
+ self._check_item_count("OpenClaw member skills", len(manifests))
+ for manifest in manifests[:PLUGIN_COMPONENT_MAX_ITEMS]:
+ folder = PurePosixPath(manifest.relative_path.parent.as_posix())
+ name = folder.name or self.reader.root.name
+ component = self._add(PluginMember("skill", name, "declared", folder.as_posix(), "evaluated"))
+ self._read_member(component, PurePosixPath(manifest.relative_path.as_posix()))
+
def _root_skill(self) -> None:
"""A root ``SKILL.md`` makes a single-skill plugin (Cursor) when no skills are declared or bundled."""
for variant in SKILL_MANIFEST_VARIANTS:
@@ -1102,6 +1178,101 @@ class _MemberCollector:
if openai.get("apps") is not None:
self._add_apps(self._json_sources("app", "apps", openai.get("apps"), None, profile=CODEX_PROFILE))
+ def openclaw_runtime(self) -> None:
+ """Inventory native OpenClaw entrypoints without importing them or translating them to MCP.
+
+ A manifest alone cannot enumerate dynamic registrations (tools, hooks,
+ channels, providers, services). An unsupported runtime row is kept even
+ without package entrypoints, so portable skill coverage can never
+ certify the whole OpenClaw plugin.
+ """
+ if self.profile.manifest_type != PLUGIN_OPENCLAW_MANIFEST_TYPE:
+ return
+ self._add(PluginMember("extension", OPENCLAW_RUNTIME_NAME, "declared", self.manifest_rel, "unsupported"))
+ package_path = PurePosixPath("package.json")
+ if self.reader.kind(package_path) == "missing":
+ return
+ package = self._load_json(package_path, "OpenClaw package metadata")
+ metadata = package.get("openclaw") if isinstance(package, dict) else None
+ if metadata is None:
+ return
+
+ def invalid(message: str, suggestion: str) -> None:
+ self.inventory.findings.append(
+ _plugin_finding(
+ Severity.HIGH,
+ "plugin_openclaw_package_invalid",
+ message,
+ self.reader.display(package_path),
+ suggestion,
+ )
+ )
+
+ if not isinstance(metadata, dict):
+ invalid(
+ "package.json#openclaw must be an object",
+ "Use an object containing plugin-relative entrypoint paths.",
+ )
+ return
+ pairing = "Declare contained entrypoint paths, with runtime entries paired with their source entries."
+ entries: dict[str, list[Any]] = {}
+ for field_name in ("extensions", "runtimeExtensions", "setupEntry", "runtimeSetupEntry"):
+ if field_name not in metadata:
+ continue
+ value = metadata[field_name]
+ array_field = field_name in {"extensions", "runtimeExtensions"}
+ if (array_field and not isinstance(value, list)) or (not array_field and not isinstance(value, str)):
+ invalid(f"openclaw.{field_name} must be {'an array' if array_field else 'a string'}", pairing)
+ continue
+ entries[field_name] = self._declared_values(field_name, value)
+
+ extensions, runtimes = metadata.get("extensions", []), metadata.get("runtimeExtensions", [])
+ paired_extensions = isinstance(extensions, list) and isinstance(runtimes, list)
+ if paired_extensions and runtimes and len(runtimes) != len(extensions):
+ invalid("openclaw.runtimeExtensions length must match openclaw.extensions length", pairing)
+ paired_extensions = False
+ if "runtimeSetupEntry" in metadata and "setupEntry" not in metadata:
+ invalid("openclaw.runtimeSetupEntry requires openclaw.setupEntry", pairing)
+
+ # An explicit runtime must exist even when source or inferred output also exists.
+ resolved_runtime = {
+ (field_name, index): self._openclaw_entry(field_name, raw)
+ for field_name in ("runtimeExtensions", "runtimeSetupEntry")
+ for index, raw in enumerate(entries.get(field_name, []))
+ }
+ for source_field, runtime_field in (("extensions", "runtimeExtensions"), ("setupEntry", "runtimeSetupEntry")):
+ for index, raw in enumerate(entries.get(source_field, [])):
+ runtime = resolved_runtime.get((runtime_field, index))
+ if source_field == "extensions" and not paired_extensions:
+ runtime = None
+ # OpenClaw's package entrypoint resolution searches dist/, dist/src/,
+ # then sibling JavaScript, keeping the .mts/.cts output preference.
+ # Never bypass an explicit runtime, nor an unsafe earlier candidate.
+ infer = runtime_field not in metadata or (runtime_field == "runtimeExtensions" and runtimes == [])
+ if infer and isinstance(raw, str):
+ declared = normalize_declared_path(raw, self.profile.manifest_path_prefixes)
+ if declared.rel is not None:
+ for candidate in _openclaw_built_entries(declared.rel):
+ if self.reader.kind(candidate) == "missing":
+ continue
+ runtime = self._openclaw_entry(f"{runtime_field} (inferred)", candidate.as_posix())
+ break
+ # Published packages may omit sources, but boundary, type, link and
+ # special-file checks still apply. Only a valid runtime excuses absence.
+ self._openclaw_entry(source_field, raw, allow_missing=runtime is not None)
+
+ def _openclaw_entry(self, field_name: str, raw: Any, *, allow_missing: bool = False) -> _ResolvedPath | None:
+ resolved = self._resolve_component(
+ "extension", f"openclaw.{field_name}", raw, kinds=("file", "missing") if allow_missing else ("file",)
+ )
+ if resolved is not None:
+ self._add(
+ PluginMember(
+ "extension", f"openclaw.{field_name}: {raw}", "declared", resolved.rel.as_posix(), "unsupported"
+ )
+ )
+ return resolved
+
def _read_member(
self, component: PluginMember, rel: PurePosixPath, *, lenient: bool = False, strip: bool = False
) -> None:
diff --git a/src/skillevaluator/plugin_format_schema.py b/src/skillevaluator/plugin_format_schema.py
index 956f6460..be449c80 100644
--- a/src/skillevaluator/plugin_format_schema.py
+++ b/src/skillevaluator/plugin_format_schema.py
@@ -20,6 +20,7 @@ from skillevaluator.constants import (
PLUGIN_CODEX_MANIFEST_TYPE,
PLUGIN_CONTAINED_MANIFEST_TYPE,
PLUGIN_CURSOR_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
)
from skillevaluator.plugin_formats import agent_plugins_schema_version
@@ -1632,16 +1633,48 @@ def _validate_codex_overlay(data: dict[str, Any]) -> list[ManifestIssue]:
return issues
+def _validate_openclaw(data: dict[str, Any]) -> list[ManifestIssue]:
+ """Validate the cold OpenClaw manifest contract, not dynamically registered runtime APIs.
+
+ Unknown metadata is retained on purpose: OpenClaw extends its manifest
+ independently of this evaluator. ``configSchema`` is neither instantiated
+ nor resolved, and it is not a Claude Code settings or permissions file.
+ """
+ issues: list[ManifestIssue] = []
+ label = "OpenClaw plugin manifest"
+ _check_string(data, "id", issues, required=True, non_empty=True, label=label)
+ if not isinstance(data.get("configSchema"), dict):
+ issues.append(
+ _issue(
+ "configSchema",
+ "type",
+ f"{label} requires a configSchema object.",
+ suggestion='Add "configSchema": {"type": "object"} (an empty object schema is valid).',
+ )
+ )
+ for key in ("name", "description", "version"):
+ _check_string(data, key, issues, label=label)
+ for key in ("skills", "channels", "providers", "cliBackends", "requiresPlugins"):
+ if key in data and (
+ not isinstance(data[key], list) or any(not isinstance(item, str) or not item.strip() for item in data[key])
+ ):
+ issues.append(_issue(key, "type", f"{label} field '{key}' must be an array of non-empty strings."))
+ if "mcpServers" in data and not isinstance(data["mcpServers"], dict):
+ issues.append(_issue("mcpServers", "type", f"{label} field 'mcpServers' must be an object."))
+ return issues
+
+
_VALIDATORS: dict[str, Callable[[dict[str, Any]], list[ManifestIssue]]] = {
PLUGIN_CONTAINED_MANIFEST_TYPE: _validate_claude,
PLUGIN_AGENT_PLUGINS_V1_MANIFEST_TYPE: _validate_agent_plugins,
PLUGIN_CODEX_MANIFEST_TYPE: _validate_codex,
PLUGIN_CURSOR_MANIFEST_TYPE: _validate_cursor,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE: _validate_openclaw,
}
def validate_manifest_fields(manifest_type: str, data: dict[str, Any], *, overlay: bool = False) -> list[ManifestIssue]:
- """Return the field problems of one parsed contained manifest (Claude Code, Agent Plugins, Codex, Cursor).
+ """Return the field problems of one parsed contained manifest (Claude Code, Agent Plugins, Codex, Cursor, OpenClaw).
Bundle-reference manifests keep their pydantic model and return no issues
here. ``overlay`` validates a Codex manifest as the
diff --git a/src/skillevaluator/plugin_formats.py b/src/skillevaluator/plugin_formats.py
index 83d6954b..cecbf09a 100644
--- a/src/skillevaluator/plugin_formats.py
+++ b/src/skillevaluator/plugin_formats.py
@@ -20,6 +20,8 @@ from skillevaluator.constants import (
PLUGIN_CURSOR_MANIFEST_DIR,
PLUGIN_CURSOR_MANIFEST_TYPE,
PLUGIN_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_FILE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
)
from skillevaluator.utils.structured_data import load_bounded_json, load_bounded_yaml
@@ -113,6 +115,8 @@ class FormatProfile:
skills_immediate_children_only: bool = False
# Declared skill folders are searched at any depth (Codex), not one level.
skills_recursive: bool = False
+ # Only manifest-declared skill roots load; skills/ is not implicit (OpenClaw).
+ explicit_skills_only: bool = False
# A root SKILL.md is a single-skill plugin when no skills are declared or bundled.
root_skill_fallback: bool = False
default_rules_dir: str | None = None
@@ -137,7 +141,7 @@ class FormatProfile:
# Reference text used in finding suggestions.
reference: str = "plugin manifest reference"
# MCP config dialect: how server entries are normalized before the static policy.
- mcp_dialect: Literal["claude", "codex", "agent_plugins"] = "claude"
+ mcp_dialect: Literal["claude", "codex", "agent_plugins", "openclaw"] = "claude"
_CLAUDE_COMPONENT_FIELDS = frozenset(
@@ -239,12 +243,38 @@ CODEX_PROFILE = FormatProfile(
reference="Codex plugin packaging reference (developers.openai.com/plugins)",
)
+# Native OpenClaw metadata, read without importing or installing plugin code
+# (docs.openclaw.ai/plugins/manifest and /plugins/manifest/package-json).
+# ``id`` is the stable identity; ``name`` is only a display label.
+OPENCLAW_PROFILE = FormatProfile(
+ manifest_type=PLUGIN_OPENCLAW_MANIFEST_TYPE,
+ label="OpenClaw plugin",
+ manifest_path=PLUGIN_OPENCLAW_MANIFEST_FILE,
+ component_fields=frozenset({"skills", "mcpServers"}),
+ skills_recursive=True,
+ explicit_skills_only=True,
+ stage_from_inventory=True,
+ mcp_dialect="openclaw",
+ reference="OpenClaw plugin manifest reference (docs.openclaw.ai/plugins/manifest)",
+)
+
PROFILES: dict[str, FormatProfile] = {
profile.manifest_type: profile
- for profile in (CLAUDE_PROFILE, AGENT_PLUGINS_V1_PROFILE, CODEX_PROFILE, CURSOR_PROFILE)
+ for profile in (CLAUDE_PROFILE, AGENT_PLUGINS_V1_PROFILE, CODEX_PROFILE, CURSOR_PROFILE, OPENCLAW_PROFILE)
}
+def manifest_identity(manifest_type: str | None, data: Any) -> Any:
+ """The stable plugin identity a manifest declares: OpenClaw's ``id``, otherwise ``name``.
+
+ OpenClaw's ``name`` is an optional display label, never an alternative to
+ ``id``. The raw value is returned; callers bound and validate it.
+ """
+ if not isinstance(data, dict):
+ return None
+ return data.get("id" if manifest_type == PLUGIN_OPENCLAW_MANIFEST_TYPE else "name")
+
+
def profile_for(manifest_type: str | None) -> FormatProfile:
"""Return the profile of a contained manifest type (Claude Code by default)."""
return PROFILES.get(manifest_type or "", CLAUDE_PROFILE)
diff --git a/src/skillevaluator/plugin_manifest.py b/src/skillevaluator/plugin_manifest.py
index 063d08d3..2dcb0973 100644
--- a/src/skillevaluator/plugin_manifest.py
+++ b/src/skillevaluator/plugin_manifest.py
@@ -40,6 +40,7 @@ from skillevaluator.constants import (
PLUGIN_MANIFEST_FILES,
PLUGIN_MANIFEST_PRECEDENCE,
PLUGIN_NATIVE_MANIFEST_DIRS,
+ PLUGIN_OPENCLAW_MANIFEST_FILE,
)
from skillevaluator.plugin_formats import (
AGENT_PLUGINS_SCHEMA_PREFIX,
@@ -378,8 +379,8 @@ def _wrap_security_error(exc: SecurePathError) -> PluginManifestPathError:
def manifest_relative_path(path: Path) -> Path | None:
"""Return the root-relative manifest path that *path* names, if it names one.
- ``agent_plugin.yaml``/``.yml`` and a root ``plugin.json`` (Agent Plugins v1)
- sit at the plugin root; ``plugin.json`` inside ``.claude-plugin/``,
+ ``agent_plugin.yaml``/``.yml``, a root ``plugin.json`` (Agent Plugins v1)
+ and a native OpenClaw ``openclaw.plugin.json`` sit at the plugin root; ``plugin.json`` inside ``.claude-plugin/``,
``.codex-plugin/``, or ``.cursor-plugin/`` roots the plugin at the vendor
directory's parent. This is a lexical check only. Client manifest names
match without regard to case; the returned path keeps the given spelling.
@@ -389,7 +390,7 @@ def manifest_relative_path(path: Path) -> Path | None:
name = path.name.casefold()
if name == PLUGIN_CONTAINED_MANIFEST_FILE and path.parent.name.casefold() in NATIVE_MANIFEST_DIRS_FOLDED:
return Path(path.parent.name) / path.name
- if name == PLUGIN_AGENT_PLUGINS_V1_MANIFEST_FILE:
+ if name in {PLUGIN_AGENT_PLUGINS_V1_MANIFEST_FILE, PLUGIN_OPENCLAW_MANIFEST_FILE}:
return Path(path.name)
return None
diff --git a/src/skillevaluator/plugin_mcp.py b/src/skillevaluator/plugin_mcp.py
index 1a7eca24..ce1f153f 100644
--- a/src/skillevaluator/plugin_mcp.py
+++ b/src/skillevaluator/plugin_mcp.py
@@ -58,6 +58,7 @@ from skillevaluator.validators.mcp_static import (
CODEX_UNAPPLIED_MCP_FIELDS,
McpPinning,
classify_mcp_pinning,
+ openclaw_ssl_verification_enabled,
validate_mcp_server_declaration,
)
from skillevaluator.validators.url_policy import (
@@ -260,7 +261,7 @@ def collect_mcp_declarations(
)
)
- # 3. Dialect normalization (Codex, Agent Plugins) before any static check.
+ # 3. Dialect normalization (Codex, Agent Plugins, OpenClaw) before any static check.
if profile.mcp_dialect != "claude":
_normalize_dialect(reader, collection, profile, manifest)
@@ -565,7 +566,8 @@ def _unscanned_server_files(
return []
seen: set[str] = set()
findings: list[Finding] = []
- for rel, is_cwd in _server_launch_files(config, relative_cwd=profile.mcp_dialect == "codex", root=reader.root):
+ relative_cwd = profile.mcp_dialect in {"codex", "openclaw"}
+ for rel, is_cwd in _server_launch_files(config, relative_cwd=relative_cwd, root=reader.root):
folder = _unscanned_folder(rel, reader.root)
if folder is None or rel.as_posix() in seen:
continue
@@ -608,6 +610,15 @@ def _normalize_dialect(
the same version as ``plugin.json`` (otherwise clients disable MCP), and
each server must declare ``type`` (``stdio``, ``streamable-http``, or
``sse``); ``streamable-http`` is checked as ``http``.
+
+ OpenClaw (inline ``mcpServers``): a command wins over URL fields and
+ launches from the plugin root unless ``cwd``/``workingDirectory`` says
+ otherwise; that working directory is kept so Tier 3 refuses the launch
+ instead of running it elsewhere. For a URL server the canonical
+ ``transport`` wins over the legacy ``type``, ``streamable-http`` means
+ ``http`` and the default is SSE. Host-only fields (auth, TLS, tool policy)
+ are recorded as unapplied; a plugin-declared ``enabled: false`` is not an
+ operator switch, so the server stays declared.
"""
if profile.mcp_dialect == "agent_plugins":
plugin_version = agent_plugins_schema_version((manifest or {}).get("$schema"))
@@ -632,6 +643,8 @@ def _normalize_dialect(
if not isinstance(config, dict):
continue
normalized = dict(config)
+ if profile.mcp_dialect == "openclaw":
+ _normalize_openclaw_server(reader, collection, declaration, config, normalized)
raw_type = normalized.get("type")
if isinstance(raw_type, str) and raw_type.strip() in _HTTP_TYPE_ALIASES:
normalized["type"] = "http"
@@ -670,6 +683,66 @@ def _normalize_dialect(
declaration.config = normalized
+# OpenClaw server fields the evaluation can stage or must keep for the static policy.
+_OPENCLAW_PORTABLE_FIELDS = frozenset(
+ {"command", "args", "url", "transport", "type", "env", "headers", "cwd", "workingDirectory", "enabled"}
+)
+
+
+def _normalize_openclaw_server(
+ reader: PluginRootReader,
+ collection: McpCollection,
+ declaration: McpDeclaration,
+ config: dict[str, Any],
+ normalized: dict[str, Any],
+) -> None:
+ """Map one native OpenClaw server onto the shared fields (see :func:`_normalize_dialect`)."""
+ if normalized.get("command"):
+ # OpenClaw absolutizes a string cwd/workingDirectory before its launch
+ # config chooses between them, so an empty cwd becomes the plugin root
+ # and still wins over a nonempty legacy alias.
+ cwd = config.get("cwd")
+ if not isinstance(cwd, str):
+ cwd = config.get("workingDirectory")
+ normalized["cwd"] = (cwd or ".") if isinstance(cwd, str) else "."
+ elif "workingDirectory" in normalized:
+ normalized["cwd"] = normalized["workingDirectory"]
+ transport = config.get("transport")
+ legacy = config.get("type")
+ effective = transport if isinstance(transport, str) and transport.strip() else legacy
+ if isinstance(effective, str):
+ effective = effective.strip().lower()
+ if config.get("command"):
+ normalized["transport"] = "stdio"
+ elif effective == "streamable-http" or (not transport and effective == "http"):
+ normalized["transport"] = "http"
+ else:
+ normalized["transport"] = effective or "sse"
+ normalized.pop("type", None)
+ if (
+ not config.get("command")
+ and isinstance(transport, str)
+ and transport.strip().lower() not in {"sse", "streamable-http", ""}
+ ):
+ collection.findings.append(
+ _plugin_finding(
+ Severity.HIGH,
+ "mcp_transport_invalid",
+ f"OpenClaw MCP server '{declaration.name}' has an unsupported canonical transport",
+ reader.display(declaration.file),
+ "Use transport: sse or streamable-http for a URL server.",
+ category=MCP_CATEGORY,
+ metadata={"mcp_server": declaration.name},
+ )
+ )
+ # Never silently discard host-specific auth, TLS, tool policy or future
+ # fields. Effective verified TLS is the runtime default, not dropped config.
+ portable = set(_OPENCLAW_PORTABLE_FIELDS)
+ if openclaw_ssl_verification_enabled(config):
+ portable.update({"sslVerify", "ssl_verify"})
+ declaration.unapplied = tuple(sorted(key for key in config if key not in portable))
+
+
def _codex_headers(headers: Any, http_headers: Any) -> Any:
"""Merge a Codex server's ``http_headers`` into ``headers`` for the static policy and Tier 3.
diff --git a/src/skillevaluator/plugin_skills.py b/src/skillevaluator/plugin_skills.py
new file mode 100644
index 00000000..a7f419d7
--- /dev/null
+++ b/src/skillevaluator/plugin_skills.py
@@ -0,0 +1,147 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Bounded, no-follow discovery of declared native plugin skill roots, shared by every private tier."""
+
+from __future__ import annotations
+
+from pathlib import Path, PurePosixPath
+from typing import Any
+
+from skillevaluator.constants import (
+ CONTENT_DEDUP_MAX_DISCOVERED_PATHS,
+ PLUGIN_COMPONENT_MAX_ITEMS,
+ SKILL_MANIFEST_VARIANTS,
+)
+from skillevaluator.plugin_member_paths import preferred_skill_manifests
+from skillevaluator.plugin_paths import PluginRootReader, normalize_declared_path
+from skillevaluator.utils.secure_fs import (
+ MAX_SECURE_DIRECTORY_DEPTH,
+ SecureFile,
+ SecurePathError,
+ discover_secure_files,
+ lstat_walk,
+)
+
+
+def discover_openclaw_skill_manifests(
+ plugin_root: Path,
+ data: dict[str, Any],
+ *,
+ max_roots: int = PLUGIN_COMPONENT_MAX_ITEMS,
+ max_paths: int = CONTENT_DEDUP_MAX_DISCOVERED_PATHS,
+ max_depth: int = MAX_SECURE_DIRECTORY_DEPTH,
+) -> list[SecureFile]:
+ """Discover only declared OpenClaw roots, stopping recursively at skill boundaries.
+
+ Dot-prefixed child directories and ``node_modules`` are not descended into,
+ as in OpenClaw's skill-root discovery. These are child-descent rules only:
+ an explicitly declared root may have either name. No implicit ``skills/``
+ root is added when ``skills`` is omitted or empty.
+
+ Shallow secure walks reject redirects before descent and retain discovery
+ identities. The path allowance is shared across all declared roots, even
+ when they overlap. Nothing below a directory containing ``SKILL.md`` is
+ enumerated. Results are unique by skill directory, sorted, and relative to
+ the plugin root, ready for anchored reads through ``SecureRoot(plugin_root)``.
+ This function does not read skill content or import/execute plugin code.
+
+ Invalid declarations or limit arguments raise ``ValueError``; unsafe paths
+ and exhausted traversal limits raise ``SecurePathError``. Missing declared
+ roots are skipped, matching OpenClaw; Tier 1 reports their missing paths.
+ """
+ if type(max_roots) is not int or max_roots < 0:
+ raise ValueError("max_roots must be a non-negative integer")
+ if type(max_paths) is not int or max_paths < 1:
+ raise ValueError("max_paths must be a positive integer")
+ if type(max_depth) is not int or not 1 <= max_depth <= MAX_SECURE_DIRECTORY_DEPTH:
+ raise ValueError(f"max_depth must be an integer from 1 to {MAX_SECURE_DIRECTORY_DEPTH}")
+ roots = data.get("skills", [])
+ if not isinstance(roots, list) or any(not isinstance(root, str) for root in roots):
+ raise ValueError("OpenClaw skills must be a list of declared directory paths")
+ if len(roots) > max_roots:
+ raise ValueError(f"OpenClaw skills exceeds the {max_roots}-item limit")
+ reader = PluginRootReader(plugin_root)
+ declared_roots: set[PurePosixPath] = set()
+ for raw in roots:
+ declared = normalize_declared_path(raw, ())
+ if declared.problem is not None or declared.rel is None:
+ raise SecurePathError("unsafe_path", f"Unsafe OpenClaw skills directory: {raw!r}")
+ declared_roots.add(declared.rel)
+
+ manifests: dict[str, SecureFile] = {}
+ visited: set[PurePosixPath] = set()
+ discovered_paths = 0
+ entries: list[Path] = []
+
+ def selected(path: Path) -> bool:
+ nonlocal discovered_paths
+ discovered_paths += 1
+ entries.append(path)
+ return path.name in SKILL_MANIFEST_VARIANTS
+
+ pending = sorted(declared_roots, reverse=True)
+ while pending:
+ relative = pending.pop()
+ if relative in visited:
+ continue
+ visited.add(relative)
+ if len(relative.parts) > max_depth:
+ raise SecurePathError("directory_depth_limit", "OpenClaw skills directory exceeds the depth limit")
+ kind = reader.kind(relative)
+ if kind == "missing" and relative in declared_roots and lstat_walk(reader.root, relative).outcome == "missing":
+ # kind() also maps non-directory ancestors to "missing". Only a
+ # genuinely absent declaration is optional, never a wrong-type path.
+ continue
+ if kind != "dir":
+ raise SecurePathError("unsafe_path", f"OpenClaw skills directory changed or is unsafe: {relative}")
+ remaining = max_paths - discovered_paths
+ if remaining < 1:
+ raise SecurePathError(
+ "path_count_limit",
+ f"OpenClaw skills exceed the discovery path limit of {max_paths} entries.",
+ relative_path=relative.as_posix(),
+ metadata={"actual": discovered_paths + 1, "limit": max_paths},
+ )
+ entries.clear()
+ paths_before_walk = discovered_paths
+ try:
+ files = discover_secure_files(
+ plugin_root / relative.as_posix(),
+ selected=selected,
+ max_paths=remaining,
+ max_depth=1,
+ )
+ except SecurePathError as exc:
+ if exc.code != "path_count_limit":
+ raise
+ raise SecurePathError(
+ "path_count_limit",
+ f"OpenClaw skills exceed the discovery path limit of {max_paths} entries.",
+ relative_path=(relative / exc.relative_path).as_posix(),
+ metadata={"actual": paths_before_walk + exc.metadata.get("actual", remaining + 1), "limit": max_paths},
+ ) from exc
+ preferred = preferred_skill_manifests(files)
+ if preferred:
+ file = preferred[0]
+ manifest_relative = Path(relative.as_posix()) / file.relative_path
+ manifests.setdefault(
+ manifest_relative.parent.as_posix(),
+ SecureFile(reader.root, reader.root / manifest_relative, manifest_relative, file.metadata),
+ )
+ continue
+ for entry in reversed(entries):
+ # Apply exclusions to children only, never to an explicitly declared
+ # root. The shallow secure walk has not descended into any child.
+ if entry.name.startswith(".") or entry.name == "node_modules":
+ continue
+ child = relative / entry.as_posix()
+ kind = reader.kind(child)
+ if kind == "dir":
+ pending.append(child)
+ elif kind in {"link", "special", "missing"}:
+ raise SecurePathError("unsafe_path", f"OpenClaw skills path changed or is unsafe: {child}")
+ return [manifests[key] for key in sorted(manifests)]
+
+
+__all__ = ["discover_openclaw_skill_manifests"]
diff --git a/src/skillevaluator/tier3/plugin_execution.py b/src/skillevaluator/tier3/plugin_execution.py
index ab90c5c3..0dacb796 100644
--- a/src/skillevaluator/tier3/plugin_execution.py
+++ b/src/skillevaluator/tier3/plugin_execution.py
@@ -422,7 +422,11 @@ def evaluate_prepared_plugin(
from skillevaluator.tier3.plugin_prepare import bind_runtime_results, stage_wrapper_skill, wrapper_skill_name
if not package.runnable:
- raise PluginLoadError("plugin has no runnable skill, rule, MCP server, or text component")
+ # Nothing was evaluated: INCOMPLETE with its recorded reasons, never a successful skip.
+ reasons = "; ".join(package.incomplete_reasons)
+ raise PluginLoadError(
+ "plugin has no runnable skill, rule, MCP server, or text component" + (f" ({reasons})" if reasons else "")
+ )
agents = parse_agents(options.agents)
if load != "wrapper" and not agents:
raise PluginLoadError("native plugin loading needs explicit agents")
diff --git a/src/skillevaluator/tier3/plugin_native.py b/src/skillevaluator/tier3/plugin_native.py
index d7caf2ac..95314761 100644
--- a/src/skillevaluator/tier3/plugin_native.py
+++ b/src/skillevaluator/tier3/plugin_native.py
@@ -46,9 +46,21 @@ from dataclasses import dataclass, field
from pathlib import Path, PurePosixPath
from typing import Any, ClassVar
-from skillevaluator.constants import CONTENT_DEDUP_MAX_FILE_BYTES, PLUGIN_CONFIG_MAX_BYTES
-from skillevaluator.plugin_formats import CLAUDE_PROFILE
+from skillevaluator.constants import (
+ CONTENT_DEDUP_MAX_FILE_BYTES,
+ PLUGIN_CODEX_MANIFEST_TYPE,
+ PLUGIN_CONFIG_MAX_BYTES,
+ PLUGIN_CURSOR_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
+)
+from skillevaluator.plugin_formats import (
+ CLAUDE_PROFILE,
+ CODEX_PROFILE,
+ codex_accepts_path,
+ declared_value_replaces_default,
+)
from skillevaluator.plugin_inventory import COMPONENT_TYPES
+from skillevaluator.plugin_manifest import manifest_type_for_relative_path
from skillevaluator.plugin_markdown import parse_markdown
from skillevaluator.plugin_paths import PluginRootReader, normalize_declared_path
from skillevaluator.tier3.toml_utils import toml_quote
@@ -489,6 +501,13 @@ def to_claude_root(value: Any, pattern: re.Pattern[str] | None) -> Any:
_CURSOR_ROOT_VAR_RE = foreign_root_var_re(("${CURSOR_PLUGIN_ROOT}", "${PLUGIN_ROOT}"))
+#: Why native OpenClaw runtime rows are never staged by any adapter.
+OPENCLAW_RUNTIME_NOT_LOADED = (
+ "OpenClaw runtime is not loaded: native tools, hooks, channels, providers and services are inventoried only; "
+ "this run evaluates portable components, not OpenClaw behavior"
+)
+
+
def declared_plugin_paths(value: Any) -> list[PurePosixPath]:
"""The root-relative paths a ``plugin.json`` path field declares (one path or a list of them).
@@ -1075,7 +1094,15 @@ class HarnessAdapter:
if modes["hook"] == "unsupported":
rows.extend(("hook", hook.name, reason) for hook in source.hooks)
rows.extend((text.type, text.name, reason) for text in source.texts if modes.get(text.type) == "unsupported")
- rows.extend((component_type, name, reason) for component_type, name in source.other)
+ openclaw = manifest_type_for_relative_path(source.manifest_rel) == PLUGIN_OPENCLAW_MANIFEST_TYPE
+ rows.extend(
+ (
+ component_type,
+ name,
+ OPENCLAW_RUNTIME_NOT_LOADED if openclaw and component_type == "extension" else reason,
+ )
+ for component_type, name in source.other
+ )
if not self.copies_plugin_tree:
# Only an adapter that copies the plugin tree can start a server that launches from plugin files.
rows.extend(
@@ -1352,6 +1379,17 @@ class ClaudeCodeAdapter(HarnessAdapter):
def plugin_name(self, source: NativePluginSource) -> str:
return plugin_slug(source.plugin_name)
+ @staticmethod
+ def stages_members_only(source: NativePluginSource) -> bool:
+ """Whether only the inventoried member skills are staged, without a copy of the plugin tree.
+
+ A native OpenClaw plugin's members are exactly its declared skill roots.
+ Copying its tree would also load Claude Code's default ``skills/``,
+ ``commands/``, ``agents/``, ``hooks/`` and ``bin/`` locations and ship
+ the native manifest's host metadata, none of which OpenClaw loads.
+ """
+ return manifest_type_for_relative_path(source.manifest_rel) == PLUGIN_OPENCLAW_MANIFEST_TYPE
+
def manifest(self, source: NativePluginSource) -> dict[str, Any]:
"""The staged ``plugin.json``: identity plus the component keys that stay native.
@@ -1362,15 +1400,50 @@ class ClaudeCodeAdapter(HarnessAdapter):
"""
manifest: dict[str, Any] = {"name": self.plugin_name(source), "description": source.description}
if source.contained:
- for key in ("version", "skills", "commands", "agents", "outputStyles", "userConfig"):
+ for key in ("version", "commands", "agents", "outputStyles", "userConfig"):
if key in source.manifest:
value = source.manifest[key]
manifest[key] = json.loads(json.dumps(value)) if isinstance(value, dict | list) else value
+ manifest.update(self._skill_manifest_fields(source))
return manifest
+ def _skill_manifest_fields(self, source: NativePluginSource) -> dict[str, Any]:
+ """Project the source client's skill declarations once, for the manifest and the census.
+
+ Cursor loads undotted roots as written, so those become ``./`` paths
+ Claude Code accepts. Codex drops the paths it rejects instead; when none
+ remain, omitting the field keeps its default ``skills/`` discovery
+ without enabling uninventoried folders. A members-only source (OpenClaw)
+ declares nothing: its member skills are staged under ``skills/``. Native
+ Claude declarations, including invalid ones, are not repaired.
+ """
+ if not source.contained or "skills" not in source.manifest or self.stages_members_only(source):
+ return {}
+ value = source.manifest["skills"]
+ manifest_type = manifest_type_for_relative_path(source.manifest_rel)
+ if manifest_type == PLUGIN_CODEX_MANIFEST_TYPE:
+ if not declared_value_replaces_default(CODEX_PROFILE, "skills", value):
+ return {}
+ if isinstance(value, list):
+ value = [raw for raw in value if codex_accepts_path(raw)]
+ elif manifest_type == PLUGIN_CURSOR_MANIFEST_TYPE:
+ # Normalize contained paths only, keeping the scalar/list shape and
+ # invalid declarations rather than silently making them valid.
+ paths = value if isinstance(value, list) else [value]
+ normalized = []
+ for raw in paths:
+ declared = normalize_declared_path(raw, ()) if isinstance(raw, str) else None
+ normalized.append(
+ f"./{declared.rel.as_posix()}"
+ if declared is not None and declared.rel is not None and not declared.dot_relative
+ else raw
+ )
+ value = normalized if isinstance(value, list) else normalized[0]
+ return {"skills": json.loads(json.dumps(value)) if isinstance(value, dict | list) else value}
+
def _declared_skill_dirs(self, source: NativePluginSource) -> list[PurePosixPath]:
- """Root-relative skill directories the staged ``plugin.json`` declares (it keeps a contained ``skills``)."""
- return declared_plugin_paths(source.manifest.get("skills")) if source.contained else []
+ """Root-relative skill directories declared by the projected Claude Code manifest."""
+ return declared_plugin_paths(self._skill_manifest_fields(source).get("skills"))
def staged_skills(self, source: NativePluginSource) -> list[tuple[str, str, Path | None]]:
"""Every skill the staged plugin loads: ``(census name, plugin-relative dir, copy source or None)``.
@@ -1381,12 +1454,15 @@ class ClaudeCodeAdapter(HarnessAdapter):
plugin root, or inside it but somewhere Claude Code does not read) is
copied to ``skills/<name>``. A name that is already taken fails closed,
because Claude Code would load the other skill under that name; so do
- two skill directories of the plugin itself with one name.
+ two skill directories of the plugin itself with one name. A members-only
+ source has no plugin copy, so each member skill is copied to ``skills/<name>``.
"""
root = source.plugin_root.resolve()
reader = PluginRootReader(root)
+ members_only = self.stages_members_only(source)
loaded: list[str] = []
- for read_dir in (PurePosixPath("skills"), *self._declared_skill_dirs(source)):
+ read_dirs = () if members_only else (PurePosixPath("skills"), *self._declared_skill_dirs(source))
+ for read_dir in read_dirs:
if reader.kind(read_dir) != "dir":
continue
if reader.kind(read_dir / "SKILL.md") == "file":
@@ -1422,7 +1498,7 @@ class ClaudeCodeAdapter(HarnessAdapter):
continue
dest = PurePosixPath("skills") / safe_name(skill.name)
taken = loaded_names.get(dest.name)
- if taken is None and (dest.as_posix() in placed or reader.kind(dest) != "missing"):
+ if taken is None and (dest.as_posix() in placed or (not members_only and reader.kind(dest) != "missing")):
taken = dest.as_posix()
if taken is not None:
raise ValueError(
@@ -1435,7 +1511,10 @@ class ClaudeCodeAdapter(HarnessAdapter):
return staged
def _unsupported_rows(self, source: NativePluginSource) -> list[tuple[str, str, str]]:
- staged = {("bin", "bin"), *(("lsp", name) for name in source.lsp_servers)}
+ # bin/ reaches PATH only through the plugin copy.
+ staged = {("lsp", name) for name in source.lsp_servers}
+ if not self.stages_members_only(source):
+ staged.add(("bin", "bin"))
if source.settings:
staged.add(("settings", _PLUGIN_SETTINGS_FILE))
rows: list[tuple[str, str, str]] = []
@@ -1455,8 +1534,9 @@ class ClaudeCodeAdapter(HarnessAdapter):
def build(self, source: NativePluginSource) -> NativeBundle:
bundle = self._base_bundle()
# The plugin root is copied (secure copy, evals/ and unsupported files
- # excluded) so hook scripts and other plugin-relative files resolve.
- bundle.plugin_tree = self.bundle_dir
+ # excluded) so hook scripts and other plugin-relative files resolve. A
+ # members-only source stages its member skills and generated files only.
+ bundle.plugin_tree = None if self.stages_members_only(source) else self.bundle_dir
bundle.harness = {"kind": "claude-code-init", "plugin": self.plugin_name(source)}
manifest = self.manifest(source)
checks: list[CensusCheck] = []
diff --git a/src/skillevaluator/tier3/plugin_prepare.py b/src/skillevaluator/tier3/plugin_prepare.py
index 5f61f805..4d0c73e1 100644
--- a/src/skillevaluator/tier3/plugin_prepare.py
+++ b/src/skillevaluator/tier3/plugin_prepare.py
@@ -25,9 +25,10 @@ from skillevaluator.constants import (
CONTENT_DEDUP_MAX_FILE_BYTES,
CONTENT_DEDUP_MAX_TOTAL_BYTES,
PLUGIN_CURSOR_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
)
from skillevaluator.plugin_config_risk import _nested_hook_groups
-from skillevaluator.plugin_formats import profile_for
+from skillevaluator.plugin_formats import manifest_identity, profile_for
from skillevaluator.plugin_markdown import parse_markdown
from skillevaluator.plugin_mcp import _server_launch_files
from skillevaluator.plugin_paths import PluginRootReader
@@ -41,6 +42,17 @@ if TYPE_CHECKING:
from skillevaluator.plugin_inventory import PluginInventory
_FRONTMATTER_HOOKS = "#hooks"
+OPENCLAW_STDIO_CWD_REASON = (
+ "OpenClaw stdio MCP servers are not supported in Tier 3 because their plugin-root working directory cannot be "
+ "preserved"
+)
+OPENCLAW_ROOT_SKILL_REASON = (
+ "inventory only: the plugin root is never copied as a portable member skill; declare a separate skill directory"
+)
+# Manifest fields a native OpenClaw source forwards to staged manifests. Other
+# host metadata (configSchema defaults, channels, providers, future credential
+# fields) is not inventoried and never reaches an agent.
+_OPENCLAW_FORWARDED_FIELDS = ("id", "name", "description", "version", "skills", "mcpServers")
_TEXT_TYPES = frozenset({"agent", "command", "output_style"})
_RUNTIME_TYPES = frozenset({"skill", "rule", "mcp"})
@@ -149,9 +161,23 @@ def prepare_runtime_package(
manifest = inventory.selected_manifest.parse_for_audit()
if not isinstance(manifest, dict):
raise PreparationError(f"selected manifest is unreadable: {identity.manifest}")
+ openclaw = inventory.selected_manifest.manifest_type == PLUGIN_OPENCLAW_MANIFEST_TYPE
+ if openclaw:
+ # The id is the only identity a native OpenClaw plugin has; never stage a
+ # package whose identity or declarations the client would reject.
+ from skillevaluator.plugin_format_schema import validate_manifest_fields
+
+ errors = [
+ issue
+ for issue in validate_manifest_fields(PLUGIN_OPENCLAW_MANIFEST_TYPE, manifest)
+ if issue.level == "error"
+ ]
+ if errors:
+ raise PreparationError(f"invalid OpenClaw manifest: {errors[0].message}")
selected = inventory.selected_components
selected_ids = {id(member) for member in selected}
audit = [_audit_row(member) for member in inventory.components if id(member) not in selected_ids]
+ incomplete = [] if inventory.complete else ["plugin inventory is incomplete"]
skills: list[PluginMember] = []
rules: list[PluginMember] = []
mcp: list[Mapping[str, Any]] = []
@@ -159,18 +185,46 @@ def prepare_runtime_package(
if member.problem is not None:
audit.append(AuditRow(member.type, member.name, member.path, f"unresolved: {member.problem}"))
elif member.type == "skill" and member.path:
- skills.append(member)
+ if openclaw and member.path == ".":
+ audit.append(AuditRow("skill", member.name, member.path, OPENCLAW_ROOT_SKILL_REASON))
+ else:
+ skills.append(member)
elif member.type == "rule":
rules.append(member)
elif member.type == "mcp" and member.mcp is not None:
- if member.mcp.runnable:
- mcp.append({"name": member.mcp.name, **member.mcp.config})
+ if openclaw and member.mcp.kind == "command":
+ # The launch has an implicit plugin-root working directory (or an
+ # explicit one) that no adapter preserves; rewriting paths cannot
+ # make it faithful, so it is never started elsewhere.
+ audit.append(AuditRow("mcp", member.name, member.path, f"{OPENCLAW_STDIO_CWD_REASON}; not started"))
+ incomplete.append(f"OpenClaw stdio MCP server '{member.mcp.name}' was not started")
+ elif member.mcp.runnable:
+ config = dict(member.mcp.config)
+ if openclaw:
+ # A working directory does not apply to a URL transport.
+ config.pop("cwd", None)
+ config.pop("workingDirectory", None)
+ mcp.append({"name": member.mcp.name, **config})
+ if openclaw and member.mcp.unapplied:
+ unapplied = ", ".join(member.mcp.unapplied)
+ audit.append(AuditRow("mcp", member.name, member.path, f"unapplied configuration: {unapplied}"))
+ incomplete.append(
+ f"MCP server '{member.mcp.name}' declares configuration the runtime does not apply: {unapplied}"
+ )
else:
audit.append(
AuditRow("mcp", member.name, member.path, f"not runnable: {member.mcp.kind or 'no launch'}")
)
- plugin_name = str(manifest.get("name") or inventory.root.name)
- incomplete = [] if inventory.complete else ["plugin inventory is incomplete"]
+ elif openclaw and member.type == "extension":
+ audit.append(AuditRow(member.type, member.name, member.path, native.OPENCLAW_RUNTIME_NOT_LOADED))
+ # OpenClaw's name is a display label; its id is the stable plugin identity.
+ declared_identity = manifest_identity(inventory.selected_manifest.manifest_type, manifest)
+ plugin_name = str(declared_identity or inventory.root.name)
+ if openclaw and not (skills or rules or mcp):
+ incomplete.append(
+ "native OpenClaw runtime evaluation is unavailable; no portable skills or runnable MCP servers can be "
+ "evaluated"
+ )
source = build_native_source(
inventory, manifest, plugin_name=plugin_name, excluded_paths=excluded_paths, mcp_servers=mcp
)
@@ -343,6 +397,7 @@ def build_native_source(
"""
reader = PluginRootReader(inventory.root)
manifest_rel = inventory.selected_manifest.manifest_filename
+ openclaw = inventory.selected_manifest.manifest_type == PLUGIN_OPENCLAW_MANIFEST_TYPE
texts: list[native.NativeTextComponent] = []
hooks: list[native.NativeHookSource] = []
other: list[tuple[str, str]] = []
@@ -440,9 +495,17 @@ def build_native_source(
description=str(manifest.get("description") or ""),
contained=True,
plugin_root=inventory.root,
- manifest=dict(manifest),
+ manifest=(
+ {key: manifest[key] for key in _OPENCLAW_FORWARDED_FIELDS if key in manifest}
+ if openclaw
+ else dict(manifest)
+ ),
manifest_rel=manifest_rel,
- member_skills=tuple(inventory.root / member.path for member in inventory.selected_skills if member.path),
+ member_skills=tuple(
+ inventory.root / member.path
+ for member in inventory.selected_skills
+ if member.path and not (openclaw and member.path == ".")
+ ),
rules=tuple(
(member.name, member.text or "")
for member in inventory.selected_components
diff --git a/src/skillevaluator/validators/mcp_static.py b/src/skillevaluator/validators/mcp_static.py
index 44be9cf1..114f33de 100644
--- a/src/skillevaluator/validators/mcp_static.py
+++ b/src/skillevaluator/validators/mcp_static.py
@@ -41,6 +41,7 @@ from skillevaluator.constants import (
PLUGIN_AGENT_PLUGINS_V1_MANIFEST_TYPE,
PLUGIN_CODEX_MANIFEST_TYPE,
PLUGIN_CURSOR_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
)
from skillevaluator.models.result import Finding, Severity
from skillevaluator.plugin_permissions import (
@@ -148,11 +149,12 @@ _INSECURE_TLS_FLAGS: frozenset[str] = frozenset(
# NAME is unset), and Cursor documents '${env:NAME}'. Only these braced forms are expanded inside a URL.
_URL_EXPANSION_RE = re.compile(r"\$\{(?P<cursor>env:)?(?P<name>[A-Za-z_][A-Za-z0-9_]*)(?::-(?P<default>[^}]*))?\}")
# The MCP client that loads a manifest format decides how environment references in its MCP config expand.
-McpClient = Literal["claude", "codex", "cursor", "agent_plugins"]
+McpClient = Literal["claude", "codex", "cursor", "agent_plugins", "openclaw"]
_CLIENT_BY_MANIFEST: dict[str, McpClient] = {
PLUGIN_CODEX_MANIFEST_TYPE: "codex",
PLUGIN_CURSOR_MANIFEST_TYPE: "cursor",
PLUGIN_AGENT_PLUGINS_V1_MANIFEST_TYPE: "agent_plugins",
+ PLUGIN_OPENCLAW_MANIFEST_TYPE: "openclaw",
}
# Codex MCP fields that carry auth or environment the evaluation runtime does not apply (Tier 3 then reports
# the server INCOMPLETE).
@@ -915,25 +917,31 @@ def _resolve_url_references(server: _ServerFindings, url: str, label: str, clien
Claude Code (and, leniently, Cursor and Agent Plugins clients) expand
``${NAME:-default}``: the default the plugin ships is checked like any URL.
A reference without a default that decides the scheme or host leaves the
- endpoint to the user, which is a LOW advisory. Codex does not expand
- references in plugin MCP URLs at all (it reads the text as a relative URL
- and never connects), which is HIGH.
+ endpoint to the user, which is a LOW advisory. Codex and OpenClaw use
+ plugin MCP URLs verbatim, without expanding references (Codex reads the
+ text as a relative URL and never connects), which is HIGH.
"""
expanded, unresolved = _expand_url_defaults(url)
shown = redacted_url(url)
- if client == "codex":
+ if client in {"codex", "openclaw"}:
controls = _env_controls_endpoint(_URL_EXPANSION_RE.sub("${UNSET}", url))
- effect = (
- "reads it as a relative URL and never connects to the server"
- if controls
- else "sends the '${...}' text literally, so the variable is never filled in"
- )
+ if client == "openclaw":
+ client_name, client_plugin = "OpenClaw", "an OpenClaw"
+ effect = "uses the URL verbatim, without filling in environment variables"
+ else:
+ client_name, client_plugin = "Codex", "a Codex"
+ effect = (
+ "reads it as a relative URL and never connects to the server"
+ if controls
+ else "sends the '${...}' text literally, so the variable is never filled in"
+ )
server.report(
Severity.HIGH,
"mcp_url_env_not_expanded",
- f"{label} {shown!r} uses '${{...}}' environment expansion, which Codex does not apply to plugin "
- f"MCP URLs; Codex {effect}",
- "Write the full https:// endpoint in a Codex plugin; '${VAR:-default}' expansion is a Claude Code feature.",
+ f"{label} {shown!r} uses '${{...}}' environment expansion, which {client_name} does not apply to "
+ f"plugin MCP URLs; {client_name} {effect}",
+ f"Write the full https:// endpoint in {client_plugin} plugin; '${{VAR:-default}}' expansion is a "
+ "Claude Code feature.",
)
if not controls:
# The scheme, host, and port are written out: the endpoint checks still apply.
@@ -1155,6 +1163,11 @@ def _check_env_and_headers(server: _ServerFindings, config: dict[str, Any], *, c
if isinstance(oauth, dict):
# A literal client secret in the OAuth block ships with the plugin like any other credential.
_check_secret_values(server, "oauth", oauth, tls_env=False)
+ if client == "openclaw":
+ # OpenClaw's auth and enterprise blocks ship with the plugin like any other credential.
+ for section in ("auth", "enterprise"):
+ if isinstance(config.get(section), dict):
+ _check_secret_values(server, section, config[section], tls_env=False)
if client == "codex":
for field_name in CODEX_UNAPPLIED_MCP_FIELDS:
if config.get(field_name):
@@ -1249,8 +1262,24 @@ def _check_transport(server: _ServerFindings, config: dict[str, Any]) -> None:
)
-def _check_insecure_tls_config(server: _ServerFindings, config: dict[str, Any]) -> None:
+def openclaw_ssl_verification_enabled(config: dict[str, Any]) -> bool:
+ """Effective OpenClaw TLS policy: the canonical boolean, then the legacy one, else verified TLS."""
+ canonical = config.get("sslVerify")
+ legacy = config.get("ssl_verify")
+ return canonical if isinstance(canonical, bool) else legacy if isinstance(legacy, bool) else True
+
+
+def _check_insecure_tls_config(
+ server: _ServerFindings, config: dict[str, Any], *, client: McpClient = "claude"
+) -> None:
"""Reject config keys that turn off TLS/certificate verification."""
+ if client == "openclaw" and not openclaw_ssl_verification_enabled(config):
+ server.report(
+ Severity.CRITICAL,
+ "mcp_insecure_tls_config",
+ "OpenClaw sslVerify disables certificate verification",
+ "Keep TLS certificate verification enabled; use a valid certificate chain.",
+ )
if config.get("insecure") is True:
server.report(
Severity.CRITICAL,
@@ -3617,7 +3646,7 @@ def validate_mcp_server_declaration(
)
_check_transport(server, config)
- _check_insecure_tls_config(server, config)
+ _check_insecure_tls_config(server, config, client=client)
security_config = _with_security_defaults(config, client=client)
_check_env_and_headers(server, security_config, client=client)
_check_overrides(server, security_config)
diff --git a/src/skillevaluator/validators/private_plugin_schema.py b/src/skillevaluator/validators/private_plugin_schema.py
index 276288c3..9f2fa41c 100644
--- a/src/skillevaluator/validators/private_plugin_schema.py
+++ b/src/skillevaluator/validators/private_plugin_schema.py
@@ -14,12 +14,13 @@ from skillevaluator.constants import (
PLUGIN_AGENT_PLUGINS_V1_MANIFEST_TYPE,
PLUGIN_CODEX_MANIFEST_TYPE,
PLUGIN_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
)
from skillevaluator.models.plugin import PluginManifest
from skillevaluator.models.result import Finding, Severity, ValidationResult
from skillevaluator.plugin_dependency_records import dependency_records
from skillevaluator.plugin_format_schema import validate_manifest_fields
-from skillevaluator.plugin_formats import parse_manifest_text
+from skillevaluator.plugin_formats import manifest_identity, parse_manifest_text
from skillevaluator.plugin_manifest import PluginManifestPathError
from skillevaluator.utils.structured_data import StructuredDataError
@@ -47,7 +48,9 @@ def validate_inventory_schema(inventory: PluginInventory) -> ValidationResult:
"manifest_type": manifest.manifest_type,
"manifest_filename": manifest.manifest_filename,
"selected": manifest == inventory.selected_manifest,
- "name": data.get("name") if data else None,
+ # OpenClaw's stable identity is its id; its name is only a display label.
+ "name": manifest_identity(manifest.manifest_type, data) if data else None,
+ "identity_field": "id" if manifest.manifest_type == PLUGIN_OPENCLAW_MANIFEST_TYPE else "name",
"version": data.get("version") if data else None,
}
)
@@ -82,7 +85,7 @@ def validate_inventory_schema(inventory: PluginInventory) -> ValidationResult:
if not data:
continue
if manifest == inventory.selected_manifest:
- selected_data = data
+ selected_data = {**data, "name": manifest_identity(manifest.manifest_type, data)}
if manifest.case_variant:
findings.append(
Finding(
@@ -129,18 +132,37 @@ def validate_inventory_schema(inventory: PluginInventory) -> ValidationResult:
)
)
if selected_data:
+ selected_row = next(row for row in declarations if row["selected"])
for row in declarations:
if not row["selected"] and any(
row[k] is not None and selected_data.get(k) is not None and row[k] != selected_data[k]
for k in ("name", "version")
):
+ openclaw_identity = (
+ row["name"] is not None
+ and selected_data.get("name") is not None
+ and row["name"] != selected_data["name"]
+ and "id" in {row["identity_field"], selected_row["identity_field"]}
+ )
findings.append(
Finding(
category="PLUGIN_SCHEMA",
severity=Severity.MEDIUM,
check_name="plugin_manifest_conflict",
- message="Client manifests declare different names or versions.",
+ message=(
+ f"{row['manifest_filename']} declares {row['identity_field']} {row['name']!r}, but the "
+ f"selected {selected_row['manifest_filename']} declares {selected_row['identity_field']} "
+ f"{selected_data.get('name')!r}; clients that load different manifests see different "
+ "plugins."
+ if openclaw_identity
+ else "Client manifests declare different names or versions."
+ ),
file_path=str(inventory.root / row["manifest_filename"]),
+ suggestion=(
+ "Keep the OpenClaw id equal to the plugin name in the other manifests."
+ if openclaw_identity
+ else None
+ ),
metadata=row,
)
)
diff --git a/tests/deduplication/plugin/test_openclaw_profile.py b/tests/deduplication/plugin/test_openclaw_profile.py
new file mode 100644
index 00000000..a0a41ab1
--- /dev/null
+++ b/tests/deduplication/plugin/test_openclaw_profile.py
@@ -0,0 +1,265 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Native OpenClaw bundles in the private local-catalog comparisons (Checks A, B, C-intra and C-inter)."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import os
+from pathlib import Path
+from types import SimpleNamespace
+from typing import Any
+
+import pytest
+
+from skillevaluator.deduplication.plugin import commands
+from skillevaluator.deduplication.plugin.catalog import LocalCatalog
+from skillevaluator.deduplication.plugin.catalog_checks import check_catalog_skills
+from skillevaluator.deduplication.plugin.profile import PLUGIN_NAME_MAX_REPORT_CHARS, load_plugin_profile
+from skillevaluator.utils.secure_fs import SecurePathError
+
+MANIFEST = "openclaw.plugin.json"
+
+
[email protected](autouse=True)
+def forbid_live_providers(monkeypatch):
+ from skillevaluator.embedding.client import EmbeddingClient
+ from skillevaluator.inference.client import LLMClient
+
+ def forbidden(*_args, **_kwargs):
+ raise AssertionError("Live provider calls are forbidden in these tests")
+
+ monkeypatch.setattr(EmbeddingClient, "embed", forbidden)
+ monkeypatch.setattr(EmbeddingClient, "embed_chunked", forbidden)
+ monkeypatch.setattr(LLMClient, "extract_json_from_response", forbidden)
+
+
+class FakeEmbedding:
+ model = "fixture-model"
+
+ def __init__(self):
+ self.calls: list[list[str]] = []
+
+ def _resolved_config(self):
+ return SimpleNamespace(provider="openai", base_url=None)
+
+ def embed(self, texts):
+ self.calls.append(list(texts))
+ return [[1.0, 0.0] for _ in texts]
+
+ def embed_single(self, text):
+ return self.embed([text])[0]
+
+
+def _skill(name: str) -> str:
+ return f"---\nname: {name}\ndescription: {name} guidance for releases.\n---\nBody.\n"
+
+
+def _tree(root: Path, files: dict[str, Any]) -> Path:
+ for rel, value in files.items():
+ path = root / rel
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(value if isinstance(value, str) else json.dumps(value), encoding="utf-8")
+ return root
+
+
+_OMIT = object()
+
+
+def _openclaw(root: Path, files: dict[str, Any] | None = None, **fields: Any) -> Path:
+ manifest = {"id": "release-helper", "configSchema": {"type": "object"}, **fields}
+ manifest = {key: value for key, value in manifest.items() if value is not _OMIT}
+ return _tree(root, {MANIFEST: manifest, **(files or {})})
+
+
+def _catalog(tmp_path: Path, *, skills=(), plugins=()) -> LocalCatalog:
+ from skillevaluator.embedding.registry import _client_endpoint_fingerprint
+
+ client = FakeEmbedding()
+ payload = {
+ "schema_version": 2,
+ "provider": "openai",
+ "model": client.model,
+ "mode": "description",
+ "endpoint_fingerprint": _client_endpoint_fingerprint(client),
+ "vector_dimension": 2,
+ "created_at": "2026-01-01T00:00:00+00:00",
+ "entries": list(skills),
+ "plugins": list(plugins),
+ }
+ path = tmp_path / "catalog.json"
+ path.write_text(json.dumps(payload), encoding="utf-8")
+ return LocalCatalog.load(path, client=client)
+
+
+def _skill_entry(path: str, fingerprint: str) -> dict[str, Any]:
+ return {
+ "id": f"skill:{path}",
+ "name": "catalog-skill",
+ "description": "Catalog skill",
+ "path": path,
+ "content_type": "skill",
+ "content_fingerprint": fingerprint,
+ "embedding": [1.0, 0.0],
+ }
+
+
+def _fingerprint(profile, root_relative: str) -> str:
+ [skill] = [skill for skill in profile.bundled_skills if skill.root_relative == root_relative]
+ return hashlib.sha256(skill.entry.embedding_text.encode("utf-8")).hexdigest()
+
+
+# --------------------------------------------------------------------------- #
+# Profile identity and members #
+# --------------------------------------------------------------------------- #
[email protected]("display_name", [_OMIT, "Readable Display Name"])
+def test_profile_identity_is_the_manifest_id(tmp_path: Path, display_name: Any) -> None:
+ root = _openclaw(tmp_path / "folder-name", name=display_name)
+ profile = load_plugin_profile(root)
+ assert profile.name == "release-helper"
+ assert profile.manifest == MANIFEST
+
+
[email protected]("identity", [_OMIT, None, "", " ", 17, [], "x" * (PLUGIN_NAME_MAX_REPORT_CHARS + 1)])
+def test_profile_requires_a_bounded_nonempty_id_without_folder_fallback(tmp_path: Path, identity: Any) -> None:
+ root = _openclaw(tmp_path / "folder-name", id=identity, name="Display Name")
+ with pytest.raises(ValueError) as caught:
+ load_plugin_profile(root)
+ assert not isinstance(caught.value, SecurePathError)
+
+
[email protected]("schema", [_OMIT, None, [], "schema", False])
+def test_profile_requires_a_config_schema_object(tmp_path: Path, schema: Any) -> None:
+ with pytest.raises(ValueError, match="configSchema"):
+ load_plugin_profile(_openclaw(tmp_path, configSchema=schema))
+
+
+def test_profile_members_come_only_from_declared_roots(tmp_path: Path) -> None:
+ files = {
+ "skills/implicit/SKILL.md": _skill("implicit"),
+ "custom/a/SKILL.md": _skill("alpha"),
+ "custom/group/b/SKILL.md": _skill("beta"),
+ "SKILL.md": _skill("root-skill"),
+ }
+ profile = load_plugin_profile(_openclaw(tmp_path, files, skills=["custom", "."]))
+ assert [skill.root_relative for skill in profile.bundled_skills] == [".", "custom/a", "custom/group/b"]
+ assert profile.members == ("alpha", "beta", "root-skill")
+
+
[email protected]("fields", [{}, {"skills": []}])
+def test_omitted_or_empty_skills_have_no_members(tmp_path: Path, fields: dict) -> None:
+ profile = load_plugin_profile(_openclaw(tmp_path, {"skills/implicit/SKILL.md": _skill("implicit")}, **fields))
+ assert profile.bundled_skills == ()
+ assert profile.members == ()
+
+
+def test_catalog_paths_are_relative_to_every_declared_root(tmp_path: Path) -> None:
+ files = {"custom/a/SKILL.md": _skill("alpha"), "direct/SKILL.md": _skill("direct")}
+ profile = load_plugin_profile(_openclaw(tmp_path, files, skills=["./custom", "custom/a", "direct"]))
+ paths = {skill.root_relative: skill.catalog_relative_paths for skill in profile.bundled_skills}
+ assert paths == {"custom/a": (".", "a"), "direct": (".",)}
+
+
+# --------------------------------------------------------------------------- #
+# C-inter self identity #
+# --------------------------------------------------------------------------- #
[email protected](("root", "relative"), [("custom", "a"), ("custom/a", "."), (".", "custom/a")])
+def test_skill_only_catalog_built_from_a_declared_root_is_self(tmp_path: Path, root: str, relative: str) -> None:
+ plugin = _openclaw(tmp_path / "plugin", {"custom/a/SKILL.md": _skill("alpha")}, skills=[root])
+ profile = load_plugin_profile(plugin)
+ catalog = _catalog(tmp_path, skills=[_skill_entry(relative, _fingerprint(profile, "custom/a"))])
+ result = check_catalog_skills(profile, catalog, threshold=0.5)
+ assert not result.findings
+ assert result.metadata["plugin"]["catalog_skill_similarity"]["status"] == "compared"
+ [success] = [row for row in result.success_details if row.check_name == "skill_catalog_comparison"]
+ assert success.metadata["self_matches_excluded"] == 1
+ assert success.metadata["excluded_catalog_paths"] == [relative]
+
+
+def test_same_content_elsewhere_or_changed_content_at_self_path_is_compared(tmp_path: Path) -> None:
+ plugin = _openclaw(tmp_path / "plugin", {"custom/a/SKILL.md": _skill("alpha")}, skills=["custom"])
+ profile = load_plugin_profile(plugin)
+ fingerprint = _fingerprint(profile, "custom/a")
+ catalog = _catalog(tmp_path, skills=[_skill_entry("other/a", fingerprint), _skill_entry("a", "0" * 64)])
+ result = check_catalog_skills(profile, catalog, threshold=0.5)
+ assert sorted(finding.metadata["catalog_path"] for finding in result.findings) == ["a", "other/a"]
+
+
+# --------------------------------------------------------------------------- #
+# Composed scan #
+# --------------------------------------------------------------------------- #
+ "fields",
+ [{"id": _OMIT}, {"id": ""}, {"configSchema": _OMIT}, {"configSchema": "schema"}],
+)
+def test_malformed_native_identity_is_an_incomplete_comparison_not_a_security_failure(
+ tmp_path: Path, monkeypatch, fields: dict
+) -> None:
+ monkeypatch.setattr(commands, "run_plugin_skill_context_dedup", lambda *_a, **_k: pytest.fail("no paid work"))
+ plugin = _openclaw(tmp_path, {"custom/a/SKILL.md": _skill("alpha")}, skills=["custom"], **fields)
+ results = commands.run_plugin_dedup_scan(plugin)
+ assert len(results) == 4
+ assert not any(result.metadata.get("security_failure") for result in results)
+ assert results[1].errors
+ assert all(result.metadata.get("optional_skip") for result in results[2:])
+
+
[email protected](not hasattr(os, "symlink"), reason="symlinks unavailable")
+def test_linked_declared_root_remains_a_security_failure(tmp_path: Path, monkeypatch) -> None:
+ monkeypatch.setattr(commands, "run_plugin_skill_context_dedup", lambda *_a, **_k: pytest.fail("no paid work"))
+ outside = _tree(tmp_path / "outside", {"a/SKILL.md": _skill("alpha")})
+ plugin = _openclaw(tmp_path / "plugin", skills=["linked"])
+ try:
+ (plugin / "linked").symlink_to(outside, target_is_directory=True)
+ except OSError as exc:
+ pytest.skip(f"symlinks unavailable: {exc}")
+ results = commands.run_plugin_dedup_scan(plugin)
+ assert results[1].metadata.get("security_failure")
+
+
+def test_context_comparison_uses_the_declared_roots(tmp_path: Path, monkeypatch) -> None:
+ seen: list[list[str]] = []
+
+ def context(profile, **_kwargs):
+ seen.append([skill.root_relative for skill in profile.bundled_skills])
+ return []
+
+ monkeypatch.setattr(commands, "run_plugin_skill_context_dedup", context)
+ files = {"skills/implicit/SKILL.md": _skill("implicit"), "portable/deploy/SKILL.md": _skill("deploy")}
+ commands.run_plugin_dedup_scan(_openclaw(tmp_path, files, skills=["portable"]))
+ assert seen == [["portable/deploy"]]
+
+
[email protected]("skills", ["./custom", None, {}, [1]])
+def test_malformed_skill_root_declarations_never_reach_comparisons(tmp_path: Path, monkeypatch, skills: Any) -> None:
+ monkeypatch.setattr(commands, "run_plugin_skill_context_dedup", lambda *_a, **_k: pytest.fail("no paid work"))
+ plugin = _openclaw(tmp_path, {"custom/a/SKILL.md": _skill("alpha")}, skills=skills)
+ with pytest.raises(ValueError) as caught:
+ load_plugin_profile(plugin)
+ assert not isinstance(caught.value, SecurePathError)
+ results = commands.run_plugin_dedup_scan(plugin)
+ assert not any(result.metadata.get("security_failure") for result in results)
+ assert results[1].errors
+ assert all(result.metadata.get("optional_skip") for result in results[2:])
+
+
+def test_unnamed_root_skill_is_labelled_like_its_inventory_row(tmp_path: Path) -> None:
+ plugin = _openclaw(tmp_path / "root-folder", {"SKILL.md": "---\ndescription: No name.\n---\nBody.\n"}, skills=["."])
+ profile = load_plugin_profile(plugin)
+ assert profile.members == ("root-folder",)
+
+
+def test_built_catalog_over_openclaw_plugins_records_declared_paths_and_excludes_self(tmp_path: Path) -> None:
+ collection = tmp_path / "collection"
+ files = {"custom/a/SKILL.md": _skill("alpha"), "skills/implicit/SKILL.md": _skill("implicit")}
+ plugin = _openclaw(collection / "release", files, description="Release guidance.", skills=["custom"])
+ _openclaw(collection / "other", {"portable/b/SKILL.md": _skill("beta")}, id="other", skills=["portable"])
+ catalog = LocalCatalog.build(collection, client=FakeEmbedding())
+ assert sorted(entry.path for entry in catalog.skills) == ["other/portable/b", "release/custom/a"]
+ assert [entry.path for entry in catalog.plugins] == ["release"]
+ result = check_catalog_skills(load_plugin_profile(plugin), catalog, threshold=0.5)
+ assert [finding.metadata["catalog_path"] for finding in result.findings] == ["other/portable/b"]
+ [success] = [row for row in result.success_details if row.check_name == "skill_catalog_comparison"]
+ assert success.metadata["excluded_catalog_paths"] == ["release/custom/a"]
diff --git a/tests/test_openclaw_plugin_discovery.py b/tests/test_openclaw_plugin_discovery.py
new file mode 100644
index 00000000..6dced246
--- /dev/null
+++ b/tests/test_openclaw_plugin_discovery.py
@@ -0,0 +1,455 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Native OpenClaw manifests through the private shared inventory and manifest schema checks."""
+
+from __future__ import annotations
+
+import json
+import os
+import socket
+import subprocess
+from pathlib import Path, PurePosixPath
+from typing import Any
+
+import pytest
+
+from skillevaluator.constants import CONTENT_DEDUP_MAX_DISCOVERED_PATHS, PLUGIN_OPENCLAW_MANIFEST_TYPE
+from skillevaluator.models.result import Severity
+from skillevaluator.plugin_inventory import plugin_inventory_for_root
+from skillevaluator.plugin_manifest import locate_plugin_manifest, manifest_relative_path, manifest_root_for
+from skillevaluator.plugin_skills import discover_openclaw_skill_manifests
+from skillevaluator.utils.secure_fs import MAX_SECURE_DIRECTORY_DEPTH, SecurePathError
+from skillevaluator.validators.private_plugin_schema import validate_inventory_schema
+
+MANIFEST = "openclaw.plugin.json"
+
+
+def _skill(name: str) -> str:
+ return f"---\nname: {name}\ndescription: {name} guidance.\n---\nBody.\n"
+
+
+def _tree(root: Path, files: dict[str, Any]) -> Path:
+ for rel, value in files.items():
+ path = root / rel
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(value if isinstance(value, str) else json.dumps(value), encoding="utf-8")
+ return root
+
+
+def _openclaw(root: Path, files: dict[str, Any] | None = None, **fields: Any) -> Path:
+ manifest = {"id": "release-helper", "configSchema": {"type": "object"}, **fields}
+ return _tree(root, {MANIFEST: manifest, **(files or {})})
+
+
+def _inventory(root: Path):
+ result = plugin_inventory_for_root(root)
+ assert result is not None
+ return result
+
+
+def _members(inventory, component_type: str = "skill") -> list[str]:
+ return sorted(
+ member.path or ""
+ for member in inventory.selected_components
+ if member.type == component_type and member.support == "evaluated" and not member.problem
+ )
+
+
+def _checks(findings) -> set[str]:
+ return {finding.check_name for finding in findings}
+
+
+# --------------------------------------------------------------------------- #
+# Manifest discovery and identity #
+# --------------------------------------------------------------------------- #
+def test_root_manifest_is_located_and_names_its_root(tmp_path: Path) -> None:
+ _openclaw(tmp_path)
+ located = locate_plugin_manifest(tmp_path)
+ assert located is not None
+ assert (located.manifest_type, located.manifest_filename) == (PLUGIN_OPENCLAW_MANIFEST_TYPE, MANIFEST)
+ assert manifest_relative_path(tmp_path / "OpenClaw.Plugin.json") == Path("OpenClaw.Plugin.json")
+ assert manifest_root_for(tmp_path / MANIFEST) == tmp_path
+
+
+def test_existing_manifest_precedence_is_preserved(tmp_path: Path) -> None:
+ _openclaw(tmp_path, {".claude-plugin/plugin.json": {"name": "release-helper"}})
+ located = locate_plugin_manifest(tmp_path)
+ assert located is not None
+ assert located.manifest_filename == ".claude-plugin/plugin.json"
+ assert [extra.manifest_filename for extra in located.additional] == [MANIFEST]
+
+
[email protected]("display_name", [None, "Readable Display Name"])
+def test_identity_is_the_manifest_id_not_the_display_name(tmp_path: Path, display_name: str | None) -> None:
+ fields = {} if display_name is None else {"name": display_name}
+ result = validate_inventory_schema(_inventory(_openclaw(tmp_path, **fields)))
+ [row] = result.metadata["plugin"]["manifest_declarations"]
+ assert (row["name"], row["identity_field"]) == ("release-helper", "id")
+ assert not [finding for finding in result.findings if finding.check_name.startswith("schema:")]
+
+
+ ("fields", "field"),
+ [
+ ({"id": None}, "id"),
+ ({"id": ""}, "id"),
+ ({"id": 7}, "id"),
+ ({"configSchema": None}, "configSchema"),
+ ({"configSchema": []}, "configSchema"),
+ ({"skills": "portable"}, "skills"),
+ ({"skills": ["portable", 7]}, "skills"),
+ ({"channels": [""]}, "channels"),
+ ({"description": 7}, "description"),
+ ],
+)
+def test_invalid_native_contract_is_a_blocking_schema_finding(tmp_path: Path, fields: dict, field: str) -> None:
+ manifest = {"id": "release-helper", "configSchema": {"type": "object"}, **fields}
+ manifest = {key: value for key, value in manifest.items() if value is not None}
+ _tree(tmp_path, {MANIFEST: manifest, "portable/SKILL.md": _skill("portable")})
+ result = validate_inventory_schema(_inventory(tmp_path))
+ matching = [finding for finding in result.findings if finding.check_name.startswith(f"schema:{field}:")]
+ assert matching
+ assert all(finding.severity == Severity.HIGH for finding in matching)
+
+
+def test_unknown_openclaw_metadata_is_retained_without_findings(tmp_path: Path) -> None:
+ _openclaw(
+ tmp_path,
+ channels=["slack"],
+ providers=["acme"],
+ uiHints={"title": "Release helper"},
+ requiresPlugins=["memory-core"],
+ )
+ result = validate_inventory_schema(_inventory(tmp_path))
+ assert not [finding for finding in result.findings if finding.check_name.startswith("schema:")]
+
+
[email protected]("selected_openclaw", [False, True])
+def test_identity_conflict_names_the_actual_fields_in_both_directions(tmp_path: Path, selected_openclaw: bool) -> None:
+ _openclaw(tmp_path, {".codex-plugin/plugin.json": {"name": "other-name", "version": "1.0.0"}})
+ # Codex outranks openclaw.plugin.json; naming the native manifest selects it directly.
+ inventory = _inventory(tmp_path / MANIFEST if selected_openclaw else tmp_path)
+ assert (inventory.selected_manifest.manifest_type == PLUGIN_OPENCLAW_MANIFEST_TYPE) is selected_openclaw
+ result = validate_inventory_schema(inventory)
+ [conflict] = [finding for finding in result.findings if finding.check_name == "plugin_manifest_conflict"]
+ assert "id 'release-helper'" in conflict.message
+ assert "name 'other-name'" in conflict.message
+ assert conflict.message.index("declares") < conflict.message.index("selected")
+ assert conflict.suggestion == "Keep the OpenClaw id equal to the plugin name in the other manifests."
+ assert conflict.metadata["identity_field"] == ("name" if selected_openclaw else "id")
+
+
+def test_version_only_conflict_is_not_reported_as_an_identity_conflict(tmp_path: Path) -> None:
+ _openclaw(tmp_path, {".claude-plugin/plugin.json": {"version": "2.0.0"}}, version="1.0.0")
+ result = validate_inventory_schema(_inventory(tmp_path))
+ [conflict] = [finding for finding in result.findings if finding.check_name == "plugin_manifest_conflict"]
+ assert conflict.message == "Client manifests declare different names or versions."
+ assert conflict.suggestion is None
+
+
+def test_matching_identity_with_a_different_version_stays_a_version_conflict(tmp_path: Path) -> None:
+ _openclaw(
+ tmp_path,
+ {".codex-plugin/plugin.json": {"name": "release-helper", "version": "2.0.0"}},
+ name="Release Helper",
+ version="1.0.0",
+ )
+ result = validate_inventory_schema(_inventory(tmp_path / MANIFEST))
+ [conflict] = [finding for finding in result.findings if finding.check_name == "plugin_manifest_conflict"]
+ assert conflict.message == "Client manifests declare different names or versions."
+
+
+def test_display_name_never_conflicts_with_another_manifest_name(tmp_path: Path) -> None:
+ _openclaw(
+ tmp_path,
+ {".codex-plugin/plugin.json": {"name": "release-helper", "version": "1.0.0"}},
+ name="Release Helper",
+ )
+ result = validate_inventory_schema(_inventory(tmp_path))
+ assert "plugin_manifest_conflict" not in _checks(result.findings)
+
+
+# --------------------------------------------------------------------------- #
+# Declared skill roots #
+# --------------------------------------------------------------------------- #
+ ("skills", "expected"),
+ [(None, []), ([], []), (["portable"], ["portable/own"]), (["skills"], ["skills/default"])],
+)
+def test_only_declared_skill_roots_are_members(tmp_path: Path, skills: list | None, expected: list[str]) -> None:
+ fields = {} if skills is None else {"skills": skills}
+ files = {"skills/default/SKILL.md": _skill("default"), "portable/own/SKILL.md": _skill("own")}
+ inventory = _inventory(_openclaw(tmp_path, files, **fields))
+ assert _members(inventory) == expected
+ if not expected:
+ # Another client's default folder stays static-only cross-client inventory.
+ [default] = [member for member in inventory.components if member.path == "skills/default"]
+ assert default.support == "static_only"
+ assert default.loaded_by
+
+
+def test_declared_roots_are_recursive_and_stop_at_skill_boundaries(tmp_path: Path) -> None:
+ files = {
+ "custom/a/SKILL.md": _skill("a"),
+ "custom/a/nested/SKILL.md": _skill("nested"),
+ "custom/b/c/SKILL.md": _skill("c"),
+ "custom/.hidden/x/SKILL.md": _skill("hidden"),
+ "custom/node_modules/y/SKILL.md": _skill("dependency"),
+ # OpenClaw applies no evaluation-artifact folder exclusions.
+ "custom/evals/z/SKILL.md": _skill("z"),
+ "direct/SKILL.md": _skill("direct"),
+ }
+ inventory = _inventory(_openclaw(tmp_path, files, skills=["custom", "./direct"]))
+ assert _members(inventory) == ["custom/a", "custom/b/c", "custom/evals/z", "direct"]
+ assert inventory.complete
+
+
[email protected]("root", [".hidden", "node_modules", "custom/.hidden", "custom/node_modules"])
+def test_explicitly_declared_hidden_or_dependency_root_is_searched(tmp_path: Path, root: str) -> None:
+ inventory = _inventory(_openclaw(tmp_path, {f"{root}/x/SKILL.md": _skill("x")}, skills=[root]))
+ assert _members(inventory) == [f"{root}/x"]
+
+
+def test_root_skill_selected_through_dot_is_inventoried(tmp_path: Path) -> None:
+ inventory = _inventory(_openclaw(tmp_path, {"SKILL.md": _skill("root")}, skills=["."]))
+ [member] = inventory.selected_skills
+ assert (member.path, member.name) == (".", tmp_path.name)
+ assert member.frontmatter["name"] == "root"
+
+
+def test_overlapping_roots_are_deduplicated(tmp_path: Path) -> None:
+ files = {"custom/a/SKILL.md": _skill("a")}
+ inventory = _inventory(_openclaw(tmp_path, files, skills=["custom", "custom/a", "./custom"]))
+ assert _members(inventory) == ["custom/a"]
+
+
[email protected](("declared", "problem"), [("../outside", "escape"), ("/tmp/outside", "escape")])
+def test_escaping_declared_roots_fail_closed(tmp_path: Path, declared: str, problem: str) -> None:
+ inventory = _inventory(_openclaw(tmp_path, skills=[declared]))
+ broken = [member for member in inventory.selected_components if member.type == "skill" and member.problem]
+ assert [member.problem for member in broken] == [problem]
+ assert not inventory.complete
+
+
+def test_missing_declared_root_is_reported(tmp_path: Path) -> None:
+ inventory = _inventory(_openclaw(tmp_path, skills=["missing"]))
+ [broken] = [member for member in inventory.selected_components if member.type == "skill"]
+ assert broken.problem == "missing"
+ assert any(finding.severity == Severity.HIGH for finding in inventory.findings)
+
+
[email protected](not hasattr(os, "symlink"), reason="symlinks unavailable")
[email protected]("kind", ["root", "child", "manifest"])
+def test_linked_declared_skill_paths_fail_closed(tmp_path: Path, kind: str) -> None:
+ plugin = tmp_path / "plugin"
+ outside = _tree(tmp_path / "outside", {"x/SKILL.md": _skill("x"), "SKILL.md": _skill("outside")})
+ _openclaw(plugin, {"custom/keep/SKILL.md": _skill("keep")}, skills=["custom"])
+ try:
+ if kind == "root":
+ (plugin / "linked").symlink_to(outside, target_is_directory=True)
+ _openclaw(plugin, skills=["linked"])
+ elif kind == "child":
+ (plugin / "custom" / "x").symlink_to(outside / "x", target_is_directory=True)
+ else:
+ (plugin / "custom" / "y").mkdir()
+ (plugin / "custom" / "y" / "SKILL.md").symlink_to(outside / "SKILL.md")
+ except OSError as exc:
+ pytest.skip(f"symlinks unavailable: {exc}")
+ inventory = _inventory(plugin)
+ assert any(member.problem == "unsafe" for member in inventory.selected_components if member.type == "skill")
+ assert not inventory.complete
+
+
+def test_shared_discovery_rejects_invalid_limits_and_declarations(tmp_path: Path) -> None:
+ for limits in (
+ {"max_roots": -1},
+ {"max_paths": 0},
+ {"max_depth": 0},
+ {"max_depth": MAX_SECURE_DIRECTORY_DEPTH + 1},
+ ):
+ with pytest.raises(ValueError):
+ discover_openclaw_skill_manifests(tmp_path, {"skills": []}, **limits)
+ for roots in (None, "./skills", {}, [1]):
+ with pytest.raises(ValueError):
+ discover_openclaw_skill_manifests(tmp_path, {"skills": roots})
+ with pytest.raises(ValueError, match="2-item limit"):
+ discover_openclaw_skill_manifests(tmp_path, {"skills": ["a", "b", "c"]}, max_roots=2)
+ with pytest.raises(SecurePathError):
+ discover_openclaw_skill_manifests(tmp_path, {"skills": ["../escape"]})
+
+
+def test_shared_discovery_path_budget_spans_all_declared_roots(tmp_path: Path) -> None:
+ _tree(tmp_path, {f"{root}/{index}/notes.txt": "x" for root in ("a", "b") for index in range(3)})
+ with pytest.raises(SecurePathError) as caught:
+ discover_openclaw_skill_manifests(tmp_path, {"skills": ["a", "b"]}, max_paths=4)
+ assert caught.value.code == "path_count_limit"
+ assert caught.value.metadata["limit"] == 4
+ assert len(discover_openclaw_skill_manifests(tmp_path, {"skills": ["a", "b"]})) == 0
+ assert CONTENT_DEDUP_MAX_DISCOVERED_PATHS > 4
+
+
+def test_shared_discovery_depth_is_bounded(tmp_path: Path) -> None:
+ deep = PurePosixPath(*(f"d{index}" for index in range(4)))
+ _tree(tmp_path, {f"{deep}/SKILL.md": _skill("deep")})
+ with pytest.raises(SecurePathError) as caught:
+ discover_openclaw_skill_manifests(tmp_path, {"skills": ["d0"]}, max_depth=2)
+ assert caught.value.code == "directory_depth_limit"
+ [found] = discover_openclaw_skill_manifests(tmp_path, {"skills": ["d0"]})
+ assert found.relative_path.parent.as_posix() == deep.as_posix()
+
+
+def test_missing_declared_roots_are_skipped_by_shared_discovery(tmp_path: Path) -> None:
+ _tree(tmp_path, {"present/SKILL.md": _skill("present")})
+ found = discover_openclaw_skill_manifests(tmp_path, {"skills": ["missing", "present"]})
+ assert [manifest.relative_path.parent.as_posix() for manifest in found] == ["present"]
+ _tree(tmp_path, {"file": "x"})
+ with pytest.raises(SecurePathError):
+ discover_openclaw_skill_manifests(tmp_path, {"skills": ["file"]})
+
+
+# --------------------------------------------------------------------------- #
+# package.json#openclaw runtime entrypoints #
+# --------------------------------------------------------------------------- #
+def _runtime_rows(inventory) -> dict[str, str | None]:
+ return {
+ member.name: member.path
+ for member in inventory.selected_components
+ if member.type == "extension" and not member.problem
+ }
+
+
+def _package(root: Path, openclaw: Any, files: dict[str, Any] | None = None, **fields: Any) -> Path:
+ return _openclaw(
+ root, {"package.json": {"name": "release-helper", "openclaw": openclaw}, **(files or {})}, **fields
+ )
+
+
+def test_runtime_row_is_kept_without_package_entrypoints(tmp_path: Path) -> None:
+ inventory = _inventory(_openclaw(tmp_path, {"portable/SKILL.md": _skill("portable")}, skills=["portable"]))
+ [runtime] = [member for member in inventory.selected_components if member.type == "extension"]
+ assert (runtime.name, runtime.path, runtime.support) == ("OpenClaw runtime", MANIFEST, "unsupported")
+
+
+def test_runtime_entrypoints_are_inventoried_without_importing_them(tmp_path: Path, monkeypatch) -> None:
+ def forbidden(*_args, **_kwargs):
+ pytest.fail("OpenClaw entrypoints must never be executed or fetched")
+
+ monkeypatch.setattr(subprocess, "Popen", forbidden)
+ monkeypatch.setattr(socket, "create_connection", forbidden)
+ _package(
+ tmp_path,
+ {"extensions": ["./src/index.ts"], "setupEntry": "./src/setup.ts"},
+ {"src/index.ts": "export {}", "src/setup.ts": "export {}"},
+ )
+ inventory = _inventory(tmp_path)
+ assert _runtime_rows(inventory) == {
+ "OpenClaw runtime": MANIFEST,
+ "openclaw.extensions: ./src/index.ts": "src/index.ts",
+ "openclaw.setupEntry: ./src/setup.ts": "src/setup.ts",
+ }
+ assert all(
+ member.support == "unsupported" for member in inventory.selected_components if member.type == "extension"
+ )
+ assert inventory.complete
+
+
[email protected]("with_setup", [False, True])
+def test_published_paired_runtime_does_not_require_typescript_source(tmp_path: Path, with_setup: bool) -> None:
+ metadata: dict[str, Any] = {"extensions": ["./src/index.ts"], "runtimeExtensions": ["./dist/index.js"]}
+ files = {"dist/index.js": "export {}"}
+ if with_setup:
+ metadata.update(setupEntry="./src/setup.ts", runtimeSetupEntry="./dist/setup.js")
+ files["dist/setup.js"] = "export {}"
+ inventory = _inventory(_package(tmp_path, metadata, files))
+ assert not [finding for finding in inventory.findings if finding.severity in {Severity.HIGH, Severity.CRITICAL}]
+ assert _runtime_rows(inventory)["openclaw.runtimeExtensions: ./dist/index.js"] == "dist/index.js"
+ assert inventory.complete
+
+
[email protected]("built", ["dist/index.js", "dist/index.cjs", "dist/src/index.mjs", "src/index.js"])
[email protected]("field", ["extensions", "setupEntry"])
+def test_inferred_built_runtime_excuses_a_missing_source(tmp_path: Path, built: str, field: str) -> None:
+ value: Any = ["./src/index.ts"] if field == "extensions" else "./src/index.ts"
+ inventory = _inventory(_package(tmp_path, {field: value}, {built: "export {}"}))
+ assert not [finding for finding in inventory.findings if finding.severity in {Severity.HIGH, Severity.CRITICAL}]
+ runtime_field = "runtimeExtensions" if field == "extensions" else "runtimeSetupEntry"
+ assert _runtime_rows(inventory)[f"openclaw.{runtime_field} (inferred): {built}"] == built
+
+
[email protected]("field", ["extensions", "setupEntry"])
+def test_missing_source_without_a_valid_runtime_is_blocking(tmp_path: Path, field: str) -> None:
+ value: Any = ["./src/index.ts"] if field == "extensions" else "./src/index.ts"
+ inventory = _inventory(_package(tmp_path, {field: value}))
+ assert any(finding.severity == Severity.HIGH for finding in inventory.findings)
+ assert any(member.problem == "missing" for member in inventory.selected_components if member.type == "extension")
+
+
+def test_missing_javascript_source_has_no_inferred_fallback(tmp_path: Path) -> None:
+ inventory = _inventory(_package(tmp_path, {"extensions": ["./index.js"]}, {"dist/index.js": "export {}"}))
+ assert any(member.problem == "missing" for member in inventory.selected_components if member.type == "extension")
+
+
+def test_explicit_runtime_must_exist_even_when_inferred_output_exists(tmp_path: Path) -> None:
+ metadata = {"extensions": ["./src/index.ts"], "runtimeExtensions": ["./dist/missing.js"]}
+ inventory = _inventory(_package(tmp_path, metadata, {"src/index.ts": "x", "dist/index.js": "x"}))
+ broken = [member for member in inventory.selected_components if member.type == "extension" and member.problem]
+ assert [member.problem for member in broken] == ["missing"]
+
+
[email protected]("source", ["../outside.ts", "/tmp/outside.ts", 7, ""])
+def test_runtime_never_bypasses_source_path_policy(tmp_path: Path, source: Any) -> None:
+ metadata = {"extensions": [source], "runtimeExtensions": ["./dist/index.js"]}
+ inventory = _inventory(_package(tmp_path, metadata, {"dist/index.js": "x"}))
+ assert any(finding.severity == Severity.HIGH for finding in inventory.findings)
+ assert not inventory.complete
+
+
+ ("metadata", "message"),
+ [
+ ("entrypoints", "package.json#openclaw must be an object"),
+ ({"extensions": "./src/index.ts"}, "openclaw.extensions must be an array"),
+ ({"setupEntry": ["./src/setup.ts"]}, "openclaw.setupEntry must be a string"),
+ (
+ {"extensions": ["./a.ts", "./b.ts"], "runtimeExtensions": ["./dist/a.js"]},
+ "openclaw.runtimeExtensions length must match openclaw.extensions length",
+ ),
+ ({"runtimeSetupEntry": "./dist/setup.js"}, "openclaw.runtimeSetupEntry requires openclaw.setupEntry"),
+ ],
+)
+def test_runtime_metadata_shape_and_pairing_are_not_relaxed(tmp_path: Path, metadata: Any, message: str) -> None:
+ files = dict.fromkeys(("a.ts", "b.ts", "dist/a.js", "dist/setup.js", "src/index.ts", "src/setup.ts"), "x")
+ inventory = _inventory(_package(tmp_path, metadata, files))
+ invalid = [finding for finding in inventory.findings if finding.check_name == "plugin_openclaw_package_invalid"]
+ assert [finding.message for finding in invalid] == [message]
+ assert all(finding.severity == Severity.HIGH for finding in invalid)
+
+
+def test_runtime_entries_stay_paired_by_index(tmp_path: Path) -> None:
+ metadata = {"extensions": ["./src/a.ts", "./src/b.ts"], "runtimeExtensions": ["./dist/a.js", "./dist/b.js"]}
+ inventory = _inventory(_package(tmp_path, metadata, {"dist/a.js": "x", "src/b.ts": "x"}))
+ # b's explicit runtime is missing; its existing source does not excuse that.
+ broken = [member for member in inventory.selected_components if member.type == "extension" and member.problem]
+ assert [(member.name, member.problem) for member in broken] == [("./dist/b.js", "missing")]
+
+
+def test_empty_runtime_array_allows_upstream_inference(tmp_path: Path) -> None:
+ metadata = {"extensions": ["./src/index.ts"], "runtimeExtensions": []}
+ inventory = _inventory(_package(tmp_path, metadata, {"dist/index.js": "x"}))
+ assert "openclaw.runtimeExtensions (inferred): dist/index.js" in _runtime_rows(inventory)
+ assert inventory.complete
+
+
[email protected]("skills", ["./skills", None, {}, "skills"])
+def test_non_array_skills_declaration_reads_no_root(tmp_path: Path, skills: Any) -> None:
+ manifest = {"id": "release-helper", "configSchema": {"type": "object"}, "skills": skills}
+ _tree(tmp_path, {MANIFEST: manifest, "skills/a/SKILL.md": _skill("a")})
+ inventory = _inventory(tmp_path)
+ assert _members(inventory) == []
+ [broken] = [member for member in inventory.selected_components if member.type == "skill"]
+ assert broken.problem == "invalid"
+ assert "plugin_component_path_invalid" in _checks(inventory.findings)
+ assert not inventory.complete
+ result = validate_inventory_schema(inventory)
+ assert any(finding.check_name.startswith("schema:skills:") for finding in result.findings)
diff --git a/tests/test_openclaw_plugin_smoke.py b/tests/test_openclaw_plugin_smoke.py
new file mode 100644
index 00000000..e4efac93
--- /dev/null
+++ b/tests/test_openclaw_plugin_smoke.py
@@ -0,0 +1,102 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""The repeatable OpenClaw compatibility smoke over the private plugin helpers."""
+
+from __future__ import annotations
+
+import importlib.util
+import json
+from pathlib import Path
+from typing import Any
+
+import pytest
+
+SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "ci" / "smoke_openclaw_plugins.py"
+
+
+def _load():
+ spec = importlib.util.spec_from_file_location("smoke_openclaw_plugins", SCRIPT)
+ assert spec is not None and spec.loader is not None
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+smoke = _load()
+
+
+def _skill(name: str) -> str:
+ return f"---\nname: {name}\ndescription: {name} guidance.\n---\nBody.\n"
+
+
+def _leaks_host_path(text: str, path: Path) -> bool:
+ # JSON escapes Windows separators, so check the raw, POSIX and JSON-escaped spellings.
+ return any(form in text for form in {str(path), path.as_posix(), json.dumps(str(path))[1:-1]})
+
+
+def _plugin(root: Path, files: dict[str, Any] | None = None, **fields: Any) -> Path:
+ manifest = {"id": root.name, "configSchema": {"type": "object"}, **fields}
+ for rel, value in {"openclaw.plugin.json": manifest, **(files or {})}.items():
+ path = root / rel
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(value if isinstance(value, str) else json.dumps(value), encoding="utf-8")
+ return root
+
+
+def test_smoke_covers_portable_root_and_runtime_only_boundaries(tmp_path: Path) -> None:
+ portable = _plugin(
+ tmp_path / "portable",
+ {"SKILL.md": _skill("root"), "skills/alpha/SKILL.md": _skill("alpha")},
+ skills=[".", "skills"],
+ )
+ runtime_only = _plugin(
+ tmp_path / "runtime-only", {"package.json": {"openclaw": {"extensions": ["./index.js"]}}, "index.js": "x"}
+ )
+ result = smoke.run_smoke({"portable": portable, "runtime": runtime_only}, iterations=2)
+ assert result["observations_passed"] == 4
+ assert not result["native_runtime_executed"] and not result["live_agent_executed"]
+ first, second = result["plugins"]["portable"], result["plugins"]["runtime"]
+ assert first["declared_skill_paths"] == [".", "skills/alpha"]
+ assert first["portable_tier3_skill_paths"] == ["skills/alpha"]
+ assert first["portable_tier3_runnable"] and first["runtime_components_unsupported"] == 1
+ assert not second["portable_tier3_runnable"]
+ assert any("OpenClaw runtime" in reason for reason in second["portable_tier3_incomplete_reasons"])
+ assert second["runtime_components_unsupported"] == 2
+ assert not _leaks_host_path(json.dumps(result), tmp_path)
+
+
+def test_smoke_keeps_existing_schema_findings_visible(tmp_path: Path) -> None:
+ files = {"skills/alpha/SKILL.md": _skill("alpha"), ".env": "TOKEN=x"}
+ result = smoke.run_smoke({"p": _plugin(tmp_path / "p", files, skills=["skills"])}, iterations=1)
+ assert result["plugins"]["p"]["tier1_findings"]
+
+
[email protected]("iterations", [0, smoke.MAX_ITERATIONS + 1])
+def test_smoke_bounds_repetition(tmp_path: Path, iterations: int) -> None:
+ with pytest.raises(ValueError, match="iterations"):
+ smoke.run_smoke({"p": _plugin(tmp_path / "p")}, iterations=iterations)
+
+
+def test_smoke_detects_non_deterministic_results(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ observations = iter([{"value": 1}, {"value": 2}])
+ monkeypatch.setattr(smoke, "inspect_plugin", lambda _root: next(observations))
+ with pytest.raises(AssertionError, match="Non-deterministic"):
+ smoke.run_smoke({"p": tmp_path}, iterations=2)
+
+
+def test_smoke_rejects_other_manifest_formats(tmp_path: Path) -> None:
+ (tmp_path / ".claude-plugin").mkdir()
+ (tmp_path / ".claude-plugin" / "plugin.json").write_text('{"name": "demo"}', encoding="utf-8")
+ with pytest.raises(ValueError, match="OpenClaw"):
+ smoke.inspect_plugin(tmp_path)
+
+
+def test_smoke_cli_writes_relative_report(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
+ plugin = _plugin(tmp_path / "p", {"skills/alpha/SKILL.md": _skill("alpha")}, skills=["skills"])
+ output = tmp_path / "out" / "smoke.json"
+ smoke.main(["--plugin", f"p={plugin}", "--iterations", "1", "--output", str(output)])
+ report = json.loads(output.read_text(encoding="utf-8"))
+ assert report["plugins"]["p"]["portable_tier3_skill_paths"] == ["skills/alpha"]
+ assert not _leaks_host_path(output.read_text(encoding="utf-8"), tmp_path)
+ assert "Passed 1 pipeline observations across 1 plugins" in capsys.readouterr().out
diff --git a/tests/tier3/test_openclaw_prepare.py b/tests/tier3/test_openclaw_prepare.py
new file mode 100644
index 00000000..e66dc21d
--- /dev/null
+++ b/tests/tier3/test_openclaw_prepare.py
@@ -0,0 +1,324 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Native OpenClaw plugins prepared for the private runtime: portable members only, runtime never certified."""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+from typing import Any
+
+import pytest
+
+from skillevaluator.evaluation.options import EvaluationOptions
+from skillevaluator.plugin_inventory import plugin_inventory_for_root
+from skillevaluator.tier3 import plugin_execution as px
+from skillevaluator.tier3.harbor.native_staging import build_native_task_staging, stage_native_bundle
+from skillevaluator.tier3.plugin_native import OPENCLAW_RUNTIME_NOT_LOADED, ClaudeCodeAdapter, NativePluginSource
+from skillevaluator.tier3.plugin_prepare import (
+ OPENCLAW_ROOT_SKILL_REASON,
+ PreparationError,
+ prepare_runtime_package,
+ stage_wrapper_skill,
+)
+
+MANIFEST = "openclaw.plugin.json"
+
+
+def _skill(name: str) -> str:
+ return f"---\nname: {name}\ndescription: {name} guidance.\n---\nBody.\n"
+
+
+def _tree(root: Path, files: dict[str, Any]) -> Path:
+ for rel, value in files.items():
+ path = root / rel
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(value if isinstance(value, str) else json.dumps(value), encoding="utf-8")
+ return root
+
+
+def _openclaw(root: Path, files: dict[str, Any] | None = None, **fields: Any) -> Path:
+ manifest = {"id": "release-helper", "configSchema": {"type": "object"}, **fields}
+ return _tree(root, {MANIFEST: manifest, **(files or {})})
+
+
+def _package(root: Path):
+ inventory = plugin_inventory_for_root(root)
+ assert inventory is not None
+ return prepare_runtime_package(inventory)
+
+
+def _audit(package) -> dict[str, str]:
+ return {row.name: row.reason for row in package.audit}
+
+
+def test_portable_members_are_staged_and_runtime_is_recorded_unsupported(tmp_path: Path) -> None:
+ files = {"custom/ship/SKILL.md": _skill("ship"), "skills/implicit/SKILL.md": _skill("implicit")}
+ package = _package(_openclaw(tmp_path, files, name="Release Helper", skills=["custom"]))
+ assert package.plugin_name == "release-helper"
+ assert [member.path for member in package.skills] == ["custom/ship"]
+ assert package.native_source.member_skills == (tmp_path / "custom" / "ship",)
+ assert _audit(package)["OpenClaw runtime"] == OPENCLAW_RUNTIME_NOT_LOADED
+ assert package.runnable and package.complete
+ rows = ClaudeCodeAdapter()._unsupported_rows(package.native_source)
+ assert ("extension", "OpenClaw runtime", OPENCLAW_RUNTIME_NOT_LOADED) in rows
+
+
[email protected]("declared_root", [".", "./"])
+def test_plugin_root_is_never_a_portable_member(tmp_path: Path, declared_root: str) -> None:
+ files = {
+ "SKILL.md": _skill("root"),
+ ".env": "TOKEN=x",
+ "evals/evals.json": [{"id": "one", "prompt": "Use the guidance."}],
+ "portable/a/SKILL.md": _skill("a"),
+ }
+ plugin = _openclaw(tmp_path / "plugin", files, skills=[declared_root, "portable"])
+ package = _package(plugin)
+ assert [member.path for member in package.skills] == ["portable/a"]
+ assert plugin not in package.native_source.member_skills
+ assert _audit(package)[plugin.name] == OPENCLAW_ROOT_SKILL_REASON
+ wrapper = stage_wrapper_skill(package, tmp_path / "wrapper", evals_source=plugin / "evals" / "evals.json")
+ staged = sorted(path.relative_to(wrapper.path).as_posix() for path in wrapper.path.rglob("*") if path.is_file())
+ assert staged == ["SKILL.md", "evals/evals.json", "skills/a/SKILL.md"]
+
+
[email protected]("declared_root", [".", "./"])
+def test_root_only_plugin_is_not_runnable_and_says_why(tmp_path: Path, declared_root: str) -> None:
+ package = _package(_openclaw(tmp_path, {"SKILL.md": _skill("root")}, skills=[declared_root]))
+ assert not package.runnable and not package.complete
+ assert any("OpenClaw runtime evaluation is unavailable" in reason for reason in package.incomplete_reasons)
+ with pytest.raises(px.PluginLoadError, match="OpenClaw runtime evaluation is unavailable"):
+ px.evaluate_prepared_plugin(
+ package, EvaluationOptions(skill_path=tmp_path), work_dir=tmp_path, evaluate=lambda _o: pytest.fail("ran")
+ )
+
+
+def test_runtime_only_plugin_is_incomplete_never_a_successful_skip(tmp_path: Path) -> None:
+ files = {"package.json": {"openclaw": {"extensions": ["./index.js"]}}, "index.js": "export {}"}
+ package = _package(_openclaw(tmp_path, files))
+ assert not package.runnable
+ assert not package.complete
+ assert {row.type for row in package.audit} == {"extension"}
+
+
+ "server",
+ [
+ {"command": "node", "args": ["server.js"]},
+ {"command": "node", "args": ["server.js"], "cwd": "srv"},
+ {"command": "node", "args": ["server.js"], "workingDirectory": "srv"},
+ ],
+)
+def test_stdio_servers_are_never_started_without_their_working_directory(tmp_path: Path, server: dict) -> None:
+ files = {"portable/a/SKILL.md": _skill("a"), "server.js": "x", "srv/server.js": "x"}
+ package = _package(_openclaw(tmp_path, files, skills=["portable"], mcpServers={"local": server}))
+ assert package.mcp_servers == ()
+ assert package.native_source.mcp_servers == () and package.native_source.plugin_file_mcp_servers == ()
+ assert "plugin-root working directory cannot be preserved" in _audit(package)["local"]
+ assert "OpenClaw stdio MCP server 'local' was not started" in package.incomplete_reasons
+
+
[email protected]("enabled", [False, True])
+def test_plugin_enabled_flag_is_not_an_operator_switch(tmp_path: Path, enabled: bool) -> None:
+ server = {"url": "https://mcp.example.com/sse", "enabled": enabled, "workingDirectory": "."}
+ package = _package(_openclaw(tmp_path, mcpServers={"remote": server}))
+ [staged] = package.mcp_servers
+ assert (staged["name"], staged["transport"]) == ("remote", "sse")
+ assert "cwd" not in staged and "workingDirectory" not in staged
+ assert [server["name"] for server in package.native_source.mcp_servers] == ["remote"]
+ assert package.runnable and package.complete
+
+
+def test_unapplied_host_configuration_makes_the_run_incomplete(tmp_path: Path) -> None:
+ server = {"url": "https://mcp.example.com/mcp", "transport": "streamable-http", "auth": {"type": "oauth"}}
+ package = _package(_openclaw(tmp_path, mcpServers={"remote": server}))
+ assert package.runnable
+ assert _audit(package)["remote"] == "unapplied configuration: auth"
+ assert package.incomplete_reasons == (
+ "MCP server 'remote' declares configuration the runtime does not apply: auth",
+ )
+
+
+ "fields",
+ [{"id": ""}, {"id": None}, {"configSchema": None}, {"skills": "portable"}],
+)
+def test_invalid_native_manifest_is_refused_before_staging(tmp_path: Path, fields: dict) -> None:
+ _openclaw(tmp_path, {"portable/a/SKILL.md": _skill("a")}, **{"skills": ["portable"], **fields})
+ with pytest.raises(PreparationError, match="invalid OpenClaw manifest"):
+ _package(tmp_path)
+
+
+def test_host_metadata_never_reaches_the_staged_manifest(tmp_path: Path) -> None:
+ fields = {
+ "skills": ["portable"],
+ "configSchema": {"type": "object", "properties": {"token": {"default": "never-forward"}}},
+ "uiHints": {"token": {"sensitive": True}},
+ "commands": "./commands",
+ "userConfig": {"token": {"type": "string", "default": "never-forward"}},
+ }
+ package = _package(_openclaw(tmp_path, {"portable/a/SKILL.md": _skill("a")}, **fields))
+ assert set(package.native_source.manifest) == {"id", "skills"}
+ manifest = ClaudeCodeAdapter().manifest(package.native_source)
+ # Member skills are staged under skills/, so the staged manifest declares no paths.
+ assert manifest == {"name": "release-helper", "description": ""}
+ assert "never-forward" not in json.dumps(manifest)
+
+
+def test_native_claude_code_loads_only_the_inventoried_member_skills(tmp_path: Path) -> None:
+ files = {
+ "SKILL.md": _skill("root"),
+ "custom/a/SKILL.md": _skill("a"),
+ "custom/node_modules/dep/SKILL.md": _skill("dep"),
+ "skills/implicit/SKILL.md": _skill("implicit"),
+ "commands/deploy.md": "# Deploy\n",
+ "agents/helper.md": "---\nname: helper\ndescription: Helper.\n---\nBody.\n",
+ "hooks/hooks.json": {"hooks": {}},
+ "settings.json": {"agent": "helper"},
+ ".mcp.json": {"mcpServers": {}},
+ "bin/tool": "#!/bin/sh\n",
+ "package.json": {"name": "release-helper"},
+ }
+ schema = {"type": "object", "properties": {"token": {"default": "never-forward"}}}
+ plugin = _openclaw(tmp_path / "plugin", files, skills=[".", "custom"], configSchema=schema)
+ package = _package(plugin)
+ adapter = ClaudeCodeAdapter()
+ staged = adapter.staged_skills(package.native_source)
+ assert [(name, rel) for name, rel, _copy in staged] == [("a", "skills/a")]
+ assert staged[0][2] is not None and staged[0][2].resolve() == (plugin / "custom" / "a").resolve()
+ bundle = adapter.build(package.native_source)
+ assert bundle.plugin_tree is None
+ assert [dest for _copy, dest in bundle.trees] == [f"{adapter.bundle_dir}/skills/a"]
+ assert ("bin", "bin") in {(kind, name) for kind, name, _reason in adapter._unsupported_rows(package.native_source)}
+ staging = build_native_task_staging("claude-code", adapter, package.native_source)
+ stage_native_bundle(tmp_path / "environment", staging)
+ staged_root = tmp_path / "environment" / "skilleval" / "native" / "claude-code" / "plugin"
+ staged_files = sorted(path.relative_to(staged_root).as_posix() for path in staged_root.rglob("*") if path.is_file())
+ # Only adapter-generated files and the member skill; nothing else from the plugin tree.
+ assert staged_files == [".claude-plugin/plugin.json", ".mcp.json", "hooks/hooks.json", "skills/a/SKILL.md"]
+ assert json.loads((staged_root / ".mcp.json").read_text(encoding="utf-8")) == {"mcpServers": {}}
+ assert json.loads((staged_root / "hooks" / "hooks.json").read_text(encoding="utf-8"))["hooks"] == {}
+ assert "never-forward" not in (staged_root / ".claude-plugin" / "plugin.json").read_text(encoding="utf-8")
+
+
+def test_openclaw_member_skills_with_one_name_fail_closed_natively(tmp_path: Path) -> None:
+ files = {"one/a/SKILL.md": _skill("a"), "two/a/SKILL.md": _skill("a")}
+ package = _package(_openclaw(tmp_path, files, skills=["one", "two"]))
+ with pytest.raises(ValueError, match="already has skills/a"):
+ ClaudeCodeAdapter().staged_skills(package.native_source)
+
+
+# --------------------------------------------------------------------------- #
+# Source-client-aware skill projection for native Claude Code #
+# --------------------------------------------------------------------------- #
+_OMIT = object()
+
+
+def _source(tmp_path: Path, manifest_rel: str, skills: Any) -> NativePluginSource:
+ manifest = {"name": "demo"} if skills is _OMIT else {"name": "demo", "skills": skills}
+ return NativePluginSource(
+ plugin_name="demo",
+ description="",
+ contained=True,
+ plugin_root=tmp_path,
+ manifest=manifest,
+ manifest_rel=manifest_rel,
+ )
+
+
+ ("skills", "expected"),
+ [
+ ("skills", "./skills"),
+ ("skills/alpha", "./skills/alpha"),
+ ("./skills", "./skills"),
+ (["portable", "./other"], ["./portable", "./other"]),
+ ],
+)
[email protected]("manifest_rel", [".cursor-plugin/plugin.json", ".Cursor-Plugin/plugin.json"])
+def test_cursor_undotted_roots_become_valid_claude_paths(
+ tmp_path: Path, manifest_rel: str, skills: Any, expected: Any
+) -> None:
+ assert ClaudeCodeAdapter().manifest(_source(tmp_path, manifest_rel, skills))["skills"] == expected
+
+
[email protected]("skills", ["skills", ["portable", "./other"], [".", "portable"], "./"])
+def test_openclaw_declares_no_skill_paths_to_claude(tmp_path: Path, skills: Any) -> None:
+ _tree(tmp_path, {"skills/implicit/SKILL.md": _skill("implicit"), "portable/a/SKILL.md": _skill("a")})
+ source = _source(tmp_path, MANIFEST, skills)
+ assert "skills" not in ClaudeCodeAdapter().manifest(source)
+ assert ClaudeCodeAdapter()._declared_skill_dirs(source) == []
+ assert ClaudeCodeAdapter().staged_skills(source) == []
+
+
+ "skills",
+ ["extras", ["extras"], ["./"], ["../escape"], [7], "./", []],
+)
+def test_codex_values_codex_rejects_never_reach_claude(tmp_path: Path, skills: Any) -> None:
+ source = _source(tmp_path, ".codex-plugin/plugin.json", skills)
+ assert "skills" not in ClaudeCodeAdapter().manifest(source)
+ assert ClaudeCodeAdapter()._declared_skill_dirs(source) == []
+
+
+ ("skills", "expected"),
+ [
+ ("./skills/core", "./skills/core"),
+ (["./skills/core", "extras"], ["./skills/core"]),
+ (["./a", "./b"], ["./a", "./b"]),
+ ],
+)
+def test_codex_keeps_only_the_paths_it_accepts_in_their_shape(tmp_path: Path, skills: Any, expected: Any) -> None:
+ assert ClaudeCodeAdapter().manifest(_source(tmp_path, ".codex-plugin/plugin.json", skills))["skills"] == expected
+
+
+def test_codex_ignored_extras_are_not_enabled_in_the_staged_census(tmp_path: Path) -> None:
+ _tree(tmp_path, {"skills/core/SKILL.md": _skill("core"), "extras/bonus/SKILL.md": _skill("bonus")})
+ source = _source(tmp_path, ".codex-plugin/plugin.json", ["./skills/core", "extras"])
+ staged = {rel for _name, rel, _copy in ClaudeCodeAdapter().staged_skills(source)}
+ assert staged == {"skills/core"}
+
+
[email protected]("manifest_rel", [".claude-plugin/plugin.json", "plugin.json"])
[email protected]("skills", ["extras", ["extras"], ["../escape"], [7], None, []])
+def test_other_formats_keep_their_declarations_unrepaired(tmp_path: Path, manifest_rel: str, skills: Any) -> None:
+ assert ClaudeCodeAdapter().manifest(_source(tmp_path, manifest_rel, skills))["skills"] == skills
+
+
+def _blocking(inventory) -> list:
+ from skillevaluator.models.result import Severity
+
+ return [finding for finding in inventory.findings if finding.severity in {Severity.HIGH, Severity.CRITICAL}]
+
+
+ ("server", "check"),
+ [
+ ({"url": "https://${HOST}/mcp"}, "mcp_url_env_not_expanded"),
+ ({"url": "https://mcp.example.com/mcp", "sslVerify": False}, "mcp_insecure_tls_config"),
+ ({"url": "https://mcp.example.com/mcp", "ssl_verify": False}, "mcp_insecure_tls_config"),
+ ],
+)
+def test_blocking_mcp_findings_refuse_preparation_under_the_callers_policy(
+ tmp_path: Path, server: dict, check: str
+) -> None:
+ inventory = plugin_inventory_for_root(_openclaw(tmp_path, mcpServers={"remote": server}))
+ assert inventory is not None
+ blocking = _blocking(inventory)
+ assert check in {finding.check_name for finding in blocking}
+ with pytest.raises(PreparationError, match=check):
+ prepare_runtime_package(inventory, blocking_findings=blocking)
+
+
+def test_literal_enterprise_secret_refuses_preparation_under_the_callers_policy(tmp_path: Path) -> None:
+ # Assembled at run time so the full-history secret scan never sees a literal credential.
+ sample = "s3cr3t-Value-" + "0123456789abcdef" + "ABCDEF"
+ server = {"url": "https://mcp.example.com/mcp", "enterprise": {"idpClientSecret": sample}}
+ inventory = plugin_inventory_for_root(_openclaw(tmp_path, mcpServers={"remote": server}))
+ assert inventory is not None
+ blocking = _blocking(inventory)
+ assert blocking and all(sample not in finding.message for finding in inventory.findings)
+ with pytest.raises(PreparationError, match="plugin policy blocks runtime evaluation"):
+ prepare_runtime_package(inventory, blocking_findings=blocking)
diff --git a/tests/validators/test_openclaw_mcp.py b/tests/validators/test_openclaw_mcp.py
new file mode 100644
index 00000000..79edce84
--- /dev/null
+++ b/tests/validators/test_openclaw_mcp.py
@@ -0,0 +1,216 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Native OpenClaw inline MCP servers: dialect normalization and the shared static policy."""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+from typing import Any
+
+import pytest
+
+from skillevaluator.constants import (
+ PLUGIN_CODEX_MANIFEST_TYPE,
+ PLUGIN_CONTAINED_MANIFEST_TYPE,
+ PLUGIN_OPENCLAW_MANIFEST_TYPE,
+)
+from skillevaluator.models.result import Severity
+from skillevaluator.plugin_formats import OPENCLAW_PROFILE
+from skillevaluator.plugin_mcp import McpCollection, collect_mcp_declarations
+from skillevaluator.plugin_paths import PluginRootReader
+from skillevaluator.validators.mcp_static import openclaw_ssl_verification_enabled, validate_mcp_server_declaration
+
+MANIFEST = "openclaw.plugin.json"
+
+
+def _collect(root: Path, servers: dict[str, Any], files: dict[str, str] | None = None) -> McpCollection:
+ for rel, text in (files or {}).items():
+ path = root / rel
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(text, encoding="utf-8")
+ manifest = {"id": "demo", "configSchema": {}, "mcpServers": servers}
+ (root / MANIFEST).write_text(json.dumps(manifest), encoding="utf-8")
+ return collect_mcp_declarations(
+ PluginRootReader(root), manifest, contained=True, manifest_rel=MANIFEST, profile=OPENCLAW_PROFILE
+ )
+
+
+def _one(collection: McpCollection):
+ [declaration] = collection.declarations
+ return declaration
+
+
+def _checks(findings, severity: Severity | None = None) -> set[str]:
+ return {f.check_name for f in findings if severity is None or f.severity == severity}
+
+
+ ("server", "transport"),
+ [
+ ({"url": "https://mcp.example.com/sse"}, "sse"),
+ ({"url": "https://mcp.example.com/mcp", "type": "http"}, "http"),
+ ({"url": "https://mcp.example.com/mcp", "type": "streamable-http"}, "http"),
+ ({"url": "https://mcp.example.com/mcp", "transport": "streamable-http"}, "http"),
+ # The canonical transport wins over the legacy type.
+ ({"url": "https://mcp.example.com/sse", "transport": "sse", "type": "http"}, "sse"),
+ ({"url": "https://mcp.example.com/mcp", "transport": "streamable-http", "type": "sse"}, "http"),
+ # A command wins over URL transports.
+ ({"command": "node", "transport": "sse"}, "stdio"),
+ ],
+)
+def test_transport_precedence_and_sse_default(tmp_path: Path, server: dict, transport: str) -> None:
+ collection = _collect(tmp_path, {"remote": server})
+ declaration = _one(collection)
+ assert declaration.config["transport"] == transport
+ assert "type" not in declaration.config
+ assert declaration.transport == transport
+ assert "mcp_transport_invalid" not in _checks(collection.findings)
+
+
+def test_invalid_canonical_transport_is_not_treated_as_legacy_http(tmp_path: Path) -> None:
+ collection = _collect(tmp_path, {"remote": {"url": "https://x.example/mcp", "transport": "ws", "type": "http"}})
+ assert _one(collection).config["transport"] == "ws"
+ assert "mcp_transport_invalid" in _checks(collection.findings, Severity.HIGH)
+
+
+ ("server", "cwd"),
+ [
+ ({"command": "node", "args": ["server.js"]}, "."),
+ ({"command": "node", "cwd": ""}, "."),
+ ({"command": "node", "cwd": "", "workingDirectory": "srv"}, "."),
+ ({"command": "node", "workingDirectory": "srv"}, "srv"),
+ ({"command": "node", "cwd": "srv", "workingDirectory": "other"}, "srv"),
+ ({"command": "node", "cwd": 7, "workingDirectory": "srv"}, "srv"),
+ ],
+)
+def test_stdio_launches_keep_their_plugin_root_working_directory(tmp_path: Path, server: dict, cwd: str) -> None:
+ assert _one(_collect(tmp_path, {"local": server})).config["cwd"] == cwd
+
+
[email protected]("server", [{"command": "node", "args": ["index.js"]}, {"command": "node", "cwd": ""}])
+def test_root_default_working_directory_cannot_hide_unscanned_server_code(tmp_path: Path, server: dict) -> None:
+ server = {**server, "args": ["node_modules/srv/index.js"]}
+ collection = _collect(tmp_path, {"local": server}, {"node_modules/srv/index.js": "x"})
+ assert "plugin_component_path_unscanned" in _checks(collection.server_findings, Severity.HIGH)
+
+
[email protected]("field", ["cwd", "workingDirectory"])
+def test_bare_relative_working_directory_is_checked(tmp_path: Path, field: str) -> None:
+ collection = _collect(tmp_path, {"local": {"command": "node", "args": ["index.js"], field: "node_modules/srv"}})
+ assert "plugin_component_path_unscanned" in _checks(collection.server_findings, Severity.HIGH)
+
+
+ "url",
+ ["https://${HOST}/mcp", "https://${HOST:-mcp.example.com}/mcp", "https://mcp.example.com/${PATH_PART}"],
+)
+def test_url_environment_references_are_verbatim_and_high(tmp_path: Path, url: str) -> None:
+ collection = _collect(tmp_path, {"remote": {"url": url}})
+ [finding] = [f for f in collection.server_findings if f.check_name == "mcp_url_env_not_expanded"]
+ assert finding.severity == Severity.HIGH
+ assert "OpenClaw" in finding.message and "Codex" not in finding.message
+ assert "an OpenClaw plugin" in (finding.suggestion or "")
+
+
+def test_other_clients_keep_their_url_environment_rules() -> None:
+ url = "https://${HOST:-mcp.example.com}/mcp"
+ claude = validate_mcp_server_declaration("s", {"url": url}, "f", manifest_type=PLUGIN_CONTAINED_MANIFEST_TYPE)
+ codex = validate_mcp_server_declaration("s", {"url": url}, "f", manifest_type=PLUGIN_CODEX_MANIFEST_TYPE)
+ assert "mcp_url_env_not_expanded" not in _checks(claude)
+ [finding] = [f for f in codex if f.check_name == "mcp_url_env_not_expanded"]
+ assert "Codex" in finding.message and "OpenClaw" not in finding.message
+
+
+def test_url_expansion_rejection_still_checks_inline_secrets() -> None:
+ # Assembled at run time so the full-history secret scan never sees a literal credential.
+ sample = "sk-live-" + "0123456789abcdefghij" + "klmnop"
+ url = f"https://${{HOST}}/mcp?api_key={sample}"
+ findings = validate_mcp_server_declaration("s", {"url": url}, "f", manifest_type=PLUGIN_OPENCLAW_MANIFEST_TYPE)
+ assert "mcp_url_env_not_expanded" in _checks(findings)
+ assert any(f.severity in {Severity.HIGH, Severity.CRITICAL} and "secret" in f.check_name for f in findings)
+ assert all(sample not in f.message for f in findings)
+
+
+ ("options", "enabled"),
+ [
+ ({}, True),
+ ({"sslVerify": True}, True),
+ ({"ssl_verify": True}, True),
+ ({"sslVerify": False}, False),
+ ({"ssl_verify": False}, False),
+ # The canonical key overrides the legacy alias in both directions.
+ ({"sslVerify": True, "ssl_verify": False}, True),
+ ({"sslVerify": False, "ssl_verify": True}, False),
+ # A non-boolean value is not a decision; the next source applies.
+ ({"sslVerify": "false", "ssl_verify": False}, False),
+ ({"sslVerify": None, "ssl_verify": True}, True),
+ ],
+)
+def test_effective_tls_policy(options: dict, enabled: bool) -> None:
+ assert openclaw_ssl_verification_enabled(options) is enabled
+ findings = validate_mcp_server_declaration(
+ "s", {"url": "https://x.example/mcp", **options}, "f", manifest_type=PLUGIN_OPENCLAW_MANIFEST_TYPE
+ )
+ assert ("mcp_insecure_tls_config" in _checks(findings, Severity.CRITICAL)) is not enabled
+
+
+def test_tls_options_are_openclaw_specific() -> None:
+ findings = validate_mcp_server_declaration(
+ "s", {"url": "https://x.example/mcp", "sslVerify": False}, "f", manifest_type=PLUGIN_CONTAINED_MANIFEST_TYPE
+ )
+ assert "mcp_insecure_tls_config" not in _checks(findings)
+
+
+ ("options", "unapplied"),
+ [
+ ({}, ()),
+ ({"sslVerify": True}, ()),
+ ({"ssl_verify": True}, ()),
+ ({"sslVerify": False}, ("sslVerify",)),
+ ({"ssl_verify": False}, ("ssl_verify",)),
+ ({"sslVerify": True, "ssl_verify": False}, ()),
+ ({"auth": {"type": "oauth"}, "toolFilter": ["read"]}, ("auth", "toolFilter")),
+ ({"enabled": False, "headers": {"X-Trace": "1"}}, ()),
+ ],
+)
+def test_host_only_options_are_recorded_as_unapplied(tmp_path: Path, options: dict, unapplied: tuple) -> None:
+ declaration = _one(_collect(tmp_path, {"remote": {"url": "https://x.example/mcp", **options}}))
+ assert declaration.unapplied == unapplied
+
+
+ ("section", "key"),
+ [
+ ("enterprise", "idpClientSecret"),
+ ("enterprise", "resourceClientSecret"),
+ ("auth", "token"),
+ ("auth", "clientSecret"),
+ ],
+)
+def test_auth_inline_credentials_block_without_echoing_values(section: str, key: str) -> None:
+ # Assembled at run time so the full-history secret scan never sees a literal credential.
+ sample = "s3cr3t-Value-" + "0123456789abcdef" + "ABCDEF"
+ config = {"url": "https://x.example/mcp", section: {key: sample, "type": "bearer"}}
+ findings = validate_mcp_server_declaration("s", config, "f", manifest_type=PLUGIN_OPENCLAW_MANIFEST_TYPE)
+ blocking = [f for f in findings if f.severity in {Severity.HIGH, Severity.CRITICAL}]
+ assert blocking
+ assert all(sample not in f.message for f in findings)
+
+
+ ("section", "block"),
+ [
+ ("enterprise", {"idpClientSecret": "${IDP_CLIENT_SECRET}"}),
+ ("auth", {"type": "oauth"}),
+ ("auth", {"type": "bearer", "token": "${MCP_TOKEN}"}),
+ ],
+)
+def test_auth_credential_references_are_allowed(section: str, block: dict) -> None:
+ config = {"url": "https://x.example/mcp", section: block}
+ findings = validate_mcp_server_declaration("s", config, "f", manifest_type=PLUGIN_OPENCLAW_MANIFEST_TYPE)
+ assert not [f for f in findings if f.severity in {Severity.HIGH, Severity.CRITICAL}]