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): treat placeholder expected_script and behavior values as no expectation (#402)

Christopher Kevin6e1177927a97
diff --git a/CHANGELOG.md b/CHANGELOG.md
index be6b0d50..cadd5424 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -171,6 +171,9 @@ All notable changes to SkillEvaluator are documented in this file.
staged `plugin.json` (where Claude Code rejected or loaded them), and
undotted Cursor skill roots become `./` paths Claude Code accepts.
+- Treat empty and placeholder `expected_script` values as no script expectation,
+ and ignore placeholder-only expected behavior entries when grading datasets.
+
- Read JSON, JSONL and YAML evaluation datasets as UTF-8 so Unicode prompts and
answers load correctly on hosts with a non-UTF-8 default text encoding.
diff --git a/docs/eval-datasets.mdx b/docs/eval-datasets.mdx
index 415f58bc..8bdc163d 100644
--- a/docs/eval-datasets.mdx
+++ b/docs/eval-datasets.mdx
@@ -90,6 +90,11 @@ top-level object with `skill_name` and an `evals` array.
| `expected_script` | No | Script the agent should run; `null` if none applies. |
| `acceptable_skills` | No | Closely related skills that earn partial routing credit (legacy alias: `acceptable_alternates`). |
+Use JSON `null` when no script is expected. Case-insensitive whole-value
+placeholders such as `"None"`, `"null"`, `"N/A"`, `"-"`, empty strings, and
+whitespace-only values are treated as `null`; exact matching keeps real script
+names such as `none.sh` intact.
+
The dataset file can be named `evals.json`, `evals.jsonl`, `evals.yaml`, or
`evals.yml` — `tier3 evaluate` accepts all four.
diff --git a/scripts/script_invocation_differential.py b/scripts/script_invocation_differential.py
index f2d6f381..f3c512e0 100644
--- a/scripts/script_invocation_differential.py
+++ b/scripts/script_invocation_differential.py
@@ -1168,6 +1168,7 @@ def _load_baseline(ref: str):
for name in (
"shell_lexing",
"script_invocation",
+ "optional_reference",
"secret_redaction",
"codex_tool_call_normalizer",
"log_converters",
@@ -1186,9 +1187,7 @@ def _load_baseline(ref: str):
with tempfile.TemporaryDirectory(prefix="script-check-baseline-") as temporary:
directory = Path(temporary)
for name, relative in sources.items():
- result = subprocess.run(
- ["git", "show", f"{ref}:{relative}"], capture_output=True, text=True, cwd=REPO_ROOT
- )
+ result = subprocess.run(["git", "show", f"{ref}:{relative}"], capture_output=True, text=True, cwd=REPO_ROOT)
if result.returncode and name not in {"checks", "baseline_template"}:
continue # Shared modules did not exist before their extraction.
result.check_returncode()
diff --git a/src/skillevaluator/tier3/dataset_utils.py b/src/skillevaluator/tier3/dataset_utils.py
index 201b07a9..85cffe6e 100644
--- a/src/skillevaluator/tier3/dataset_utils.py
+++ b/src/skillevaluator/tier3/dataset_utils.py
@@ -16,6 +16,8 @@ from typing import Any, Literal
import yaml
+from skillevaluator.tier3.eval_core.optional_reference import normalize_expected_behaviors, normalize_optional_reference
+
logger = logging.getLogger(__name__)
DATASET_EXTENSIONS = (".json", ".jsonl", ".yaml", ".yml")
@@ -121,14 +123,20 @@ def normalize_dataset_entries(data: Any) -> list[dict[str, Any]]:
for idx, entry in enumerate(data["evals"]):
if not isinstance(entry, dict):
raise ValueError(f"agentskills dataset evals[{idx}] must be an object, got {type(entry).__name__}")
- entries.append(_normalize_entry(entry, skill_name=skill_name))
+ entries.append(_normalize_entry(entry, skill_name=skill_name, entry_index=idx))
return entries
if isinstance(data.get("cases"), list):
- return [_normalize_entry(entry) for entry in data["cases"] if isinstance(entry, dict)]
+ return [
+ _normalize_entry(entry, entry_index=index)
+ for index, entry in enumerate(data["cases"])
+ if isinstance(entry, dict)
+ ]
return [_normalize_entry(data)]
if isinstance(data, list):
- return [_normalize_entry(entry) for entry in data if isinstance(entry, dict)]
+ return [
+ _normalize_entry(entry, entry_index=index) for index, entry in enumerate(data) if isinstance(entry, dict)
+ ]
return []
@@ -136,7 +144,12 @@ def normalize_dataset_entries(data: Any) -> list[dict[str, Any]]:
# ── private helpers ──────────────────────────────────────────────────────────
-def _normalize_entry(entry: dict[str, Any], *, skill_name: Any | None = None) -> dict[str, Any]:
+def _normalize_entry(
+ entry: dict[str, Any],
+ *,
+ skill_name: Any | None = None,
+ entry_index: int = 0,
+) -> dict[str, Any]:
"""Map agentskills.io field names onto the existing runtime schema."""
normalized = dict(entry)
if "question" not in normalized and "prompt" in entry:
@@ -145,6 +158,15 @@ def _normalize_entry(entry: dict[str, Any], *, skill_name: Any | None = None) ->
normalized["ground_truth"] = entry["expected_output"]
if "expected_behavior" not in normalized and "assertions" in entry:
normalized["expected_behavior"] = entry["assertions"]
+ if "expected_script" in normalized:
+ try:
+ normalized["expected_script"] = normalize_optional_reference(normalized["expected_script"])
+ except TypeError as exc:
+ raise ValueError(f"invalid eval dataset entry {entry_index}: {exc}") from exc
+ if "expected_behavior" in normalized:
+ normalized["expected_behavior"] = normalize_expected_behaviors(normalized["expected_behavior"])
+ if isinstance(normalized.get("assertions"), list):
+ normalized["assertions"] = normalize_expected_behaviors(normalized["assertions"])
if "expected_skill" not in normalized and isinstance(skill_name, str) and skill_name:
normalized["expected_skill"] = skill_name
return normalized
diff --git a/src/skillevaluator/tier3/eval_core/checks.py b/src/skillevaluator/tier3/eval_core/checks.py
index 2100aa5f..1b2ee49d 100644
--- a/src/skillevaluator/tier3/eval_core/checks.py
+++ b/src/skillevaluator/tier3/eval_core/checks.py
@@ -23,6 +23,7 @@ from fnmatch import fnmatchcase
from typing import Any
if __package__:
+ from skillevaluator.tier3.eval_core import optional_reference as _optional_reference
from skillevaluator.tier3.eval_core import script_invocation as _script_invocation
from skillevaluator.tier3.eval_core import shell_lexing as _shell_lexing
from skillevaluator.tier3.eval_core.codex_tool_call_normalizer import (
@@ -32,6 +33,7 @@ if __package__:
)
from skillevaluator.tier3.eval_core.secret_redaction import redact_secrets_in_log_line
else: # Standalone verifier: all dependencies are staged siblings.
+ import optional_reference as _optional_reference
import script_invocation as _script_invocation
import shell_lexing as _shell_lexing
from codex_tool_call_normalizer import (
@@ -41,6 +43,9 @@ else: # Standalone verifier: all dependencies are staged siblings.
)
from secret_redaction import redact_secrets_in_log_line
+normalize_expected_behaviors = _optional_reference.normalize_expected_behaviors
+normalize_optional_reference = _optional_reference.normalize_optional_reference
+
_ATTACHED_DESCRIPTOR_RE = _shell_lexing._ATTACHED_DESCRIPTOR_RE
_QUOTED_SYNTAX_MARK = _shell_lexing._QUOTED_SYNTAX_MARK
_SYNTAX_WORDS = _shell_lexing._SYNTAX_WORDS
@@ -4384,6 +4389,7 @@ def check_script_execution(
expected_script: str | None,
) -> dict[str, Any]:
"""Check whether the agent executed the expected script."""
+ expected_script = normalize_optional_reference(expected_script)
if not expected_script:
return {"passed": True, "score": 1.0, "reason": "No specific script expected"}
@@ -4520,6 +4526,7 @@ def check_error_recovery(
error keywords in observation) followed by a similar command that
succeeded. Returns per-correction details with fault attribution.
"""
+ expected_script = normalize_optional_reference(expected_script)
if not tool_calls:
return {
"passed": True,
@@ -5291,6 +5298,7 @@ def check_tool_efficiency(
expected_script: str | None = None,
) -> dict[str, Any]:
"""Measure what fraction of tool calls were productive vs wasted."""
+ expected_script = normalize_optional_reference(expected_script)
if not tool_calls:
return {"passed": True, "score": 1.0, "reason": "No tool calls", "details": {}}
@@ -5388,6 +5396,7 @@ def score_skill_execution(
activation failure receives no execution credit, while retaining all check
details for diagnosis. Negative and unlabeled cases use their own rules.
"""
+ expected_script = normalize_optional_reference(expected_script)
if should_trigger is None:
return {"score": 1.0, "details": {"message": "No expected_skill -- skipped"}}
@@ -5466,6 +5475,7 @@ def score_skill_efficiency(
acceptable_skills: Any = None,
) -> dict[str, Any]:
"""Compute the ``skill_efficiency`` eval score (average of sub-checks)."""
+ expected_script = normalize_optional_reference(expected_script)
if not should_trigger:
return {"score": 1.0, "details": {"message": "Negative case -- efficiency not applicable"}}
diff --git a/src/skillevaluator/tier3/eval_core/llm_judge.py b/src/skillevaluator/tier3/eval_core/llm_judge.py
index 594e177d..8b9c4b94 100644
--- a/src/skillevaluator/tier3/eval_core/llm_judge.py
+++ b/src/skillevaluator/tier3/eval_core/llm_judge.py
@@ -37,6 +37,7 @@ from skillevaluator.tier3.eval_core.atif_helpers import (
_truncate_for_behavior,
)
from skillevaluator.tier3.eval_core.character_facts import append_character_facts
+from skillevaluator.tier3.eval_core.optional_reference import normalize_expected_behaviors
logger = logging.getLogger(__name__)
@@ -1010,6 +1011,7 @@ def judge_behavior_check(
**kwargs: Any,
) -> dict[str, Any]:
"""Run the behavior check LLM judge; the score is the share of behaviors observed."""
+ expected_behaviors = normalize_expected_behaviors(expected_behaviors)
if not _has_judge_reference(expected_behaviors):
return _judge_not_applicable(_NO_EXPECTED_BEHAVIOR_REASON, results=[])
diff --git a/src/skillevaluator/tier3/eval_core/optional_reference.py b/src/skillevaluator/tier3/eval_core/optional_reference.py
new file mode 100644
index 00000000..16fdde06
--- /dev/null
+++ b/src/skillevaluator/tier3/eval_core/optional_reference.py
@@ -0,0 +1,35 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+from __future__ import annotations
+
+from typing import Any
+
+_EMPTY_REFERENCE_VALUES = frozenset({"none", "null", "n/a", "-"})
+
+
+def normalize_optional_reference(value: Any) -> str | None:
+ if value is None:
+ return None
+ if not isinstance(value, str):
+ if not value:
+ return None
+ raise TypeError(f"expected_script must be a string or null, got {type(value).__name__}")
+ normalized = value.strip()
+ if not normalized or normalized.casefold() in _EMPTY_REFERENCE_VALUES:
+ return None
+ return normalized
+
+
+def normalize_expected_behaviors(value: Any) -> Any:
+ if not isinstance(value, list):
+ return value
+ behaviors = []
+ for behavior in value:
+ if isinstance(behavior, str):
+ normalized = behavior.strip(" \t\n\r\f\v")
+ if normalized and normalized.casefold() not in _EMPTY_REFERENCE_VALUES:
+ behaviors.append(normalized)
+ elif behavior:
+ behaviors.append(behavior)
+ return behaviors
diff --git a/src/skillevaluator/tier3/generate_dataset.py b/src/skillevaluator/tier3/generate_dataset.py
index 294153aa..d61c6877 100644
--- a/src/skillevaluator/tier3/generate_dataset.py
+++ b/src/skillevaluator/tier3/generate_dataset.py
@@ -56,6 +56,7 @@ import yaml
from skillevaluator.constants import EXECUTABLE_SKILL_DIRS
from skillevaluator.evaluation.results import DatasetGenerationError, DatasetGenerationResult
from skillevaluator.tier3.eval_core.codex_tool_call_normalizer import atif_content_text
+from skillevaluator.tier3.eval_core.optional_reference import normalize_expected_behaviors, normalize_optional_reference
from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN
# Output budget for generation and refinement; OpenAI reasoning models get the
@@ -306,16 +307,27 @@ def _generate_simple(skill: dict[str, Any]) -> list[dict[str, Any]]:
behaviors.extend(eval_hints["behaviors"])
behaviors.append(SECURITY_BEHAVIOR)
- return [
- {
- "id": f"{name}-001",
- "question": question,
- "expected_skill": name,
- "expected_script": script,
- "ground_truth": f"The agent used the {name} skill and provided a response showing {desc.lower().rstrip('.')}",
- "expected_behavior": behaviors,
- }
- ]
+ return _normalize_generated_cases(
+ [
+ {
+ "id": f"{name}-001",
+ "question": question,
+ "expected_skill": name,
+ "expected_script": script,
+ "ground_truth": f"The agent used the {name} skill and provided a response showing {desc.lower().rstrip('.')}",
+ "expected_behavior": behaviors,
+ }
+ ]
+ )
+
+
+def _normalize_generated_cases(cases: list[dict[str, Any]]) -> list[dict[str, Any]]:
+ for case in cases:
+ if "expected_script" in case:
+ case["expected_script"] = normalize_optional_reference(case["expected_script"])
+ if "expected_behavior" in case:
+ case["expected_behavior"] = normalize_expected_behaviors(case["expected_behavior"])
+ return cases
def _generate_full(skill: dict[str, Any]) -> list[dict[str, Any]]:
@@ -385,7 +397,7 @@ def _generate_full(skill: dict[str, Any]) -> list[dict[str, Any]]:
],
}
)
- return cases
+ return _normalize_generated_cases(cases)
async def _generate_with_llm(
@@ -501,6 +513,13 @@ No other fields."""
cases = json.loads(text)
expected_count = 4 if full else 1
+ if isinstance(cases, list):
+ for case in cases:
+ if isinstance(case, dict):
+ if "expected_script" in case:
+ case["expected_script"] = normalize_optional_reference(case["expected_script"])
+ if isinstance(case.get("expected_behavior"), list):
+ case["expected_behavior"] = normalize_expected_behaviors(case["expected_behavior"])
required_fields = {
"id",
"question",
@@ -522,7 +541,6 @@ No other fields."""
or not isinstance(case["ground_truth"], str)
or not case["ground_truth"].strip()
or not isinstance(case["expected_behavior"], list)
- or not case["expected_behavior"]
or any(not isinstance(behavior, str) or not behavior.strip() for behavior in case["expected_behavior"])
for case in cases
)
@@ -542,7 +560,7 @@ No other fields."""
if behaviors and not any("secret" in b.lower() or "destructive" in b.lower() for b in behaviors):
behaviors.append(SECURITY_BEHAVIOR)
- return cases
+ return _normalize_generated_cases(cases)
except Exception as exc:
from skillevaluator.inference.diagnostics import llm_failure_diagnostic
diff --git a/src/skillevaluator/tier3/harbor/adapter.py b/src/skillevaluator/tier3/harbor/adapter.py
index 61d170ac..acd81b1e 100644
--- a/src/skillevaluator/tier3/harbor/adapter.py
+++ b/src/skillevaluator/tier3/harbor/adapter.py
@@ -2402,6 +2402,7 @@ def _copy_verifier(task_dir: Path) -> None:
(_EVAL_CORE_DIR / "atif_helpers.py", "ATIF evidence helpers"),
(_EVAL_CORE_DIR / "shell_lexing.py", "Shell lexical helper"),
(_EVAL_CORE_DIR / "script_invocation.py", "Shell invocation helper"),
+ (_EVAL_CORE_DIR / "optional_reference.py", "Optional reference normalizer"),
(_EVAL_CORE_DIR / "checks.py", "Deterministic grading checks"),
(_EVAL_CORE_DIR / "secret_redaction.py", "Deterministic redaction helper"),
(_EVAL_CORE_DIR / "codex_tool_call_normalizer.py", "Codex tool-call normalizer"),
diff --git a/src/skillevaluator/tier3/harbor/templates/eval.py b/src/skillevaluator/tier3/harbor/templates/eval.py
index a264aeb8..2f959caf 100644
--- a/src/skillevaluator/tier3/harbor/templates/eval.py
+++ b/src/skillevaluator/tier3/harbor/templates/eval.py
@@ -284,6 +284,8 @@ _without_plain_patch_headers = _shared_checks._without_plain_patch_headers
_without_redirections = _shared_checks._without_redirections
check_error_recovery = _shared_checks.check_error_recovery
check_script_execution = _shared_checks.check_script_execution
+normalize_optional_reference = _shared_checks.normalize_optional_reference
+normalize_expected_behaviors = _shared_checks.normalize_expected_behaviors
resolve_should_trigger = _shared_checks.resolve_should_trigger
score_skill_execution = _shared_checks.score_skill_execution
@@ -3395,6 +3397,7 @@ def _behavior_prompt_example(expected_count):
def judge_behavior_check(conversation_text, expected_behaviors):
+ expected_behaviors = normalize_expected_behaviors(expected_behaviors)
if not _has_judge_reference(expected_behaviors):
return _judge_not_applicable(_NO_EXPECTED_BEHAVIOR_REASON, results=[])
@@ -3780,11 +3783,11 @@ def main():
traj, traj_meta = load_trajectory_with_fallback(ATIF_PATH, ATIF_PATH.parent)
expected_skill = entry.get("expected_skill") or ""
- expected_script = entry.get("expected_script") or ""
+ expected_script = normalize_optional_reference(entry.get("expected_script"))
should_trigger = resolve_should_trigger(entry)
evaluated_skill = entry.get("evaluated_skill") or ""
acceptable_skills = _resolve_acceptable_skills(entry, expected_skill)
- expected_behavior = entry.get("expected_behavior", [])
+ expected_behavior = normalize_expected_behaviors(entry.get("expected_behavior", []))
question = entry.get("question", "")
ground_truth = entry.get("ground_truth", "")
workspace_mode = entry.get("skill_workspace_mode", "isolated")
diff --git a/tests/test_harbor_scaffold_transactions.py b/tests/test_harbor_scaffold_transactions.py
index b46a44e5..4fa7e580 100644
--- a/tests/test_harbor_scaffold_transactions.py
+++ b/tests/test_harbor_scaffold_transactions.py
@@ -324,6 +324,53 @@ def test_existing_yaml_dataset_is_not_shadowed(tmp_path: Path) -> None:
assert not (evals / "evals.json").exists()
+def test_init_harbor_task_accepts_agentskills_assertion_placeholder(tmp_path: Path) -> None:
+ skill = _skill(tmp_path)
+ evals = skill / "evals"
+ evals.mkdir()
+ (evals / "evals.json").write_text(
+ json.dumps(
+ {
+ "skill_name": "sample-skill",
+ "evals": [
+ {
+ "id": "case-001",
+ "prompt": "Q",
+ "expected_output": "A",
+ "assertions": ["None"],
+ }
+ ],
+ }
+ ),
+ encoding="utf-8",
+ )
+
+ result = CliRunner().invoke(cli, ["init-harbor-task", str(skill)])
+
+ assert result.exit_code == 0, result.output
+
+
+def test_init_harbor_task_accepts_yaml_block_scalar_assertion(tmp_path: Path) -> None:
+ skill = _skill(tmp_path)
+ evals = skill / "evals"
+ evals.mkdir()
+ (evals / "evals.yaml").write_text(
+ "skill_name: sample-skill\n"
+ "evals:\n"
+ " - id: case-001\n"
+ " prompt: Q\n"
+ " expected_output: A\n"
+ " assertions:\n"
+ " - |\n"
+ " None\n",
+ encoding="utf-8",
+ )
+
+ result = CliRunner().invoke(cli, ["init-harbor-task", str(skill)])
+
+ assert result.exit_code == 0, result.output
+
+
def test_with_config_updates_existing_config_yaml_without_shadow_file(tmp_path: Path) -> None:
skill = _skill(tmp_path)
evals = skill / "evals"
diff --git a/tests/test_script_invocation_differential.py b/tests/test_script_invocation_differential.py
index 33c1674a..ee58fc7f 100644
--- a/tests/test_script_invocation_differential.py
+++ b/tests/test_script_invocation_differential.py
@@ -31,9 +31,11 @@ def test_current_git_baseline_loads_its_own_shared_modules(monkeypatch):
"baseline_template",
"script_invocation",
"shell_lexing",
+ "optional_reference",
"secret_redaction",
"skillevaluator.tier3.eval_core.script_invocation",
"skillevaluator.tier3.eval_core.shell_lexing",
+ "skillevaluator.tier3.eval_core.optional_reference",
):
assert sys.modules.get(name) is previous_modules.get(name)
assert host._cmd_executes_script is not differential.host_checks._cmd_executes_script
diff --git a/tests/tier3/test_evals_config.py b/tests/tier3/test_evals_config.py
index 51bb8692..9dd093aa 100644
--- a/tests/tier3/test_evals_config.py
+++ b/tests/tier3/test_evals_config.py
@@ -365,6 +365,21 @@ def test_validate_skill_evals_warns_expected_script_when_scripts_exist(tmp_path)
assert any("expected_script is missing" in msg for msg in messages)
+def test_validate_skill_evals_accepts_placeholder_expected_script_as_explicit_no_script(tmp_path):
+ skill = tmp_path / "script-skill"
+ (skill / "evals").mkdir(parents=True)
+ (skill / "scripts").mkdir()
+ (skill / "scripts" / "main.py").write_text("print('ok')\n", encoding="utf-8")
+ (skill / "evals" / "evals.json").write_text(
+ '[{"id":"case-1","question":"Run it.","expected_script":"None"}]',
+ encoding="utf-8",
+ )
+
+ messages = [result.message for result in validate_skill_evals(skill)]
+
+ assert not any("expected_script is missing" in message for message in messages)
+
+
def test_agentskills_evals_json_is_accepted_without_deprecation_warning(tmp_path):
skill = tmp_path / "agent-skill"
(skill / "evals").mkdir(parents=True)
@@ -500,4 +515,3 @@ def test_validate_environment_kwargs_gke_infrastructure_boundary(infra_key: str)
assert validate_environment_kwargs({infra_key: "test-val"}, allow_gke_infrastructure_kwargs=True) == {
infra_key: "test-val"
}
-
diff --git a/tests/tier3/test_generate_dataset_results.py b/tests/tier3/test_generate_dataset_results.py
index cd74f4be..8cec358a 100644
--- a/tests/tier3/test_generate_dataset_results.py
+++ b/tests/tier3/test_generate_dataset_results.py
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
+import asyncio
import json
import re
import shutil
@@ -8,6 +9,7 @@ import stat
import sys
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
+from types import SimpleNamespace
import pytest
@@ -533,7 +535,6 @@ def test_parse_skill_falls_back_to_defaults_on_malformed_frontmatter(tmp_path):
assert parsed["description"] == ""
-
def test_no_llm_negative_case_does_not_name_the_skill():
"""Author-provided negatives must stay off-skill and must not name the skill."""
skill = {
@@ -665,3 +666,85 @@ def test_refine_resolves_result_case_ids_without_the_tier3_extra(tmp_path: Path)
assert completed.returncode == 0, completed.stderr
assert json.loads(completed.stdout) == {"case_id": "case-007", "harbor_loaded": False}
+
+
+def test_llm_generation_writes_null_for_placeholder_expected_script(tmp_path, monkeypatch):
+ skill = tmp_path / "my-skill"
+ skill.mkdir()
+ (skill / "SKILL.md").write_text(
+ "---\nname: my-skill\ndescription: Does useful work\n---\n",
+ encoding="utf-8",
+ )
+ response = [
+ {
+ "id": "case-1",
+ "question": "Do useful work.",
+ "expected_skill": "my-skill",
+ "expected_script": "None",
+ "ground_truth": "The work is complete.",
+ "expected_behavior": ["None", " "],
+ }
+ ]
+ monkeypatch.setattr(
+ "skillevaluator.provider_config.resolve_llm_provider",
+ lambda: SimpleNamespace(provider="test", model="test-model"),
+ )
+
+ class FakeLLMClient:
+ def __init__(self, **_kwargs):
+ pass
+
+ def completions(self, *_args, **_kwargs):
+ return json.dumps(response)
+
+ monkeypatch.setattr("skillevaluator.inference.client.LLMClient", FakeLLMClient)
+
+ dataset_path = generate_dataset.generate_one_case(skill, use_llm=True)
+
+ payload = json.loads(dataset_path.read_text(encoding="utf-8"))
+ assert payload["evals"][0]["expected_script"] is None
+ assert "assertions" not in payload["evals"][0]
+
+
+def test_llm_generation_falls_back_for_non_string_expected_script(tmp_path, monkeypatch, capsys):
+ skill_path = tmp_path / "my-skill"
+ skill_path.mkdir()
+ (skill_path / "SKILL.md").write_text(
+ "---\nname: my-skill\ndescription: Does useful work\n---\n",
+ encoding="utf-8",
+ )
+ response = [
+ {
+ "id": "case-1",
+ "question": "Do useful work.",
+ "expected_skill": "my-skill",
+ "expected_script": ["calc.py"],
+ "ground_truth": "The work is complete.",
+ "expected_behavior": ["The agent completes the work."],
+ }
+ ]
+ monkeypatch.setattr(
+ "skillevaluator.provider_config.resolve_llm_provider",
+ lambda: SimpleNamespace(provider="test", model="test-model"),
+ )
+
+ class FakeLLMClient:
+ def __init__(self, **_kwargs):
+ pass
+
+ def completions(self, *_args, **_kwargs):
+ return json.dumps(response)
+
+ monkeypatch.setattr("skillevaluator.inference.client.LLMClient", FakeLLMClient)
+
+ cases = asyncio.run(
+ generate_dataset._generate_with_llm(
+ generate_dataset._parse_skill(skill_path),
+ fallback_to_template=True,
+ announce_provider=False,
+ )
+ )
+
+ assert cases
+ assert cases[0]["expected_script"] is None
+ assert "Warning: LLM generation failed: LLM configuration or response was invalid." in capsys.readouterr().out
diff --git a/tests/tier3/test_judge_contracts.py b/tests/tier3/test_judge_contracts.py
index 689933ec..67d5fe5a 100644
--- a/tests/tier3/test_judge_contracts.py
+++ b/tests/tier3/test_judge_contracts.py
@@ -107,6 +107,18 @@ def test_every_judge_prompt_example_passes_its_own_validator(judge_module, monke
assert "score" not in example
+def test_placeholder_only_expected_behavior_is_not_applicable(judge_module, monkeypatch) -> None:
+ def fail_if_called(*args, **kwargs):
+ raise AssertionError("the judge should not run without expected behaviors")
+
+ monkeypatch.setattr(judge_module, "call_public_llm", fail_if_called)
+ result = judge_module.judge_behavior_check("conversation", ["None", " ", "n/A", None])
+
+ assert result["score"] is None
+ assert result["reason"] == "N/A: no expected_behavior defined for this eval case"
+ assert result["results"] == []
+
+
@pytest.mark.parametrize("behavior_count", [1, 2, 3, 5, 12])
def test_behavior_prompt_example_is_a_valid_reply_for_any_number_of_behaviors(
judge_module, monkeypatch, behavior_count: int
diff --git a/tests/tier3/test_optional_reference.py b/tests/tier3/test_optional_reference.py
new file mode 100644
index 00000000..8e3d9252
--- /dev/null
+++ b/tests/tier3/test_optional_reference.py
@@ -0,0 +1,116 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+import json
+
+import pytest
+
+from skillevaluator.tier3.dataset_utils import load_dataset_entries_with_format
+from skillevaluator.tier3.eval_core.optional_reference import (
+ normalize_expected_behaviors,
+ normalize_optional_reference,
+)
+
+
+ ("value", "expected"),
+ [
+ (None, None),
+ ("", None),
+ (" \t\n ", None),
+ ("None", None),
+ (" none ", None),
+ ("NULL", None),
+ (" N/A ", None),
+ ("n/a", None),
+ ("-", None),
+ (0, None),
+ ([], None),
+ ("none.sh", "none.sh"),
+ (" None.sh ", "None.sh"),
+ ("scripts/main.py", "scripts/main.py"),
+ ],
+)
+def test_normalize_optional_reference(value, expected):
+ assert normalize_optional_reference(value) == expected
+
+
+def test_expected_behavior_normalization_preserves_unicode_whitespace():
+ assert normalize_expected_behaviors([" Reject \u202f ", " None ", " \t "]) == ["Reject \u202f"]
+
+
[email protected]("dataset_format", ["agentskills", "legacy"])
+def test_dataset_loaders_normalize_optional_references(tmp_path, dataset_format):
+ entry = {
+ "id": "case-1",
+ "expected_script": " nOnE ",
+ "expected_behavior": ["None", " ", "n/A", None, "Keep this behavior"],
+ }
+ if dataset_format == "agentskills":
+ entry.update(
+ prompt="Use the skill.",
+ expected_output="None",
+ assertions=entry.pop("expected_behavior"),
+ )
+ payload = {"skill_name": "demo", "evals": [entry]}
+ else:
+ entry.update(question="Use the skill.", ground_truth="None")
+ payload = [entry]
+
+ dataset_path = tmp_path / "evals.json"
+ dataset_path.write_text(json.dumps(payload), encoding="utf-8")
+
+ (normalized,), actual_format = load_dataset_entries_with_format(dataset_path)
+
+ assert actual_format == dataset_format
+ assert normalized["expected_script"] is None
+ assert normalized["expected_behavior"] == ["Keep this behavior"]
+ assert normalized["ground_truth"] == "None"
+
+
+ ("value", "type_name"),
+ [
+ (["calc.py"], "list"),
+ (7, "int"),
+ (True, "bool"),
+ ],
+)
+def test_dataset_loader_rejects_truthy_non_string_expected_script_with_entry_index(tmp_path, value, type_name):
+ dataset_path = tmp_path / "evals.json"
+ dataset_path.write_text(
+ json.dumps(
+ {
+ "skill_name": "demo",
+ "evals": [
+ {"id": "case-0", "prompt": "First", "expected_output": "A"},
+ {"id": "case-1", "prompt": "Second", "expected_output": "B", "expected_script": value},
+ ],
+ }
+ ),
+ encoding="utf-8",
+ )
+
+ with pytest.raises(
+ ValueError,
+ match=rf"invalid eval dataset entry 1: expected_script must be a string or null, got {type_name}",
+ ):
+ load_dataset_entries_with_format(dataset_path)
+
+
[email protected]("value", [0, []])
+def test_dataset_loader_normalizes_falsy_non_string_expected_script(tmp_path, value):
+ dataset_path = tmp_path / "evals.json"
+ dataset_path.write_text(
+ json.dumps(
+ {
+ "skill_name": "demo",
+ "evals": [{"id": "case-0", "prompt": "First", "expected_output": "A", "expected_script": value}],
+ }
+ ),
+ encoding="utf-8",
+ )
+
+ (normalized,), _ = load_dataset_entries_with_format(dataset_path)
+
+ assert normalized["expected_script"] is None
diff --git a/tests/tier3/test_private_plugin_security.py b/tests/tier3/test_private_plugin_security.py
index 8eaa1012..39c7acff 100644
--- a/tests/tier3/test_private_plugin_security.py
+++ b/tests/tier3/test_private_plugin_security.py
@@ -276,6 +276,7 @@ def test_private_helper_loads_with_staged_sibling_imports(security, tmp_path):
for name in (
"plugin_security.py",
"checks.py",
+ "optional_reference.py",
"shell_lexing.py",
"script_invocation.py",
"codex_tool_call_normalizer.py",
diff --git a/tests/tier3/test_script_invocation_evidence.py b/tests/tier3/test_script_invocation_evidence.py
index bddb5d8b..2bdb00f2 100644
--- a/tests/tier3/test_script_invocation_evidence.py
+++ b/tests/tier3/test_script_invocation_evidence.py
@@ -156,6 +156,19 @@ def test_no_expected_script_is_unchanged(check) -> None:
assert result["passed"] is True
[email protected]("placeholder", ["None", " NONE ", "null", "N/A", "-", " \t"])
[email protected]("check", IMPLEMENTATIONS)
+def test_placeholder_expected_script_matches_no_expectation(check, placeholder) -> None:
+ calls = _bash("python other.py")
+ expected = check(calls, None)
+ actual = check(calls, placeholder)
+
+ assert actual["score"] == expected["score"]
+ assert actual["passed"] == expected["passed"]
+ assert actual["reason"] == expected["reason"]
+ assert "Execute called but not with None" not in actual["reason"]
+
+
@pytest.mark.parametrize("check", IMPLEMENTATIONS)
def test_unrelated_execution_still_reports_the_expected_script(check) -> None:
result = check(_bash("ls -la"), EXPECTED_SCRIPT)
diff --git a/tests/tier3/test_shared_check_adapters.py b/tests/tier3/test_shared_check_adapters.py
index 9c9058c6..1ba50a0a 100644
--- a/tests/tier3/test_shared_check_adapters.py
+++ b/tests/tier3/test_shared_check_adapters.py
@@ -71,6 +71,16 @@ def test_standalone_efficiency_preserves_its_smaller_output_shape(verifier, call
assert standalone == {key: value for key, value in host.items() if key != "details"}
+def test_placeholder_expected_script_matches_no_expectation_for_efficiency(verifier):
+ calls = [{"action": "Bash", "action_input": {"command": "python other.py"}}]
+ for checker in (checks.check_tool_efficiency, verifier.check_tool_efficiency):
+ expected = checker(calls, "calculator", None)
+ actual = checker(calls, "calculator", "None")
+ assert actual["score"] == expected["score"]
+ assert actual["passed"] == expected["passed"]
+ assert "Execute called but not with None" not in actual["reason"]
+
+
def test_standalone_security_adapts_trajectory_text(verifier):
trajectory = {
"steps": [
@@ -116,6 +126,34 @@ def test_staged_template_ignores_an_unrelated_checks_module(tmp_path):
assert json.loads(result.stdout) == [str(staged.with_name("checks.py")), True]
+def test_staged_template_normalizes_optional_references(tmp_path):
+ _copy_verifier(tmp_path)
+ staged = tmp_path / "tests/skill_evaluator/eval.py"
+ program = (
+ "import json,runpy,sys; "
+ "v=runpy.run_path(sys.argv[1]); "
+ "calls=[{'action':'Read','action_input':{'file_path':'/skills/calculator/SKILL.md'}}]; "
+ "execution=v['score_skill_execution']; "
+ "efficiency=v['check_tool_efficiency']; "
+ "script=v['check_script_execution']; "
+ "behavior=v['judge_behavior_check']('conversation',['None']); "
+ "print(json.dumps({"
+ "'execution':[execution(calls,'calculator',None)['score'],execution(calls,'calculator','None')['score']],"
+ "'efficiency':[efficiency(calls,'calculator',None)['score'],efficiency(calls,'calculator','None')['score']],"
+ "'script':[script(calls,None)['score'],script(calls,'None')['score']],"
+ "'behavior':[behavior['score'],behavior['reason']]}))"
+ )
+ result = subprocess.run(
+ [sys.executable, "-I", "-c", program, str(staged)], cwd=tmp_path, capture_output=True, text=True, check=True
+ )
+ output = json.loads(result.stdout)
+
+ assert output["execution"][0] == output["execution"][1]
+ assert output["efficiency"][0] == output["efficiency"][1]
+ assert output["script"][0] == output["script"][1]
+ assert output["behavior"] == [None, "N/A: no expected_behavior defined for this eval case"]
+
+
def _read(path):
return {"action": "read", "action_input": {"path": path}, "observation": "ok"}
diff --git a/tests/tier3/test_skill_activation_scoring.py b/tests/tier3/test_skill_activation_scoring.py
index 0e5666fc..189322b4 100644
--- a/tests/tier3/test_skill_activation_scoring.py
+++ b/tests/tier3/test_skill_activation_scoring.py
@@ -75,6 +75,13 @@ def test_supported_activation_preserves_subcheck_average(
assert result["score"] == execution_score
[email protected]("placeholder", ["None", "N/A", "-"])
+def test_placeholder_expected_script_matches_no_expectation_in_composite_score(scorer, placeholder) -> None:
+ calls = [{"action": "Read", "action_input": {"file_path": "/skills/demo/SKILL.md"}}]
+
+ assert scorer.score_skill_execution(calls, "demo", placeholder) == scorer.score_skill_execution(calls, "demo", None)
+
+
def test_unsupported_activation_is_unknown_and_not_forced_to_zero(scorer: ModuleType) -> None:
call = {
"action": "functions.exec",