Skip to content
Merged
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ All notable changes to SkillEvaluator are documented in this file.
when the catalog has no eligible entries to compare against.
These queries return an empty result without constructing the provider
client, including when that provider is missing or unreachable.
- Validation policy files accept `mcp.allowed_private_hosts`,
`hooks.allowed_urls` and `endpoints.resolve`. These blocks were ignored with an
`Ignoring unknown top-level key(s)` warning; now a malformed block stops
`validate --policy` with an error, and a valid one changes the policy digest
recorded in result metadata and adds entry counts, never the hosts or URLs,
to the policy summary. A hook URL prefix requires an exact host. Use a bare
wildcard host pattern to allow all paths on its matching subdomains.
- `evals/config.yml` accepts `harbor.trial_retries` (0 to 5) and an optional
`plugin` block with `load` and `lift_mode`, which were rejected as unknown
keys. These settings are reserved for prepared runtime packages. Harbor skill
runs warn when they ignore these settings. `--backend nemo-gym` rejects a
config that sets `trial_retries` above 0, `load` or `lift_mode`.
- The all-tier CI bootstrap rejects an unsupported `SKILL_EVAL_ENV_MODE`
without first loading the Tier 3 runtime (Harbor), so the rejection is
faster; its message and exit code are unchanged.
Expand Down
63 changes: 63 additions & 0 deletions src/skillevaluator/evaluation/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
from pathlib import Path
from typing import Any

# Public dataclass annotations must remain resolvable by API schema consumers.
from skillevaluator.validators.policy import ValidationPolicy

# Bounds on ``PluginOptions.probe_mcp_env``: how many grants, and the length of each.
MAX_PROBE_MCP_ENV_GRANTS = 64
MAX_PROBE_MCP_ENV_GRANT_CHARS = 512


@dataclass
class EvaluationOptions:
Expand Down Expand Up @@ -93,3 +100,59 @@ class DatasetOptions:

def engine_kwargs(self) -> dict[str, Any]:
return {f.name: getattr(self, f.name) for f in fields(self) if f.name != "skill_path"}


@dataclass(frozen=True)
class PluginOptions:
"""Run controls for a prepared runtime package, validated on construction.

Every field is unset by default (``None`` or empty). Construction checks
every field except ``repo_root`` and normalizes the two allowlists by the
validation policy rules. The class only holds these values; it applies
none of them. ``policy`` must be a ``ValidationPolicy`` when given.
"""

plugin_load: str | None = None
lift_mode: str | None = None
probe_mcp: bool | None = None
probe_mcp_env: tuple[str, ...] = ()
trial_retries: int | None = None
repo_root: Path | None = None
allowed_private_hosts: tuple[str, ...] = ()
hook_allowed_urls: tuple[str, ...] = ()
policy: ValidationPolicy | None = None

def __post_init__(self) -> None:
from skillevaluator.validators.plugin_policy import normalize_plugin_allowlist

if self.policy is not None and not isinstance(self.policy, ValidationPolicy):
raise ValueError("policy must be a ValidationPolicy")
object.__setattr__(
self,
"allowed_private_hosts",
normalize_plugin_allowlist(self.allowed_private_hosts, "mcp.allowed_private_hosts", 255),
)
object.__setattr__(
self, "hook_allowed_urls", normalize_plugin_allowlist(self.hook_allowed_urls, "hooks.allowed_urls", 2048)
)
for name, choices in (
("plugin_load", {"wrapper", "native", "auto"}),
("lift_mode", {"effectiveness", "integration", "both", "ladder"}),
):
value = getattr(self, name)
if value is not None and (not isinstance(value, str) or value not in choices):
raise ValueError(f"{name} must be one of: {', '.join(sorted(choices))}")
if self.probe_mcp is not None and type(self.probe_mcp) is not bool:
raise ValueError("probe_mcp must be a boolean")
if self.trial_retries is not None and (type(self.trial_retries) is not int or not 0 <= self.trial_retries <= 5):
raise ValueError("trial_retries must be an integer between 0 and 5")
if (
not isinstance(self.probe_mcp_env, tuple)
Comment thread
rng1995 marked this conversation as resolved.
Resolved
or len(self.probe_mcp_env) > MAX_PROBE_MCP_ENV_GRANTS
or any(
not isinstance(value, str) or len(value) > MAX_PROBE_MCP_ENV_GRANT_CHARS for value in self.probe_mcp_env
)
):
raise ValueError(
f"probe_mcp_env must contain at most {MAX_PROBE_MCP_ENV_GRANTS} bounded environment grants"
)
11 changes: 9 additions & 2 deletions src/skillevaluator/evaluation/tier3_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,12 @@ def agent_eval_result_from_directory(
from skillevaluator.tier3.next_steps import next_steps

payload["next_steps"] = next_steps(source, run_dir=run_dir, fixes=load_case_findings(run_dir))
return _validation_result_from_payload(payload)
result = _validation_result_from_payload(payload)
if result is not None:
from skillevaluator.reporting.plugin_reports import attach_saved_plugin_evidence

attach_saved_plugin_evidence(result, run_dir, engine_result)
return result


def _persisted_run_result(run_dir: Path) -> dict[str, Any] | None:
Expand Down Expand Up @@ -746,7 +751,9 @@ def render_agent_eval_html_report(

reporter = HTMLReporter(
target_path=str(skill_path),
content_label="Skill",
content_label="Plugin"
if result.metadata.get("plugin") or result.metadata.get("plugin_runtime_report")
else "Skill",
report_scope="tier3",
tabs=[{"id": "tier3", "label": "Tier 3: Live Agent Evaluation"}],
# The run records the filesystem entry name, which a lexical alias
Expand Down
11 changes: 9 additions & 2 deletions src/skillevaluator/plugin_dependency_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,11 @@ def collect_audit_inputs(


def collect_endpoint_targets(
mcp: Iterable[Any], hooks: Iterable[Any], *, allowed_hosts: tuple[str, ...] = ()
mcp: Iterable[Any],
hooks: Iterable[Any],
*,
allowed_hosts: tuple[str, ...] = (),
hook_allowed_urls: tuple[str, ...] = (),
) -> tuple[EndpointTarget, ...]:
"""Preserve every MCP, OAuth metadata, and HTTP hook source attribution."""
targets = []
Expand All @@ -411,9 +415,12 @@ def collect_endpoint_targets(
value, "mcp", f"{declaration.name}.{field_name}", declaration.file, allowed_hosts=allowed_hosts
)
)
from skillevaluator.plugin_component_risk import hook_allowlist_hosts

hook_hosts = tuple(dict.fromkeys((*allowed_hosts, *hook_allowlist_hosts(hook_allowed_urls))))
for hook in hooks:
if isinstance(hook.url, str) and hook.url:
targets.append(EndpointTarget(hook.url, "hook", hook.id, hook.file, allowed_hosts=allowed_hosts))
targets.append(EndpointTarget(hook.url, "hook", hook.id, hook.file, allowed_hosts=hook_hosts))
return tuple(targets)


Expand Down
27 changes: 19 additions & 8 deletions src/skillevaluator/reporting/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2500,20 +2500,31 @@ def assess_publication(

peer_skill_names: dict[str, str] = {}
for result in results:
if not is_tier3_result(result) and result_publication_evidence(result) is None:
producer = result_publication_evidence(result)
if not is_tier3_result(result) and producer is None:
continue
metadata = result.metadata if isinstance(result.metadata, dict) else {}
candidates: list[object] = [metadata.get("skill_name"), metadata.get("target_skill_name")]
quality = metadata.get("quality_scores")
if isinstance(quality, dict):
candidates.append(quality.get("skill_name"))
quality_all = metadata.get("quality_scores_all")
if isinstance(quality_all, list):
candidates.extend(item.get("skill_name") for item in quality_all if isinstance(item, dict))
result_target = _result_publication_target(result)
member_quality = bool(
producer is not None
and producer.tier == 1
and producer.check_id == "quality"
and isinstance(metadata.get("plugin_member"), str)
and metadata["plugin_member"]
and result_target is not None
)
if not member_quality:
quality = metadata.get("quality_scores")
if isinstance(quality, dict):
candidates.append(quality.get("skill_name"))
quality_all = metadata.get("quality_scores_all")
if isinstance(quality_all, list):
candidates.extend(item.get("skill_name") for item in quality_all if isinstance(item, dict))
agent_eval_payload = metadata.get("agent_eval")
if isinstance(agent_eval_payload, dict):
candidates.append(_agent_eval_consistent_text_field(agent_eval_payload, "skill_name"))
if (result_target := _result_publication_target(result)) is not None:
if result_target is not None:
candidates.append(result_target.skill_name)
for candidate in candidates:
if (key := _publication_identity_key(candidate)) is not None:
Expand Down
18 changes: 16 additions & 2 deletions src/skillevaluator/reporting/plugin_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,21 @@ def mark_incomplete_plugin_package(result: ValidationResult, engine_result: obje
result.mark_scan_incomplete("plugin-components")


def _snapshot_records_incomplete_package(payload: dict) -> bool:
# The runtime projection writes a "preparation" limitation exactly when the
# prepared package was incomplete. The saved result.json has no package
# provenance, so a report rebuilt from the run directory reads it here.
return any(
section["key"] == "diagnostics" and any(row[0] == "preparation" for row in section["rows"])
for section in payload["sections"]
)


def attach_saved_plugin_evidence(result: ValidationResult, run_dir: Path, engine_result: dict | None) -> None:
"""Attach passive evidence without changing the canonical score payload.

The result is also marked incomplete when the prepared plugin package was incomplete.
The result is also marked incomplete when the prepared plugin package was
incomplete, as recorded by the live run or by its saved snapshot.
"""
from skillevaluator.reporting.plugin_runtime_io import RUNTIME_REPORT_FILENAME, load_plugin_runtime_report

Expand All @@ -52,7 +63,10 @@ def attach_saved_plugin_evidence(result: ValidationResult, run_dir: Path, engine
report = runtime_report_from_payload(live)
else:
report = load_plugin_runtime_report(run_dir)
result.metadata["plugin_runtime_report"] = report.payload()
payload = report.payload()
result.metadata["plugin_runtime_report"] = payload
if _snapshot_records_incomplete_package(payload):
result.mark_scan_incomplete("plugin-components")
except (OSError, ValueError):
result.metadata["plugin_runtime_report_error"] = "Saved plugin runtime evidence is unavailable"
result.add_warning("Saved plugin runtime evidence is unavailable")
Expand Down
2 changes: 1 addition & 1 deletion src/skillevaluator/reporting/plugin_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def project_plugin_runtime(
projection.add("run", "Execution status", result.get("execution_status") or "unknown")
if "attempts" in provenance:
projection.add("run", "Setup attempts", _count(provenance["attempts"]))
for reason in islice(provenance.get("retry_reasons") or (), 2):
for reason in islice(provenance.get("retry_reasons") or (), 5):
projection.add("run", "Setup retry reason", reason)
source = _mapping(provenance.get("source") or observed.get("source"))
source = {
Expand Down
5 changes: 3 additions & 2 deletions src/skillevaluator/reporting/plugin_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import TYPE_CHECKING, Any
from urllib.parse import urlsplit, urlunsplit

from skillevaluator.reporting.run_status import Status, result_status
from skillevaluator.utils.redaction import redact_sensitive_text
from skillevaluator.utils.rich_markup import strip_terminal_controls

Expand Down Expand Up @@ -296,8 +297,8 @@ def project_plugin_static(results: list[ValidationResult]) -> StaticPluginReport
block = _mapping(metadata.get("plugin"))
severities: dict[str, Counter] = {}
incomplete |= result.is_incomplete or len(result.findings) > MAX_INPUT_ROWS
blocked |= bool(result.gate_failures) or (
not result.passed and not result.is_incomplete and metadata.get("optional_skip") is not True
blocked |= result_status(result) is Status.FAILED and (
bool(result.gate_failures) or metadata.get("optional_skip") is not True
)
for finding in islice(result.findings, MAX_INPUT_ROWS):
severity = getattr(finding.severity, "value", finding.severity)
Expand Down
Loading
Loading