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.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
fix(tier1): keep image-only SkillSpector reports incomplete when reference evidence is unmatched (#476)
Christopher Kevina5df6cb874af
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f7c4684b..e3567da1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -106,6 +106,13 @@ All notable changes to SkillEvaluator are documented in this file.`/bin/bash -lc 'cat skills/x/SKILL.md'`, which some agent harnesses recordinstead of the bare command. Searches inside a wrapper (`bash -c 'grep SKILLconfig.json'`) are still not counted.+- A Tier 1 security scan keeps a SkillSpector `partial` report `INCOMPLETE` when+ its only ledger row is a referenced image but its `references` list records a+ `missing` reference on a line without a ledger row, an `ambiguous` reference,+ or a list flagged as truncated with a key that ends in `_truncated`, such as+ `ledger_exceptions_truncated`. Such a report no longer passes with the image+ warning alone, because nothing reads the line of that reference for a file+ left out of the scanned copy.- `validate` Tier 1 output: when only the `--llm` / `--llm-verify` stagecan't run, `what to fix` gives the exact `export` lines for the missingdiff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdxindex b8cebc59..c250ab6c 100644--- a/docs/tier1-validation.mdx+++ b/docs/tier1-validation.mdx@@ -260,7 +260,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice- Tier 3 output in its default location, `<skill>/evals/results`, is left out of the scanned copy too, so it counts as not inspected. The rest of `evals/`, such as `evals/evals.json` and input fixtures in `evals/files`, is scanned. After a Tier 3 run, a line that names `results`, a file the run leaves there, such as `report.html` or `summary.json`, or, when the run used `--harbor-keep-jobs`, any bundled file (the kept Harbor tasks hold a copy of the skill) keeps the scan `INCOMPLETE`, although the same line passed before the run. Writing Tier 3 results outside the skill, with `--results-dir` or `SKILLEVALUATOR_RESULTS_DIR`, keeps a run from changing the result.- The scan covers the whole target. When the target is a folder or a plugin that holds skills, such as `skillevaluator security-scan path/to/skills/`, `skillevaluator validate path/to/skills/` (which checks each skill as its own job) or `validate` on a plugin, each skill in it is scanned on its own, and a line may name a file elsewhere in the target that the skill's scan did not inspect, so those skills' missing references keep their scans `INCOMPLETE`.- Every nonfatal scope exclusion must name an actual uninspected entry under the target. Accepted missing-reference warnings remain visible after the static and LLM stages deduplicate their findings. Any other gap must be a referenced image that SkillEvaluator accepts as described above, and the scan then carries both warnings. Without such images, the report must also show no partially or entirely uninspected file, no limitation and no fatal scope exclusion, and every analyzer must have completed or be not applicable or disabled. In either case the report must count as many findings after filtering as before it. The warning names the file and line of up to three of the references; it does not quote the referenced path. Files not in the scan, including any outside the scanned path, are not inspected.+ Every nonfatal scope exclusion must name an actual uninspected entry under the target. Accepted missing-reference warnings remain visible after the static and LLM stages deduplicate their findings. Any other gap must be a referenced image that SkillEvaluator accepts as described above, and the scan then carries both warnings. Without such images, the report must also show no partially or entirely uninspected file, no limitation and no fatal scope exclusion, and every analyzer must have completed or be not applicable or disabled. In either case the report must count as many findings after filtering as before it, and a `missing` reference without an accepted ledger row, an `ambiguous` reference or a truncation marker leaves the scan `INCOMPLETE` even when a referenced image is its only listed gap. The warning names the file and line of up to three of the references; it does not quote the referenced path. Files not in the scan, including any outside the scanned path, are not inspected.SkillSpector v2.12.0 to v2.13.3 report these references as `reference_missing`, and v2.10 and v2.11 as `reference_unresolved`, which SkillEvaluator accepts under the same conditions. A v2.13.3 report whose only gaps are such references is also accepted from the report alone as a missing-reference caveat: an INFO finding that keeps SkillSpector's `partial` status and is recorded as `skillspector_reference_caveats` in the JSON report. It replaces the warning above, and whenever the scan has a known target, as through `validate`, `tier1` or `security-scan`, it is accepted only when the conditions above hold too. A reference that matches several bundled files (`reference_unresolved` from v2.12.0, `ambiguous` in the `references` list before it) still leaves the scan `INCOMPLETE`.diff --git a/src/skillevaluator/validators/security.py b/src/skillevaluator/validators/security.pyindex 63ad3b8b..b8e505ba 100644--- a/src/skillevaluator/validators/security.py+++ b/src/skillevaluator/validators/security.py@@ -529,6 +529,18 @@ def _skillspector_provider_retry_row(row: object) -> bool:)+def _skillspector_flags_truncation(container: Mapping[str, object]) -> bool:+ """Return whether a report object has a ``*_truncated`` key that is neither ``false`` nor ``null``.++ SkillSpector flags a list it cut short this way, as in+ ``ledger_exceptions_truncated``, and what it left out may be a different gap.+ """+ return any(+ isinstance(key, str) and key.endswith("_truncated") and value is not False and value is not None+ for key, value in container.items()+ )++def _skillspector_provider_retries_exhausted(data: object) -> bool:"""Return whether a failed LLM-stage report shows only an LLM provider outage.@@ -560,10 +572,7 @@ def _skillspector_provider_retries_exhausted(data: object) -> bool:if any(container.get(key) for key in _SKILLSPECTOR_REPORT_FAILURE_MARKERS):return False# A truncated list may hide a different cause.- if any(- isinstance(key, str) and key.endswith("_truncated") and value is not False and value is not None- for key, value in container.items()- ):+ if _skillspector_flags_truncation(container):return Falserows = completeness.get("ledger_exceptions")@@ -2325,6 +2334,39 @@ def _skillspector_missing_reference_warning(rows: list[Mapping[str, object]]) ->)+def _skillspector_missing_references_have_rows(references: list, rows: list[Mapping[str, object]]) -> bool:+ """Whether *references* holds only objects, none ``ambiguous``, each ``missing`` one on the line of a row in *rows*.++ Only the line of a row is read for the names it holds+ (:func:`_skillspector_reference_line_avoids`), so a ``missing`` entry on+ any other line, which SkillSpector reported without a row, would never be.+ """+ locations = {(row.get("path"), row.get("start_line")) for row in rows}+ for reference in references:+ if not isinstance(reference, dict) or reference.get("status") == "ambiguous":+ return False+ if reference.get("status") == "missing":+ path, line = reference.get("source_path"), reference.get("line")+ if not isinstance(path, str) or type(line) is not int or (path, line) not in locations:+ return False+ return True+++def _skillspector_reference_evidence_unmatched(completeness: Mapping[str, object]) -> bool:+ """Whether a report whose ledger has no missing-reference row lists a gap that nothing reads.++ SkillSpector gives every ``missing`` or ``ambiguous`` reference a ledger+ row, so with none, such an entry in the ``references`` of *completeness*+ names a line that no check reads, and a ``*_truncated`` flag means a row+ may have been cut off. The report is then not accepted on the strength of+ its other gaps, such as a referenced image.+ """+ references = completeness.get("references")+ return _skillspector_flags_truncation(completeness) or (+ isinstance(references, list) and not _skillspector_missing_references_have_rows(references, [])+ )++def _skillspector_missing_reference_notes(ledger_exceptions: list[dict],analyzer_statuses: list[dict],@@ -2398,14 +2440,8 @@ def _skillspector_missing_reference_notes():return None- locations = {(row["path"], row.get("start_line")) for row in reference_rows}- for reference in references:- if not isinstance(reference, dict) or reference.get("status") == "ambiguous":- return None- if reference.get("status") == "missing":- path, line = reference.get("source_path"), reference.get("line")- if not isinstance(path, str) or type(line) is not int or (path, line) not in locations:- return None+ if not _skillspector_missing_references_have_rows(references, reference_rows):+ return Nonenotes = [_skillspector_missing_reference_warning(reference_rows)]if other_rows:@@ -4112,14 +4148,18 @@ class SecurityValidator(ValidatorBase):# incomplete.accepted_reference_caveats = Noneif gap_notes is None:- raster_note = _skillspector_passive_raster_note(- gap_rows,- gap_statuses,- gap_counts,- gap_limitations,- analysis_completeness.get("scope_exclusions", []),- data.get("components"),- scanned_root,+ raster_note = (+ None+ if _skillspector_reference_evidence_unmatched(analysis_completeness)+ else _skillspector_passive_raster_note(+ gap_rows,+ gap_statuses,+ gap_counts,+ gap_limitations,+ analysis_completeness.get("scope_exclusions", []),+ data.get("components"),+ scanned_root,+ ))gap_notes = None if raster_note is None else [raster_note]other_gaps: list[str] = []diff --git a/tests/validators/test_security.py b/tests/validators/test_security.pyindex 226f6569..0fb18493 100644--- a/tests/validators/test_security.py+++ b/tests/validators/test_security.py@@ -36,6 +36,7 @@ from skillevaluator.validators.security import (_skillspector_name_keys,_skillspector_reference_caveat_error,_skillspector_reference_caveat_notes,+ _skillspector_reference_evidence_unmatched,_skillspector_reference_line_avoids,_skillspector_reference_row_is_advisory,_skillspector_report_path_is_bundled_file,@@ -9691,6 +9692,145 @@ class TestSkillspectorMissingReferences:payload["analysis_completeness"]["analyzer_statuses"].remove(universal)assert _missing_reference_notes(payload, skill) is None+ @staticmethod+ def _install_script_case(tmp_path: Path, version: str) -> tuple[Path, dict, str]:+ """The notes writer with a second line that runs ``versions/install.sh``, which the scanned copy leaves out.++ The report is the capture for the first line only, with the line count of ``SKILL.md`` raised to match.+ """+ line = "Also run `versions/install.sh` and write the log to `output/log.txt`."+ skill = _write_skill(+ tmp_path / "notes-writer",+ {+ **_NOTES_WRITER_FILES,+ "SKILL.md": f"{_NOTES_WRITER_FILES['SKILL.md']}\n{line}\n",+ "versions/install.sh": "#!/bin/sh\necho ready\n",+ },+ )+ payload = _reference_report(version)+ next(component for component in payload["components"] if component["path"] == "SKILL.md")["lines"] += 2+ return skill, payload, line++ @staticmethod+ def _assert_refused(result: ValidationResult, version: str) -> None:+ row = "SKILL.md:10 [reference_resolution; reference_missing]"+ assert result.is_incomplete+ assert result.incomplete_scans == ["skillspector"]+ assert result.errors == [+ _caveat_error(row)+ if version == "2.13.4"+ else f"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): "+ f"{row}; security scan did not complete{_REFERENCE_REJECTION_HELP}"+ ]+ assert not result.warnings+ assert "skillspector_reference_caveats" not in result.metadata++ @pytest.mark.parametrize("version", ["2.12.0", "2.13.3", "2.13.4"])+ @patch("skillevaluator.validators.security.Tools")+ def test_line_naming_a_file_left_out_of_the_scan_stays_incomplete_with_a_row(+ self, mock_tools, tmp_path: Path, version: str+ ) -> None:+ """The second line of ``_install_script_case`` is refused once SkillSpector gives it a row."""+ skill, payload, line = self._install_script_case(tmp_path, version)+ completeness = payload["analysis_completeness"]+ completeness["ledger_exceptions"].append(+ {**completeness["ledger_exceptions"][0], "start_line": 12, "end_line": 12}+ )+ completeness["references"].append(+ {+ "source_path": "SKILL.md",+ "line": 12,+ "column": 11,+ "evidence": line,+ "target_path": None,+ "status": "missing",+ "disposition": "partial",+ "reference_kind": "quoted_or_code",+ }+ )++ result = _validate_skillspector_payload(mock_tools, skill, payload)++ assert mock_tools.skillspector.run.call_args.args[0][1] != str(skill.resolve())+ assert result.incomplete_scans == ["skillspector"]+ assert not result.warnings++ @pytest.mark.parametrize("status", ["missing", "ambiguous"])+ @pytest.mark.parametrize("version", ["2.12.0", "2.13.3", "2.13.4"])+ @patch("skillevaluator.validators.security.Tools")+ def test_reference_without_a_ledger_row_stays_incomplete(+ self, mock_tools, tmp_path: Path, version: str, status: str+ ) -> None:+ """Nothing reads the line of a reference that has no row, so it could name a file the scan left out."""+ skill, payload, line = self._install_script_case(tmp_path, version)+ payload["analysis_completeness"]["references"].append(+ {+ "source_path": "SKILL.md",+ "line": 12,+ "column": 11,+ "evidence": line,+ "target_path": None,+ "status": status,+ "disposition": "partial",+ "reference_kind": "quoted_or_code",+ }+ )++ result = _validate_skillspector_payload(mock_tools, skill, payload)++ self._assert_refused(result, version)++ @pytest.mark.parametrize("flag", ["ledger_exceptions_truncated", "references_truncated"])+ @pytest.mark.parametrize("version", ["2.12.0", "2.13.3", "2.13.4"])+ @patch("skillevaluator.validators.security.Tools")+ def test_truncated_report_stays_incomplete(self, mock_tools, tmp_path: Path, version: str, flag: str) -> None:+ """A list SkillSpector cut short may leave out the line that names a file the scan left out."""+ skill, payload, _line = self._install_script_case(tmp_path, version)+ payload["analysis_completeness"][flag] = True++ result = _validate_skillspector_payload(mock_tools, skill, payload)++ self._assert_refused(result, version)++ def test_every_missing_reference_needs_a_row_on_its_line(self, tmp_path: Path) -> None:+ skill = _write_skill(tmp_path / "notes-writer", _NOTES_WRITER_FILES)+ missing = {"source_path": "SKILL.md", "line": 8, "status": "missing"}+ evidence = "Write the summary to `output/notes.md` and keep it short."++ def refused(*extra: object) -> bool:+ payload = _reference_report("2.13.3")+ payload["analysis_completeness"]["references"].extend(extra)+ return _missing_reference_notes(payload, skill) is None++ assert not refused()+ # Another reference on the line of the row needs no row of its own; a resolved or rejected one never does.+ assert not refused({**missing, "line": 10, "evidence": evidence})+ assert not refused({**missing, "status": "resolved"}, {**missing, "line": 3, "status": "rejected"})+ # A missing reference on another line or in another file has no row, and nothing else reads its line.+ assert refused(missing)+ assert refused({**missing, "source_path": "scripts/summarize.py", "line": 10})+ assert refused({**missing, "source_path": None})+ for line in (None, True, "10", 10.0, [10], {"line": 10}):+ assert refused({**missing, "line": line}), line+ assert refused({**missing, "source_path": ["SKILL.md"], "line": 10})+ # No reference elsewhere may be ambiguous either.+ assert refused({**missing, "status": "ambiguous"})+ assert refused({**missing, "line": 10, "status": "ambiguous"})++ def test_reference_evidence_without_a_row_is_unmatched(self) -> None:+ resolved = {"source_path": "SKILL.md", "line": 8, "status": "resolved"}+ missing = {"source_path": "SKILL.md", "line": 10, "status": "missing"}++ assert not _skillspector_reference_evidence_unmatched({})+ assert not _skillspector_reference_evidence_unmatched({"references": None})+ assert not _skillspector_reference_evidence_unmatched({"references": [resolved, {"status": "rejected"}]})+ assert _skillspector_reference_evidence_unmatched({"references": [resolved, "x"]})+ assert not _skillspector_reference_evidence_unmatched({"references": [resolved], "references_truncated": False})+ assert _skillspector_reference_evidence_unmatched({"references": [resolved, missing]})+ assert _skillspector_reference_evidence_unmatched({"references": [{**missing, "status": "ambiguous"}]})+ assert _skillspector_reference_evidence_unmatched({"references": [], "ledger_exceptions_truncated": True})+ assert _skillspector_reference_evidence_unmatched({"ledger_exceptions_truncated": 1})+def test_pre_2_12_unresolved_row_needs_a_missing_reference_on_its_line(self) -> None:row = _reference_report("2.11.2")["analysis_completeness"]["ledger_exceptions"][0]missing = {"source_path": "SKILL.md", "line": 10, "status": "missing"}@@ -10663,7 +10803,17 @@ class TestSkillspectorMissingReferences:]@pytest.mark.parametrize(- "case", ["both", "image-only", "not-an-image", "ambiguous-reference", "line-names-a-left-out-file"]+ "case",+ [+ "both",+ "image-only",+ "image-only-with-an-unmatched-missing-reference",+ "image-only-with-an-ambiguous-reference",+ "image-only-with-a-truncated-list",+ "not-an-image",+ "ambiguous-reference",+ "line-names-a-left-out-file",+ ],)@patch("skillevaluator.validators.security.Tools")def test_missing_reference_with_a_referenced_image(self, mock_tools, tmp_path: Path, case: str) -> None:@@ -10679,8 +10829,16 @@ class TestSkillspectorMissingReferences:(skill / "assets" / "logo.png").write_bytes(b"not an image" if case == "not-an-image" else _png_bytes())payload = _reference_report("2.13.3", "image-and-missing")completeness = payload["analysis_completeness"]- if case == "image-only":+ if case.startswith("image-only"):completeness["ledger_exceptions"] = completeness["ledger_exceptions"][1:]+ if case == "image-only":+ # SkillSpector records every missing reference with a row, so no row means no such reference.+ completeness["references"] = [r for r in completeness["references"] if r["status"] != "missing"]+ elif case.endswith("ambiguous-reference"):+ completeness["references"][1]["status"] = "ambiguous"+ elif case.endswith("truncated-list"):+ completeness["references"] = [r for r in completeness["references"] if r["status"] != "missing"]+ completeness["ledger_exceptions_truncated"] = Trueelif case == "ambiguous-reference":completeness["ledger_exceptions"][0]["reason_code"] = "reference_unresolved"