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.

fix(quality): keep minimum score failures after policy changes (#211)

YMuskrat0c1c7b3f6126
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8820f38d..313c12ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to SkillEvaluator are documented in this file.
## Unreleased
+### Fixed
+
+- Changing finding severities through a policy no longer clears an independent
+ quality-score threshold failure. A score below `--min-score` still fails,
+ and its reason appears in the terminal, HTML, benchmark, and JSON reports.
+
## 0.6.0 - 2026-10-20
### Added
diff --git a/src/skillevaluator/models/result.py b/src/skillevaluator/models/result.py
index 1cfb8db4..ede11b9f 100644
--- a/src/skillevaluator/models/result.py
+++ b/src/skillevaluator/models/result.py
@@ -285,6 +285,14 @@ class ValidationResult:
return []
return [name for name in value if isinstance(name, str) and name]
+ @property
+ def gate_failures(self) -> list[str]:
+ """Failed requirements independent of finding severity, such as a minimum score."""
+ value = self.metadata.get("gate_failures")
+ if not isinstance(value, list):
+ return []
+ return [message for message in value if isinstance(message, str) and message]
+
@property
def is_incomplete(self) -> bool:
"""Whether required validation evidence is missing or unusable."""
@@ -415,12 +423,16 @@ class ValidationResult:
Call after mutating finding severities (e.g. LLM verification downgrade)
so that result state is consistent with the actual finding objects.
+ Independent gate failures remain errors regardless of those severities.
"""
self.errors.clear()
self.warnings.clear()
self.passed = not self.is_incomplete
self.summary.reset_finding_counts()
+ for message in self.gate_failures:
+ self.add_error(message)
+
for finding in self.findings:
sev = (
finding.severity if isinstance(finding.severity, Severity) else Severity(str(finding.severity).lower())
@@ -454,6 +466,14 @@ class ValidationResult:
self.warnings.append(message)
self.summary.warnings += 1
+ def fail_gate(self, message: str) -> None:
+ """Record a failed requirement that severity overrides cannot waive."""
+ failures = self.gate_failures
+ if message not in failures:
+ failures.append(message)
+ self.metadata["gate_failures"] = failures
+ self.add_error(message)
+
def add_message(self, message: str) -> None:
"""Add an informational message.
@@ -487,9 +507,12 @@ class ValidationResult:
# dict.update would let one sub-result's incomplete_scans clobber
# another's (e.g. bandit and semgrep both failing); concatenate.
incomplete = list(dict.fromkeys([*self.incomplete_scans, *other.incomplete_scans]))
+ gate_failures = [*self.gate_failures, *other.gate_failures]
self.metadata.update(other.metadata)
if incomplete:
self.metadata["incomplete_scans"] = incomplete
+ if gate_failures:
+ self.metadata["gate_failures"] = gate_failures
# Merge summary
self.summary.files_scanned += other.summary.files_scanned
@@ -538,6 +561,9 @@ class ValidationResult:
incomplete = list(dict.fromkeys([*self.incomplete_scans, *other.incomplete_scans]))
if incomplete:
self.metadata["incomplete_scans"] = incomplete
+ gate_failures = [*self.gate_failures, *(f"[{prefix}] {message}" for message in other.gate_failures)]
+ if gate_failures:
+ self.metadata["gate_failures"] = gate_failures
# Merge summary
self.summary.errors += other.summary.errors
@@ -545,7 +571,7 @@ class ValidationResult:
def to_dict(self) -> dict:
"""Convert to dictionary for JSON serialization."""
- return {
+ result = {
"validator": self.validator_name,
"description": self.validator_description,
"passed": self.passed,
@@ -555,3 +581,6 @@ class ValidationResult:
"findings": [f.to_dict() for f in self.findings],
"success_details": [s.to_dict() for s in self.success_details],
}
+ if self.gate_failures:
+ result["gate_failures"] = self.gate_failures
+ return result
diff --git a/src/skillevaluator/reporting/benchmark.py b/src/skillevaluator/reporting/benchmark.py
index b0992716..14853e5c 100644
--- a/src/skillevaluator/reporting/benchmark.py
+++ b/src/skillevaluator/reporting/benchmark.py
@@ -530,10 +530,23 @@ class BenchmarkReporter(ReporterBase):
for finding, result in findings_with_result
if not result.passed or finding.severity.value in {"critical", "high"}
]
+ gate_failures = [
+ (result.validator_name, message)
+ for result in results
+ if not result.passed
+ for message in result.gate_failures
+ ]
- if blocking:
+ if gate_failures or blocking:
lines.extend(["## Blocking Findings", ""])
- for finding in _top_findings(blocking, limit=self.max_findings_shown):
+ shown_gates = gate_failures[: max(0, self.max_findings_shown)]
+ for validator, message in shown_gates:
+ lines.append(
+ f"- **GATE** {_publication_safe_inline(validator, private_labels)}: "
+ f"{_publication_safe_inline(message, private_labels)}"
+ )
+ remaining_slots = max(0, self.max_findings_shown - len(shown_gates))
+ for finding in _top_findings(blocking, limit=remaining_slots):
lines.append(_finding_line(finding, private_labels))
lines.append("")
diff --git a/src/skillevaluator/reporting/console_ui.py b/src/skillevaluator/reporting/console_ui.py
index 230d11bd..91b47781 100644
--- a/src/skillevaluator/reporting/console_ui.py
+++ b/src/skillevaluator/reporting/console_ui.py
@@ -881,6 +881,8 @@ def summarize_tier3(result: ValidationResult) -> tuple[bool, bool, list[TierRow]
def _first_error(result: ValidationResult) -> str:
+ if result.gate_failures:
+ return result.gate_failures[0]
for finding in result.findings:
severity = getattr(finding.severity, "value", str(finding.severity)).lower()
if severity in ("critical", "high"):
@@ -895,8 +897,8 @@ def _first_error(result: ValidationResult) -> str:
def first_fix(results: list[ValidationResult]) -> list[tuple[str, str]] | None:
"""The single most actionable fix: the gating finding's suggestion.
- Prefers critical/high findings (the ones that actually failed the gate)
- over advisory-severity ones, and trims to one terse directive line.
+ Prefers independent gate failures, then critical/high findings over
+ advisory-severity ones, and trims to one terse directive line.
"""
severity_rank = {"critical": 0, "high": 1, "medium": 2, "low": 3}
@@ -907,8 +909,10 @@ def first_fix(results: list[ValidationResult]) -> list[tuple[str, str]] | None:
for result in results:
if result.passed or _is_skipped(result):
continue
- for finding in sorted(result.findings, key=rank):
- text = finding.suggestion or finding.message
+ for text in [
+ *result.gate_failures,
+ *(finding.suggestion or finding.message for finding in sorted(result.findings, key=rank)),
+ ]:
if text:
text = text.split(". ")[0].strip().rstrip(".")
if len(text) > 150:
diff --git a/src/skillevaluator/reporting/json_reporter.py b/src/skillevaluator/reporting/json_reporter.py
index 31bb2bf0..2e9fac9d 100644
--- a/src/skillevaluator/reporting/json_reporter.py
+++ b/src/skillevaluator/reporting/json_reporter.py
@@ -296,6 +296,9 @@ class JSONReporter(ReporterBase):
},
}
+ if result.gate_failures:
+ data["gate_failures"] = result.gate_failures
+
# Quality scores (from QualityScoreValidator)
coverage = result.metadata.get("dependency_coverage")
if isinstance(coverage, list):
diff --git a/src/skillevaluator/reporting/templates/report.html.j2 b/src/skillevaluator/reporting/templates/report.html.j2
index fb47ce7f..5428cc4e 100644
--- a/src/skillevaluator/reporting/templates/report.html.j2
+++ b/src/skillevaluator/reporting/templates/report.html.j2
@@ -1907,6 +1907,9 @@
{% endif %}
{% else %}
<div class="findings-list">
+ {% for error in result | additional_errors %}
+ <div class="finding high"><div class="finding-header"><span class="finding-message">{{ error }}</span></div></div>
+ {% endfor %}
{% if result.findings %}{% for finding in result.findings %}
<div class="finding {{ finding.severity.value }}">
<div class="finding-header">
@@ -1920,7 +1923,7 @@
{% if finding.line_content %}<div class="code-snippet">{{ finding.line_content | truncate(200) }}</div>{% endif %}
{% if finding.suggestion %}<div class="suggestion"><strong>Suggestion:</strong> {{ finding.suggestion }}</div>{% endif %}
</div>
- {% endfor %}{% elif result.errors %}{% for error in result.errors %}<div class="finding high"><div class="finding-header"><span class="finding-message">{{ error }}</span></div></div>{% endfor %}{% endif %}
+ {% endfor %}{% endif %}
</div>
{% endif %}
</div>
diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py
index d62e37d6..30a89724 100644
--- a/src/skillevaluator/validators/quality_score.py
+++ b/src/skillevaluator/validators/quality_score.py
@@ -315,7 +315,9 @@ class QualityScoreValidator(ValidatorBase):
# Determine pass/fail based on min_score
if qs.overall_score < self.min_score:
- result.passed = False
+ result.fail_gate(
+ f"Quality score {qs.overall_score:.1f}/100 is below the required {self.min_score}/100 in {manifest}"
+ )
result.metadata["quality_scores"] = qs.to_dict()
diff --git a/tests/reporting/test_quality_gate_reports.py b/tests/reporting/test_quality_gate_reports.py
new file mode 100644
index 00000000..8b2e8cfd
--- /dev/null
+++ b/tests/reporting/test_quality_gate_reports.py
@@ -0,0 +1,138 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Independent quality failures remain visible alongside structured findings."""
+
+import html
+import re
+
+import pytest
+
+from skillevaluator.models import Finding, Severity, ValidationResult
+from skillevaluator.reporting import BenchmarkReporter, HTMLReporter
+
+_GATE_MESSAGE = "Quality score 67.8/100 is below the required 70/100 in SKILL.md"
+
+
+def _quality_result() -> ValidationResult:
+ result = ValidationResult(validator_name="QUALITY")
+ result.fail_gate(_GATE_MESSAGE)
+ return result
+
+
+def _add_finding(result: ValidationResult, severity: Severity, message: str) -> None:
+ result.add_finding(
+ Finding(
+ category="QUALITY",
+ severity=severity,
+ check_name="quality_efficiency",
+ message=message,
+ file_path="SKILL.md",
+ )
+ )
+
+
+def _blocking_section(output: str) -> str:
+ return output.split("## Blocking Findings\n\n", 1)[1].split("\n## ", 1)[0]
+
+
[email protected]("with_findings", [False, True])
+def test_html_shows_gate_without_repeating_finding_errors(with_findings: bool) -> None:
+ result = _quality_result()
+ if with_findings:
+ _add_finding(result, Severity.MEDIUM, "Advisory quality observation")
+ _add_finding(result, Severity.HIGH, "Blocking quality finding")
+
+ output = HTMLReporter().render(result)
+ messages = [
+ html.unescape(message)
+ for message in re.findall(r'<span class="finding-message">(.*?)</span>', output, re.DOTALL)
+ ]
+
+ expected = [_GATE_MESSAGE]
+ if with_findings:
+ expected.extend(["Advisory quality observation", "Blocking quality finding"])
+ assert messages == expected
+
+
+def test_html_escapes_gate_error_text() -> None:
+ result = ValidationResult(validator_name="QUALITY")
+ result.fail_gate("Quality score is below <minimum> & requires review")
+
+ output = HTMLReporter().render(result)
+
+ assert '<span class="finding-message">Quality score is below &lt;minimum&gt; &amp; requires review</span>' in output
+
+
[email protected]("with_findings", [False, True])
+def test_benchmark_lists_gate_before_findings(with_findings: bool) -> None:
+ result = _quality_result()
+ if with_findings:
+ _add_finding(result, Severity.MEDIUM, "Advisory quality observation")
+
+ output = BenchmarkReporter(include_timestamp=False).render(result)
+ blocking = _blocking_section(output)
+
+ assert blocking.startswith(f"- **GATE** QUALITY: {_GATE_MESSAGE}\n")
+ assert blocking.count(_GATE_MESSAGE) == 1
+ if with_findings:
+ assert blocking.index(_GATE_MESSAGE) < blocking.index("Advisory quality observation")
+
+
+def test_benchmark_prioritizes_gates_within_blocking_findings_limit() -> None:
+ result = _quality_result()
+ result.fail_gate("Second required quality check failed")
+ result.fail_gate("Third required quality check failed")
+ _add_finding(result, Severity.CRITICAL, "Critical quality finding")
+
+ output = BenchmarkReporter(include_timestamp=False, max_findings_shown=2).render(result)
+ blocking = _blocking_section(output)
+
+ assert len([line for line in blocking.splitlines() if line.startswith("- ")]) == 2
+ assert _GATE_MESSAGE in blocking
+ assert "Second required quality check failed" in blocking
+ assert "Third required quality check failed" not in blocking
+ assert "Critical quality finding" not in blocking
+ assert "Critical quality finding" in output
+
+
+def test_benchmark_shares_limit_between_gates_and_findings() -> None:
+ finding_result = ValidationResult(validator_name="QUALITY")
+ _add_finding(finding_result, Severity.HIGH, "High quality finding")
+ _add_finding(finding_result, Severity.CRITICAL, "Critical quality finding")
+
+ output = BenchmarkReporter(include_timestamp=False, max_findings_shown=2).render_all(
+ [finding_result, _quality_result()]
+ )
+ blocking = _blocking_section(output)
+
+ assert len([line for line in blocking.splitlines() if line.startswith("- ")]) == 2
+ assert blocking.index(_GATE_MESSAGE) < blocking.index("Critical quality finding")
+ assert "High quality finding" not in blocking
+
+
+ "private_path",
+ ["/Users/private/catalog/SKILL.md", "/home/private/catalog/SKILL.md", r"C:\Users\private\catalog\SKILL.md"],
+)
+def test_benchmark_sanitizes_gate_messages_for_publication(private_path: str) -> None:
+ private_environment = "private-evaluation-runner"
+ result = ValidationResult(validator_name="QUALITY <threshold>")
+ result.fail_gate(
+ f"Quality score is below the required minimum in {private_path}; "
+ f"review <details> [policy](https://example.invalid) on {private_environment}"
+ )
+ tier3 = ValidationResult(validator_name="AGENT_EVAL")
+ tier3.metadata["agent_eval"] = {"summary": {"environment": private_environment}}
+
+ output = BenchmarkReporter(include_timestamp=False).render_all([result, tier3])
+ blocking = _blocking_section(output)
+
+ assert "Quality score is below the required minimum" in blocking
+ assert "SKILL.md" in blocking
+ assert private_path not in output
+ assert private_environment not in output
+ assert "Isolated sandbox" in blocking
+ assert "QUALITY &lt;threshold&gt;" in blocking
+ assert "&lt;details&gt;" in blocking
+ assert r"\[policy\](https&#58;//example.invalid)" in blocking
diff --git a/tests/test_quality_policy_gate.py b/tests/test_quality_policy_gate.py
new file mode 100644
index 00000000..077f8243
--- /dev/null
+++ b/tests/test_quality_policy_gate.py
@@ -0,0 +1,205 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Quality thresholds remain binding when policies reclassify findings."""
+
+import json
+from pathlib import Path
+
+import pytest
+from click.testing import CliRunner
+
+from skillevaluator.cli import cli
+from skillevaluator.models.result import Finding, Severity, ValidationResult
+from skillevaluator.reporting.console_ui import first_fix, summarize_tier1
+from skillevaluator.reporting.json_reporter import JSONReporter
+from skillevaluator.utils.rich_markup import strip_terminal_controls
+from skillevaluator.validators.policy import ValidationPolicy, apply_policy
+from skillevaluator.validators.quality_score import QualityScoreValidator
+
+
+def below_threshold_skill(tmp_path: Path) -> Path:
+ skill = tmp_path / "minimal-skill"
+ skill.mkdir()
+ (skill / "SKILL.md").write_text(
+ "---\n"
+ "name: minimal-skill\n"
+ "description: I can handle various things and stuff for your data documents and projects. "
+ "This general tool processes files and helps your workflow.\n"
+ "---\n"
+ "Short content.\n\n"
+ "## Instructions\n\n"
+ "The paradigm is synergy and awareness.\n",
+ encoding="utf-8",
+ )
+ return skill
+
+
+def test_raising_efficiency_severity_keeps_cli_minimum_score_failure(
+ below_threshold_skill: Path, tmp_path: Path
+) -> None:
+ result = QualityScoreValidator(min_score=70).validate(below_threshold_skill)
+ assert result.metadata["quality_scores"]["overall_score"] == 67.8
+ assert not result.passed
+ policy = tmp_path / "stricter-policy.yaml"
+ policy.write_text("severity_overrides:\n QUALITY.quality_efficiency: medium\n", encoding="utf-8")
+ args = [
+ "validate",
+ str(below_threshold_skill),
+ "--tiers",
+ "1",
+ "--checks",
+ "quality",
+ "--no-llm",
+ "-r",
+ "cli",
+ "-o",
+ str(tmp_path / "reports"),
+ ]
+
+ runner = CliRunner()
+ default = runner.invoke(cli, args)
+ stricter = runner.invoke(cli, [*args, "--policy", str(policy)])
+
+ assert default.exit_code == 1, default.output
+ assert stricter.exit_code == 1, stricter.output
+ output = strip_terminal_controls(stricter.output)
+ assert "[PASS] All validations passed" not in output
+ assert "67.8/100 is below the required 70/100" in output
+
+
+def test_pipeline_explains_minimum_score_failure(below_threshold_skill: Path) -> None:
+ result = QualityScoreValidator(min_score=70).validate(below_threshold_skill)
+ passed, rows = summarize_tier1([result])
+
+ assert not passed
+ failure_row = next(row for row in rows if row.label == "failed")
+ assert result.gate_failures[0] in "".join(text for text, _style in failure_row.segments)
+ fix = first_fix([result])
+ assert fix is not None
+ assert "67.8/100 is below the required 70/100" in fix[0][0]
+
+
+def test_json_report_includes_minimum_score_failure(below_threshold_skill: Path) -> None:
+ result = QualityScoreValidator(min_score=70).validate(below_threshold_skill)
+ data = json.loads(JSONReporter().render_all([result]))
+
+ assert data["results"][0]["gate_failures"] == result.gate_failures
+
+
+def test_json_report_omits_gate_failures_when_minimum_is_met(below_threshold_skill: Path) -> None:
+ result = QualityScoreValidator(min_score=67).validate(below_threshold_skill)
+ data = json.loads(JSONReporter().render_all([result]))
+
+ assert "gate_failures" not in data["results"][0]
+
+
+def test_quality_minimum_survives_recalculation(below_threshold_skill: Path) -> None:
+ result = QualityScoreValidator(min_score=70).validate(below_threshold_skill)
+ errors = list(result.errors)
+
+ result.recalculate_from_findings()
+ result.recalculate_from_findings()
+
+ assert not result.passed
+ assert result.errors == errors
+ assert result.summary.errors == 1
+ assert result.to_dict()["gate_failures"] == result.gate_failures
+
+
+def test_lowering_all_quality_severities_does_not_disable_minimum(below_threshold_skill: Path) -> None:
+ result = QualityScoreValidator(min_score=70).validate(below_threshold_skill)
+
+ apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.*": Severity.INFO}))
+
+ assert not result.passed
+
+
[email protected]("merge_method", ["merge", "merge_with_prefix"])
+def test_quality_minimum_survives_merged_results(below_threshold_skill: Path, merge_method: str) -> None:
+ parent = ValidationResult()
+ for min_score in (70, 80):
+ child = QualityScoreValidator(min_score=min_score).validate(below_threshold_skill)
+ if merge_method == "merge_with_prefix":
+ parent.merge_with_prefix(child, "minimal-skill")
+ else:
+ parent.merge(child)
+
+ apply_policy([parent], ValidationPolicy(severity_overrides={"QUALITY.quality_efficiency": Severity.MEDIUM}))
+
+ assert not parent.passed
+ assert len(parent.gate_failures) == 2
+ assert parent.summary.errors == 2
+ assert "required 70/100" in parent.errors[0]
+ assert "required 80/100" in parent.errors[1]
+
+
+def test_folder_average_does_not_hide_a_skill_below_minimum(below_threshold_skill: Path) -> None:
+ good_skill = below_threshold_skill.parent / "good-skill"
+ good_skill.mkdir()
+ (good_skill / "SKILL.md").write_text(
+ "---\n"
+ "name: good-skill\n"
+ "description: Converts CSV documents to JSON. Use when converting tabular files.\n"
+ "version: 1.0.0\n"
+ "metadata:\n"
+ " author: Test User <[email protected]>\n"
+ " tags: [csv, json]\n"
+ "---\n"
+ "## Purpose\n\nConvert tabular data.\n\n"
+ "## Instructions\n\n1. Read the input file.\n2. Write the JSON output.\n\n"
+ "## Examples\n\n```text\ninput.csv -> output.json\n```\n\n"
+ "## Prerequisites\n\nNone.\n\n"
+ "## Limitations\n\nOnly CSV files are supported.\n\n"
+ "## Troubleshooting\n\nReport invalid input errors.\n",
+ encoding="utf-8",
+ )
+ result = QualityScoreValidator(min_score=70).validate(below_threshold_skill.parent)
+ assert result.metadata["quality_scores"]["overall_score"] > 70
+
+ apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.quality_efficiency": Severity.MEDIUM}))
+
+ assert not result.passed
+ assert len(result.gate_failures) == 1
+ assert result.gate_failures[0].startswith("[minimal-skill]")
+
+
+def test_minimum_below_score_still_passes_after_policy(below_threshold_skill: Path) -> None:
+ result = QualityScoreValidator(min_score=67).validate(below_threshold_skill)
+
+ apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.quality_efficiency": Severity.MEDIUM}))
+
+ assert result.passed
+ assert "gate_failures" not in result.to_dict()
+
+
+def test_quality_severity_waiver_still_passes_when_score_is_above_minimum(below_threshold_skill: Path) -> None:
+ manifest = below_threshold_skill / "SKILL.md"
+ manifest.write_text(manifest.read_text(encoding="utf-8").replace("name: minimal-skill", "name: Bad_Name"))
+ result = QualityScoreValidator(min_score=0).validate(below_threshold_skill)
+ assert not result.passed
+ assert result.metadata["quality_scores"]["overall_score"] > 0
+
+ apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.*": Severity.INFO}))
+
+ assert result.passed
+ assert result.errors == []
+
+
+def test_policy_can_still_clear_a_severity_based_failure() -> None:
+ result = ValidationResult(validator_name="SCHEMA")
+ result.add_finding(
+ Finding(
+ category="SCHEMA",
+ severity=Severity.HIGH,
+ check_name="author_missing",
+ message="Missing author",
+ file_path="SKILL.md",
+ )
+ )
+
+ apply_policy([result], ValidationPolicy(severity_overrides={"SCHEMA.author_missing": Severity.INFO}))
+
+ assert result.passed
+ assert result.errors == []