Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ All notable changes to SkillEvaluator are documented in this file.
- Explain unverified activation in completed Tier 3 reports. The CLI shows
that evaluation completed when it has an inconclusive activation result.

### Fixed

- Native bundle evaluation accepts packages containing only hooks, LSP servers,
or supported settings when a selected native adapter can stage them. Each
agent's native plan must support a present component; unsupported plans are
refused in native mode or fall back in auto mode with the reason recorded.
Packages with no runnable plan stop before any trial, naming their components
and the selected agents' loading modes. Native refusal messages also retain
the reasons that a package is incomplete.

## 1.3.1 - 2026-11-30

- Stable PR comments can verify scans routed through an approved shared component.
Expand Down
24 changes: 16 additions & 8 deletions docs/bundle-evaluation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,17 @@ Where each adapter puts the bundle, inside the task container:
finding does not make the adapter stage it: `native` refuses, and `auto` falls
back. An agent that would not stage that type (Codex never stages hooks) is
not affected.

A refusal or fallback is decided before any trial starts. A component the adapter
cannot stage is a different case: it fails while the run stages its tasks, for
example an MCP server that references a host environment variable the operator
has not approved. That also stops the run before any trial, and `auto` does not
fall back for it.
- A package with no portable runnable component when a selected agent cannot
stage any of its component types natively, for example only hooks with Codex.
`native` refuses the run if any selected agent cannot load a present type.
`auto` records a wrapper fallback for that agent and refuses the run if no
selected agent can load the package natively.

A refusal or fallback is decided before any trial starts. An otherwise supported
component can still fail while the run stages its tasks, for example an MCP
server that references a host environment variable the operator has not approved.
That also stops the run before any trial, and `auto` does not fall back for that
staging error.

## Measure what the bundle adds

Expand Down Expand Up @@ -635,8 +640,11 @@ Pass --block-on-incomplete to fail a run in this state.

The exit status is unaffected by default, because an incomplete package can still
give useful scores. Add `--block-on-incomplete` to exit with status 1 when the
package is incomplete. A package with **nothing** to run, meaning no skill, rule,
MCP server or text component, is refused before any trial.
package is incomplete. A package with **nothing** to run is refused before any
trial: no skill, rule, MCP server or text component, and no hook, LSP server or
supported setting that a selected agent loads natively (`--plugin-load native`
or `auto`; with `wrapper`, the default, hooks, LSP servers and settings never
count).

## Before any trial

Expand Down
29 changes: 22 additions & 7 deletions src/skillevaluator/tier3/plugin_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,14 @@ def evaluate_prepared_plugin(

from skillevaluator.tier3.commands import parse_agents
from skillevaluator.tier3.plugin_evidence import EvidenceOptions, RuntimeEvidenceObserver
from skillevaluator.tier3.plugin_native import apply_native_refusals, resolve_plugin_load
from skillevaluator.tier3.plugin_native import (
apply_native_refusals,
native_component_types,
refuse_or_fall_back,
resolve_plugin_load,
)
from skillevaluator.tier3.plugin_prepare import bind_runtime_results, stage_wrapper_skill, wrapper_skill_name

if not package.runnable:
# 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")
Expand All @@ -463,6 +462,22 @@ def evaluate_prepared_plugin(
decisions = apply_native_refusals(
load, resolve_plugin_load(load, agents, env_mode=options.env_mode), package.native_source
)
if not package.runnable:
present = ", ".join(sorted(package.native_source.present_types())) or "none"
reasons = "; ".join(package.incomplete_reasons)
detail = f"present: {present}" + (f"; {reasons}" if reasons else "")
for agent, decision in decisions.items():
adapter = HARNESS_ADAPTERS.get(agent)
if decision.native and (adapter is None or not native_component_types(adapter, package.native_source)):
decisions[agent] = refuse_or_fall_back(
load, agent, f"plugin has no runnable component for this native adapter ({detail})"
)
if not any(decision.native for decision in decisions.values()):
modes = ", ".join(f"{agent}={decision.mode}" for agent, decision in decisions.items()) or "none"
raise PluginLoadError(
"plugin has no runnable component for the selected loading mode and agents "
f"(present: {present}; load: {load}; agents: {modes})" + (f"; {reasons}" if reasons else "")
)
results_dir = options.results_dir or package.native_source.plugin_root / "evals" / "results"
package = bind_runtime_results(package, results_dir)
temp = Path(tempfile.mkdtemp(prefix="skilleval-plugin-", dir=work_dir))
Expand Down
62 changes: 56 additions & 6 deletions tests/cli/test_tier3_evaluate_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,16 +738,66 @@ def missing(self, options, *, plugin_options=None, progress_reporter=None):
assert "Tier 3 dependencies are not installed" in outcome.output


def test_a_package_with_nothing_to_run_is_refused_with_its_reasons(tmp_path, monkeypatch):
@pytest.mark.parametrize(
("load", "agent", "with_reference"),
[
("wrapper", "opencode", False),
("wrapper", "claude-code", True),
("auto", "claude-code", True),
("native", "claude-code", True),
],
)
def test_a_package_with_nothing_to_run_is_refused_with_its_reasons(tmp_path, monkeypatch, load, agent, with_reference):
bundle = tmp_path / "bundle"
(bundle / ".claude-plugin").mkdir(parents=True)
(bundle / ".claude-plugin/plugin.json").write_text(json.dumps({"name": "demo"}), encoding="utf-8")
if with_reference:
bundle.mkdir()
manifest = {
"name": "demo",
"author": {"email": "dev@example.com"},
"rules": {"refs": ["github::other/lib::rules::style.md"]},
}
(bundle / "agent_plugin.yaml").write_text(json.dumps(manifest), encoding="utf-8")
else:
(bundle / ".claude-plugin").mkdir(parents=True)
(bundle / ".claude-plugin/plugin.json").write_text(json.dumps({"name": "demo"}), encoding="utf-8")
_no_engine(monkeypatch)
monkeypatch.setattr(
"skillevaluator.tier3.plugin_prepare.stage_wrapper_skill",
lambda *_args, **_kwargs: pytest.fail("A refused package reached staging"),
)
results = tmp_path / "results"

outcome = _invoke(str(bundle), "--results-dir", str(tmp_path / "results"))
outcome = CliRunner().invoke(
cli,
[
"tier3",
"evaluate-plugin",
str(bundle),
"--results-dir",
str(results),
"--plugin-load",
load,
"-a",
agent,
"--env-mode",
"docker",
"--progress",
"off",
],
)

assert outcome.exit_code == 1
assert "no runnable skill, rule, MCP server, or text component" in outcome.output
assert outcome.exit_code == 1, outcome.output
assert not results.exists()
message = " ".join(outcome.output.split())
assert "present: none" in message
if load == "native":
assert f"--plugin-load native is not supported for {agent}" in message
assert "no runnable component for this native adapter" in message
else:
assert "no runnable component for the selected loading mode and agents" in message
assert f"load: {load}" in message and f"{agent}=wrapper" in message
if with_reference:
assert "rule reference 'github::other/lib::rules::style.md' was not staged (unresolved)" in message


def _incomplete_bundle(root: Path) -> Path:
Expand Down
26 changes: 26 additions & 0 deletions tests/tier3/test_evaluate_bundle_native_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,32 @@ def test_a_native_run_loads_the_bundle_in_the_with_arm_only_and_counts_the_hooks
assert "Hook census" in (run_dir / "tier3-benchmark.md").read_text(encoding="utf-8")


@pytest.mark.parametrize("load", ["native", "auto"])
def test_native_loading_runs_a_bundle_that_contains_only_hooks(tmp_path, monkeypatch, load):
bundle = _bundle(tmp_path)
(bundle / ".claude-plugin/plugin.json").write_text(json.dumps({"name": "acceptance"}), encoding="utf-8")
(bundle / "evals").mkdir()
(bundle / "evals/evals.json").write_text(
json.dumps([{"id": f"case-{index}", "prompt": f"Perform fixture task {index}."} for index in range(1, 6)]),
encoding="utf-8",
)
shutil.rmtree(bundle / "skills")
launches, agents = _native_engine(monkeypatch, tmp_path / "census")
results = tmp_path / "results"
digest = publication_source_digest(bundle)

outcome = _run(bundle, results, "--plugin-load", load)

assert outcome.exit_code == 0, outcome.output
assert {variant for variant, _tasks in launches} == {"with", "without"}
assert ":Native" in (agents["with"] or "") and ":Native" not in (agents["without"] or "")
assert publication_source_digest(bundle) == digest
census = {row[2]: row for row in _sections(_run_dir(results))["hook_census"]["rows"]}
assert census[PRE][4] == 2 * TRIALS
assert census[POST][4] == TRIALS
assert census[STOP][4] == 0


def test_hook_census_discloses_the_trial_scan_limit(tmp_path, monkeypatch):
bundle = _bundle(tmp_path)
_native_engine(monkeypatch, tmp_path / "census")
Expand Down
72 changes: 72 additions & 0 deletions tests/tier3/test_plugin_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import shutil
import subprocess
from contextlib import nullcontext
from dataclasses import replace
from pathlib import Path

Expand Down Expand Up @@ -121,6 +122,77 @@ def test_permission_bypass_hook_is_recorded_as_a_native_refusal(tmp_path: Path)
assert [kind for kind, _, _ in source.refusals] == ["hook"]


@pytest.mark.parametrize(
("component_file", "config", "applied"),
[
(
"hooks/hooks.json",
{"hooks": {"SessionStart": [{"hooks": [{"type": "command", "command": "echo ready"}]}]}},
True,
),
(".lsp.json", {"python": {"command": "pylsp", "extensionToLanguage": {".py": "python"}}}, True),
("settings.json", {"agent": "reviewer"}, True),
("settings.json", {"env": {"IGNORED": "value"}}, False),
],
ids=["hook", "lsp", "settings", "ignored-settings"],
)
@pytest.mark.parametrize(
("load", "agent", "env_mode", "native"),
[
("native", "claude-code", "docker", True),
("auto", "claude-code", "docker", True),
("wrapper", "claude-code", "docker", False),
("native", "codex", "docker", False),
("auto", "codex", "docker", False),
("native", "claude-code,codex", "docker", False),
("native", "codex,claude-code", "docker", False),
("auto", "claude-code,codex", "docker", True),
("auto", "codex,claude-code", "docker", True),
("auto", "claude-code", "local", False),
("auto", "hermes", "docker", False),
],
)
def test_native_only_components_need_a_supporting_load_decision(
tmp_path: Path, component_file: str, config: dict, applied: bool, load: str, agent: str, env_mode: str, native: bool
) -> None:
root = _tree(
tmp_path / "plugin",
{
".claude-plugin/plugin.json": {"name": "demo"},
component_file: config,
"evals/evals.json": [{"id": "one", "prompt": "do it"}],
},
)
package = prepare_runtime_package(_inventory(root))
assert not package.runnable
calls = []
expected = nullcontext() if native and applied else pytest.raises(PluginLoadError, match="no runnable component")
with expected as refused:
outcome = evaluate_prepared_plugin(
package,
EvaluationOptions(skill_path=root, agents=agent, env_mode=env_mode),
work_dir=tmp_path,
load=load,
evals_source=root / "evals/evals.json",
evaluate=lambda _: calls.append(True) or {"execution_status": "succeeded"},
)
assert outcome.status == "succeeded"
for selected in agent.split(","):
decision = outcome.provenance["load_decisions"][selected]
assert decision["mode"] == ("native" if selected == "claude-code" else "wrapper")
if selected == "codex":
assert "no runnable component" in decision["reason"]
assert all(kind in decision["reason"] for kind in package.native_source.present_types())
if not (native and applied):
assert not calls and not (root / "evals" / "results").exists()
message = str(refused.value)
rejected_agent = (
"claude-code" if not applied and load == "native" and agent.startswith("claude-code") else "codex"
)
assert load in message and (rejected_agent if "codex" in agent else agent) in message
assert all(kind in message for kind in package.native_source.present_types())


SAME_SKILL = "github::owner/repo::skills::csv-loader"
SAME_RULE = "github::owner/repo::rules::style.md"
OTHER_SKILL = "github::other/lib::skills::csv-loader"
Expand Down
Loading