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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ All notable changes to SkillEvaluator are documented in this file.

### Added

- Tier 3 reports show per-case expectation inventories with explicit met,
unmet, unchecked, unscored and inapplicable judgments, evidence and next
diagnostic steps for executed conditions. Behavior judges can abstain when
evidence is missing; partial results preserve every original requirement
without presenting missing judgments as verified skill defects. Unexpected
judge errors retain that inventory; intentionally skipped arms add no attempts.

- Run SkillEvaluator's own `skills/` through the pinned three-tier GitHub
callers, retaining Tier 1 as required and Tier 2/3 as advisory. A separate
consumer feedback listener preserves the reusable publisher's public path;
Expand Down
46 changes: 46 additions & 0 deletions docs/reports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,52 @@ from every trial, not only the rows the preview keeps, for up to 200 eval
cases; a note says how many more cases the JSON download holds. A case with
missing or partial step telemetry is a gap, not a zero.

### Per-case expectation diagnostics

The HTML **Dataset** tab expands each case into its authored requirements and
recorded judgments, separately for each agent, attempt and condition. The JSON
payload's `case_diagnostics` carries the same inventory. Requirements retain
their original text (with credentials redacted); behavior IDs use the source
field and zero-based position, while judge `step` numbers remain one-based.
Routing and script checks use their named sub-checks, not the aggregate score.
Expected output is checked separately for goal achievement and accuracy; an
excluded accuracy criterion is listed as inapplicable, never as unmet.

Each judgment has one of five statuses:

| Status | Meaning | Next diagnostic step |
| --- | --- | --- |
| Met | An explicit verdict supports the requirement | No correction indicated by this check |
| Unmet | An explicit verdict reports a violation | Compare the requirement with the observed evidence; inspect execution if it is valid, or correct the test if it is inappropriate |
| Not checked | No unique usable verdict: missing/truncated output, judge or execution error, ambiguous identity, or explicit judge abstention | Inspect the retained execution/judge artifacts and rerun before diagnosing a skill defect |
| Unscored | The grader did not score this requirement's metric | Inspect grader configuration and score output |
| Not applicable | The grader explicitly excluded this check for this condition | Confirm that exclusion is intended; do not count it as a failure |

Reasons and short evidence excerpts accompany the verdicts when recorded.
Excerpts are metric-level context, not proof automatically attributed to every
requirement. A low score alone never assigns ownership to the skill or test.
Negative controls may correctly avoid the skill while completing an unrelated
task; being unrelated is not a reason to remove the case. The no-skill baseline
can mark skill checks inapplicable while still judging the task outcome.
Intentionally skipped conditions do not create diagnostic attempts. Failed or
unknown conditions remain visible even when no trial result was retained.

Behavior judges may return `passed: null` with an explanation when evidence
does not permit a check. The rich behavior result's `expectations` retains all
original behaviors, including those missing from a salvaged response. Existing
conservative scoring is preserved: only explicit passes earn credit, and the
denominator remains the full expected behavior count. Unchecked entries can
therefore lower the score without establishing a verified defect.

Inventories are bounded to 512 cases, 128 requirements per case, 512 attempts
across the report and 8,192 judgments. Any omissions are recorded under
`report_truncation.omitted`. Oversized HTML previews omit whole diagnostic
inventories rather than truncating identity or status fields; JSON Downloads
retain them unless the canonical 2 MiB limit also requires dropping them.
Dropping an oversized diagnostic inventory preserves built failure reasons
whenever those reasons still fit within the canonical limit.
Retained run artifacts remain the source for details omitted by either limit.

### pass@k

pass@k is the reliability signal, reported separately from the dimension
Expand Down
243 changes: 243 additions & 0 deletions src/skillevaluator/evaluation/tier3_expectations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Join authored requirements to recorded verdicts, never to aggregate scores."""

from __future__ import annotations

from collections import Counter
from typing import Any

from skillevaluator.evaluation.tier3_findings import sanitize_grader_text

_MAX_CASES = 512
_MAX_ATTEMPTS = 512
_MAX_EXPECTATIONS = 128
_MAX_JUDGMENTS = 8192
_NEXT_STEPS = {
"met": "No correction indicated by this check.",
"unmet": (
"Compare the recorded evidence with this requirement. If the requirement is valid, inspect the skill or "
"agent execution; if it is inappropriate for this prompt, correct the test. Ownership is not established by the score."
),
"not_checked": "Inspect execution and judge artifacts, then rerun this check before diagnosing a skill defect.",
"unscored": "Inspect the grader configuration and score output; no scored verdict supports a skill defect.",
"not_applicable": "Confirm this check is intentionally inapplicable to this condition; do not count it as a failure.",
}


def _mapping(value: Any) -> dict[str, Any]:
return value if isinstance(value, dict) else {}


def _requirement_text(value: Any) -> str:
# Keep authored whitespace, unlike compact grader reasons.
from skillevaluator.tier3.eval_core.llm_judge import _redact_configured_credentials
from skillevaluator.tier3.eval_core.secret_redaction import redact_secrets_in_log_line
from skillevaluator.utils.redaction import redact_sensitive_text

return redact_sensitive_text(redact_secrets_in_log_line(_redact_configured_credentials(str(value))))


def _requirements(case: dict[str, Any]) -> list[dict[str, Any]]:
requirements = []
for field, fallback, metric in (
("expected_output", "ground_truth", "goal_accuracy"),
("assertions", "expected_behavior", "behavior_check"),
("expected_skill", "expected_skill", "skill_execution"),
("expected_script", "expected_script", "skill_execution"),
):
source = field if field in case else fallback
value = case.get(source)
if field == "expected_skill" and source in case:
text = str(value) if value is not None else "Do not activate the evaluated skill (expected_skill: null)"
requirements.append({"expectation_id": source, "requirement": _requirement_text(text), "metric": metric})
elif field == "assertions" and isinstance(value, list):
for index, text in enumerate(value):
requirements.append(
{
"expectation_id": f"{source}/{index}",
"requirement": str(text),
"metric": metric,
"step": index + 1,
"source_conflict": fallback in case and case[fallback] != value,
}
)
elif value is not None and str(value).strip():
requirements.append(
{
"expectation_id": source,
"requirement": str(value),
"metric": metric,
"source_conflict": fallback in case and case[fallback] != value,
}
)
if metric == "goal_accuracy":
requirements.append(
{
"expectation_id": f"{source}/accuracy",
"requirement": str(value),
"metric": "accuracy",
"source_conflict": fallback in case and case[fallback] != value,
}
)
return requirements


def _judgment(
requirement: dict[str, Any], reward: dict[str, Any], *, ambiguous: bool = False, missing: bool = False
) -> dict[str, Any]:
from skillevaluator.tier3.harbor.metrics import metric_set_for_reward, metric_value

metric = requirement["metric"]
detail = _mapping(_mapping(reward.get("details")).get(metric))
check = detail
if metric == "behavior_check":
results = detail.get("results")
matches = (
[
item
for item in results
if isinstance(item, dict) and type(item.get("step")) is int and item["step"] == requirement.get("step")
]
if isinstance(results, list)
else []
)
check = matches[0] if len(matches) == 1 else {}
elif metric == "skill_execution":
key = (
"script_execution"
if requirement["expectation_id"] == "expected_script"
else ("negative_check" if detail.get("should_trigger") is False else "activation")
)
check = _mapping(detail.get(key))

reason = sanitize_grader_text(check.get("reason") or detail.get("reason") or detail.get("message"), 512)
criteria = _mapping(detail.get("criteria")) if metric == "accuracy" else {}
excluded = detail.get("excluded_criteria")
excluded = excluded if isinstance(excluded, list) else []
applicable_criteria = {key: value for key, value in criteria.items() if key not in excluded}
metric_error = _mapping(reward.get("evaluation_errors")).get(metric)
score = metric_value(reward, metric)
if requirement.get("source_conflict"):
status, reason = (
"not_checked",
"The dataset's current and legacy requirement fields disagree; verify the test input",
)
elif missing:
status, reason = "not_checked", "No retained trial result could be matched to this case"
elif ambiguous:
status, reason = "not_checked", "Multiple reward rows cannot be matched to this requirement unambiguously"
elif reward.get("error"):
status, reason = "not_checked", sanitize_grader_text(reward["error"], 512)
elif detail.get("status") == "error" or metric_error:
status = "not_checked"
reason = sanitize_grader_text(metric_error, 512) or reason or "Judge failed"
elif detail.get("status") == "not_applicable" and score is None:
status = "not_applicable"
elif metric not in metric_set_for_reward(reward)[1] or score is None:
status = "unscored"
reason = reason or "This grader did not record a score for the requirement's metric"
else:
passed = check.get("achieved") if metric == "goal_accuracy" else check.get("passed")
if metric == "accuracy" and applicable_criteria and all(type(v) is bool for v in applicable_criteria.values()):
passed = all(applicable_criteria.values())
if type(passed) is bool:
status = "met" if passed else "unmet"
else:
status = "not_checked"
reason = reason or "No unique explicit verdict was recorded for this expectation"

evidence = []
refs = detail.get("evidence_refs")
if isinstance(refs, list) and status in {"met", "unmet"}:
for ref in refs[:4]:
if not isinstance(ref, dict) or ref.get("kind") in {"expected_behavior", "ground_truth"}:
continue
text = sanitize_grader_text(ref.get("excerpt"), 300)
if text:
evidence.append(text)
return {
"expectation_id": requirement["expectation_id"],
"status": status,
"reason": reason or "No reason recorded",
"evidence": evidence,
"unmet_checks": [sanitize_grader_text(key, 128) for key, value in applicable_criteria.items() if value is False]
if status == "unmet"
else [],
"inapplicable_checks": [sanitize_grader_text(key, 128) for key in excluded[:16]],
"next_step": _NEXT_STEPS[status],
}


def build_case_diagnostics(
dataset: list[dict[str, Any]], agents: dict[str, dict[str, Any]], *, evaluation_mode: str = "both"
) -> tuple[list[dict[str, Any]], dict[str, int]]:
from skillevaluator.tier3.harbor.report_data import logical_trial_reward_groups

condition_trials = []
for agent, info in agents.items():
for condition, key in (("with_skill", "rewards"), ("without_skill", "rewards_baseline")):
if evaluation_mode == "baseline_only" and condition == "with_skill":
continue
if evaluation_mode == "with_skill_only" and condition == "without_skill":
continue
conditions = _mapping(info.get("conditions"))
if _mapping(conditions.get(condition)).get("execution_status") == "skipped":
continue
if not info.get(key) and condition not in conditions:
continue
rows = info.get(key)
groups_by_case: dict[str, list[list[dict[str, Any]]]] = {}
groups = (
logical_trial_reward_groups([row for row in rows if isinstance(row, dict)])
if isinstance(rows, list)
else []
)
for group in groups:
for entry_id in {row["entry_id"] for row in group if isinstance(row.get("entry_id"), str)}:
groups_by_case.setdefault(entry_id, []).append(group)
errors = _mapping(conditions.get(condition)).get("execution_errors")
condition_trials.append((agent, condition, groups_by_case, errors))

omitted: Counter[str] = Counter()
cases = []
attempts_left, judgments_left = _MAX_ATTEMPTS, _MAX_JUDGMENTS
for case in dataset[:_MAX_CASES]:
entry_id = case.get("id")
if not isinstance(entry_id, str) or not entry_id:
continue
requirements = _requirements(case)
omitted["expectations"] += max(0, len(requirements) - _MAX_EXPECTATIONS)
requirements = requirements[:_MAX_EXPECTATIONS]
for requirement in requirements:
requirement["requirement"] = _requirement_text(requirement["requirement"])
attempts = []
for agent, condition, groups_by_case, errors in condition_trials:
for group in groups_by_case.get(entry_id) or [[]]:
if attempts_left <= 0 or judgments_left < len(requirements):
omitted["expectation_attempts"] += 1
continue
attempts_left -= 1
judgments_left -= len(requirements)
reward = group[0] if group else {}
attempts.append(
{
"agent": agent,
"condition": condition,
"trial_id": reward.get("trial_id"),
"errors": [sanitize_grader_text(error, 512) for error in errors[:4]]
if not group and isinstance(errors, list)
else [],
"judge_note": sanitize_grader_text(
_mapping(_mapping(reward.get("details")).get("behavior_check")).get("reason"), 512
),
"judgments": [
_judgment(requirement, reward, ambiguous=len(group) > 1, missing=not group)
for requirement in requirements
],
}
)
cases.append({"entry_id": entry_id, "requirements": requirements, "attempts": attempts})
omitted["expectation_cases"] += max(0, len(dataset) - _MAX_CASES)
return cases, {key: value for key, value in omitted.items() if value}
21 changes: 20 additions & 1 deletion src/skillevaluator/evaluation/tier3_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
TRIAL_PASS_THRESHOLD,
failure_excerpt,
failure_reason,
failure_reason_text_slots,
sanitize_grader_text,
strip_failure_reason_text,
)
Expand Down Expand Up @@ -851,6 +852,11 @@ def build_agent_eval_payload(
for trial in agent.get("trials", []):
trial.pop("score_reasons", None)
public_dataset = deduplicate_dataset_entries([entry for entry in (dataset or []) if isinstance(entry, dict)])
from skillevaluator.evaluation.tier3_expectations import build_case_diagnostics

case_diagnostics, expectation_omissions = build_case_diagnostics(public_dataset, agents, evaluation_mode=mode)
for section, count in expectation_omissions.items():
report_budget.omit(section, count)
computed_dataset_truth = (
build_dataset_snapshot(public_dataset, evaluator_version=evaluator_version or "") if public_dataset else None
)
Expand Down Expand Up @@ -1014,6 +1020,7 @@ def build_agent_eval_payload(
"metric_labels": metric_labels,
"attempt_policy": policy,
"dataset": public_dataset,
"case_diagnostics": case_diagnostics,
"provenance": _build_provenance(
agent_payloads,
agents,
Expand Down Expand Up @@ -1366,7 +1373,19 @@ def refresh_signal() -> None:

# Built failure reasons and excerpts only explain scores the payload already
# carries, so they go before any recorded evidence.
report_budget.omit("failure_reasons", strip_failure_reason_text(payload))
deferred_reasons = [(container, key, container[key]) for container, key in failure_reason_text_slots(payload)]
omitted_reasons = strip_failure_reason_text(payload)
if _serialized_payload_size(payload) > _MAX_EMBEDDED_REPORT_BYTES:
report_budget.omit("case_diagnostics", len(payload.pop("case_diagnostics", [])))
Comment thread
chrisknvidia marked this conversation as resolved.
Resolved
for container, key, value in deferred_reasons:
container[key] = value
refresh_signal()
omitted_reasons = (
strip_failure_reason_text(payload)
if _serialized_payload_size(payload) > _MAX_EMBEDDED_REPORT_BYTES
else 0
)
report_budget.omit("failure_reasons", omitted_reasons)
refresh_signal()
if _serialized_payload_size(payload) <= _MAX_EMBEDDED_REPORT_BYTES:
return
Expand Down
4 changes: 4 additions & 0 deletions src/skillevaluator/reporting/dashboard_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def _trial_coverage_truncated(marker: dict[str, Any]) -> bool:
"custom_metric_discovery_trials",
"non_best_agent_details",
"failure_reasons",
"case_diagnostics",
"expectation_cases",
"expectations",
"expectation_attempts",
}
if not omitted:
return not loading # an unexplained truncation still fails closed
Expand Down
Loading
Loading