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(tier3): reject failed skill lookup activation evidence (#590)

Christopher Kevindd87206b1ace
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8ebc5498..bdb197bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -435,6 +435,8 @@ All notable changes to SkillEvaluator are documented in this file.
JSON report lists the files in `semgrep_unparsed_files` (up to 1,000, with
`semgrep_unparsed_files_omitted` counting the rest); other Semgrep errors are
reported as before.
+- Failed native skill lookups no longer count as activation when the tool reports
+ that the skill was not found or unavailable without explicit error metadata.
- Tier 3 terminal, JSON, HTML, and benchmark reports now retain declarative-check
coverage per agent and arm, including passed/failed counts, judgments,
not-checked reasons, and the behavior-score denominators.
diff --git a/src/skillevaluator/tier3/eval_core/codex_tool_call_normalizer.py b/src/skillevaluator/tier3/eval_core/codex_tool_call_normalizer.py
index d92da78d..75fd6474 100644
--- a/src/skillevaluator/tier3/eval_core/codex_tool_call_normalizer.py
+++ b/src/skillevaluator/tier3/eval_core/codex_tool_call_normalizer.py
@@ -99,10 +99,10 @@ def normalized_tool_call_observation(step: dict[str, Any], tool_call: dict[str,
def normalized_tool_call_error_flag(step: dict[str, Any], tool_call: dict[str, Any]) -> bool | None:
- """Return an attributable tool result's explicit ``tool_result_is_error`` flag.
+ """Return an attributable result's error flag, including metadata-free skill lookup failures.
``True`` if any attributable result reports an error, ``False`` if they
- explicitly report success, and ``None`` when none carries the flag.
+ explicitly report success, and ``None`` when neither metadata nor a lookup failure is present.
"""
if tool_call.get("_atif_observation_status") not in (None, MAPPED_OUTER_EXEC_OBSERVATION):
return None
@@ -113,6 +113,16 @@ def normalized_tool_call_error_flag(step: dict[str, Any], tool_call: dict[str, A
# Unscoped observations cannot prove that this particular call failed.
if not tool_call_id or source_call_id != tool_call_id:
continue
+ if str(tool_call.get("function_name", "")).lower() == "skill":
+ observation = atif_content_text(result.get("content")).strip()
+ if re.match(
+ r"^(?:error:\s*)?(?:skill\s+(?:(?:[\"'`][^\"'`\n]+[\"'`]|[\w./-]+)\s+)?"
+ r"(?:is\s+)?(?:not found|not available|unavailable)\b|unknown skill\b"
+ r"|(?:could not|unable to|cannot|can't)\s+(?:find|load|access)\s+(?:the\s+)?skill\b)",
+ observation,
+ re.IGNORECASE,
+ ):
+ return True
extra = result.get("extra") or {}
if not isinstance(extra, dict):
continue
@@ -124,7 +134,7 @@ def normalized_tool_call_error_flag(step: dict[str, Any], tool_call: dict[str, A
def normalized_tool_call_is_error(step: dict[str, Any], tool_call: dict[str, Any]) -> bool:
- """Preserve explicit failure metadata only for an attributable tool result."""
+ """Reject attributable failed tool results, including unsuccessful skill lookups."""
return normalized_tool_call_error_flag(step, tool_call) is True
@@ -1376,7 +1386,9 @@ def _normalize_tool_call_with_records(tool_call: dict[str, Any]) -> list[dict[st
"""Unwrap proven native Codex calls, adding the inline and allSettled forms of #235."""
normalized = _upstream_normalize_tool_call(tool_call)
arguments = tool_call.get("arguments")
- source = arguments.get("input") if tool_call.get("function_name") == "exec" and isinstance(arguments, dict) else None
+ source = (
+ arguments.get("input") if tool_call.get("function_name") == "exec" and isinstance(arguments, dict) else None
+ )
parsed = _extended_codex_program(source) if isinstance(source, str) and len(source) <= _MAX_SOURCE_CHARS else None
if parsed is None:
if "_atif_inner_tool_index" in normalized[0] and _has_non_js_space(source):
@@ -1469,14 +1481,9 @@ def _normalized_tool_call_observation_with_records(step: dict[str, Any], tool_ca
return _upstream_normalized_tool_call_observation(step, tool_call)
-def _normalized_tool_call_error_flag_with_records(
- step: dict[str, Any], tool_call: dict[str, Any]
-) -> bool | None:
+def _normalized_tool_call_error_flag_with_records(step: dict[str, Any], tool_call: dict[str, Any]) -> bool | None:
"""Report a call's own record outcome, which may be unknown, before the upstream flag."""
- if (
- tool_call.get("_atif_observation_status") == MAPPED_OUTER_EXEC_OBSERVATION
- and _RECORD_IS_ERROR in tool_call
- ):
+ if tool_call.get("_atif_observation_status") == MAPPED_OUTER_EXEC_OBSERVATION and _RECORD_IS_ERROR in tool_call:
return tool_call[_RECORD_IS_ERROR]
return _upstream_normalized_tool_call_error_flag(step, tool_call)
diff --git a/tests/tier3/test_failed_skill_reads.py b/tests/tier3/test_failed_skill_reads.py
index 7164e9e9..829534de 100644
--- a/tests/tier3/test_failed_skill_reads.py
+++ b/tests/tier3/test_failed_skill_reads.py
@@ -181,6 +181,63 @@ def test_failed_native_skill_call_is_not_activation(grader) -> None:
assert scorer.check_routing(calls, "demo-skill", skill_tool_names=[])["score"] == 0.0
+ "content",
+ [
+ 'Skill "demo-skill" not found. Available skills: other',
+ "Skill not found",
+ "Error: Skill demo-skill is unavailable",
+ "Skill 'demo-skill' not available",
+ "Unknown skill: demo-skill",
+ "Unable to load skill demo-skill",
+ ],
+)
[email protected]("name", ["Skill", "skill"])
[email protected]("error_metadata", [None, False])
+def test_failed_skill_lookup_is_not_activation(grader, content, name, error_metadata) -> None:
+ extractor, scorer = grader
+ trajectory = _claude_tool_result(name=name, arguments={"name": "demo-skill"}, is_error=False, content=content)
+ for step in trajectory["steps"]:
+ for result in (step.get("observation") or {}).get("results", []):
+ if error_metadata is None:
+ result.pop("extra", None)
+ else:
+ result["extra"] = {"tool_result_is_error": error_metadata}
+ calls = extractor.extract_tool_calls_as_dicts(trajectory)
+ names = extractor.get_skill_tool_calls(trajectory)
+ assert names == []
+ assert calls[0]["is_error"] is True
+ assert scorer.check_activation(calls, "demo-skill", skill_tool_names=names)["score"] == 0.0
+ assert scorer.check_routing(calls, "demo-skill", skill_tool_names=names)["score"] == 0.0
+
+
[email protected]("content", ["", "Launching skill: demo-skill", "# Demo skill\nSkill not found: retry it."])
+def test_successful_or_unobserved_skill_lookup_is_preserved(grader, content) -> None:
+ extractor, scorer = grader
+ trajectory = _claude_tool_result(name="Skill", arguments={"skill": "demo-skill"}, is_error=False, content=content)
+ names = extractor.get_skill_tool_calls(trajectory)
+ assert names == ["demo-skill"]
+ calls = extractor.extract_tool_calls_as_dicts(trajectory)
+ assert scorer.check_activation(calls, "demo-skill", skill_tool_names=names)["score"] == 1.0
+
+
[email protected]("source_call_id", [None, "unrelated-call"])
+def test_unrelated_lookup_failure_does_not_reject_successful_skill_call(grader, source_call_id) -> None:
+ extractor, scorer = grader
+ trajectory = _claude_tool_result(
+ name="Skill", arguments={"skill": "demo-skill"}, is_error=False, content="Launching skill: demo-skill"
+ )
+ for step in trajectory["steps"]:
+ results = (step.get("observation") or {}).get("results")
+ if results:
+ results.insert(0, {"source_call_id": source_call_id, "content": "Skill not found\n"})
+ calls = extractor.extract_tool_calls_as_dicts(trajectory)
+ names = extractor.get_skill_tool_calls(trajectory)
+ assert names == ["demo-skill"]
+ assert calls[0].get("is_error") is not True
+ assert scorer.check_activation(calls, "demo-skill", skill_tool_names=names)["score"] == 1.0
+
+
def test_opencode_failed_read_is_marked_as_error(grader) -> None:
from skillevaluator.tier3.eval_core.log_converters import synthetic_trajectory_from_opencode_json