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(reporting): publish the same Overall lift in BENCHMARK.md as every other output (#373)
Christopher Kevin8b25e5e0a1c2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c1869093..4e07f305 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -186,6 +186,13 @@ All notable changes to SkillEvaluator are documented in this file.### Fixed+- `BENCHMARK.md` no longer publishes an Overall uplift that disagrees with+ `lift.json` and the JSON, HTML, Markdown and terminal reports when a metric is+ N/A in only one arm. The Overall row now shows the two scores the published+ Skill Lift subtracts, which the canonical report records per agent as+ `lift_overall`, and notes when they differ from the arm overall scores. A+ cross-format test reconciles Overall and lift across every output of one run.+- Tier 3 dataset summaries honor explicit `should_trigger` routing labels beforelegacy `expected_skill` values. Report insights distinguish unavailable trialscores from scored attempts that miss the pass threshold. Dataset snapshotsdiff --git a/docs/reports.mdx b/docs/reports.mdxindex 505cef7e..18507801 100644--- a/docs/reports.mdx+++ b/docs/reports.mdx@@ -667,7 +667,7 @@ arm overall scores.### Skill Lift-Skill Lift compares Overall on the metrics and cases both arms scored, so it can differ from the displayed with-skill Overall minus baseline Overall when the baseline has N/A dimensions. It uses the same score units as both arms and ranges from+Skill Lift compares Overall on the metrics and cases both arms scored, so it can differ from subtracting the displayed Overall scores. It uses the same score units as both arms and ranges from-1.0 to +1.0. Because live agent runs are noisy, especially at low attemptcounts, small deltas are kept neutral. The verdict bands:diff --git a/src/skillevaluator/evaluation/tier3_report.py b/src/skillevaluator/evaluation/tier3_report.pyindex 300ab9e7..a49f76c8 100644--- a/src/skillevaluator/evaluation/tier3_report.py+++ b/src/skillevaluator/evaluation/tier3_report.py@@ -2086,6 +2086,7 @@ def _build_agent(overall_lift = _lift_value("overall", judge_lift) if comparable_scores else Noneif comparison_unavailable:overall_lift = None+ lift_overall = _lift_overall_scores(overall_lift, judge_lift, overall_ws, overall_bl)trials = _normalize_trials(info.get("rewards") or [], with_metrics)baseline_trials = _normalize_trials(info.get("rewards_baseline") or [], baseline_metrics)@@ -2137,6 +2138,7 @@ def _build_agent("with_skill": overall_ws,"baseline": overall_bl,"lift": overall_lift,+ "lift_overall": lift_overall,"metrics_with_skill": with_metrics,"metrics_without_skill": baseline_metrics,"num_trials": int(info.get("num_trials", 0) or 0),@@ -3879,6 +3881,36 @@ def _precomputed_score(precomputed: dict[str, Any], dim_id: str) -> float | Nonereturn None+def _lift_overall_scores(+ overall_lift: float | None,+ judge_lift: dict[str, Any] | None,+ overall_ws: float | None,+ overall_bl: float | None,+) -> dict[str, float] | None:+ """Return the two overall scores that the published overall lift subtracts.++ When a metric is N/A in one arm it drops out of both arms for lift, so these+ scores can differ from the arm overall scores.+ """+ if overall_lift is None:+ return None+ entry = judge_lift.get("overall") if isinstance(judge_lift, dict) else None+ candidates = []+ if isinstance(entry, dict):+ candidates.append(+ (_unit_interval_score(entry.get("with_skill")), _unit_interval_score(entry.get("without_skill")))+ )+ candidates.append((overall_ws, overall_bl))+ for with_score, baseline_score in candidates:+ if (+ with_score is not None+ and baseline_score is not None+ and abs((with_score - baseline_score) - overall_lift) <= 1e-4 + 1e-9+ ):+ return {"with_skill": round(with_score, 4), "baseline": round(baseline_score, 4)}+ return None++def _lift_value(metric: str, lift_data: dict[str, Any]) -> float | None:entry = lift_data.get(metric)if isinstance(entry, dict):diff --git a/src/skillevaluator/reporting/benchmark.py b/src/skillevaluator/reporting/benchmark.pyindex f5e6618a..bf91ce09 100644--- a/src/skillevaluator/reporting/benchmark.py+++ b/src/skillevaluator/reporting/benchmark.py@@ -467,14 +467,40 @@ class BenchmarkReporter(ReporterBase):lines.append("|---|" + "|".join(["---:"] * len(agents)) + "|")overall_row = ["Overall"]- overall_row.extend(- _score_transition_values(- agent.get("baseline"),- agent.get("with_skill", agent.get("overall_score")),- skill_never_activated=_mapping(agent.get("skill_activation")).get("status") == "never_activated",+ shared_basis_agents: dict[tuple[str, ...], list[str]] = {}+ for name, agent in agents.items():+ with_skill = agent.get("with_skill", agent.get("overall_score"))+ baseline = agent.get("baseline")+ lift_overall = _mapping(agent.get("lift_overall"))+ if (+ _number(lift_overall.get("with_skill")) is not None+ and _number(lift_overall.get("baseline")) is not None+ ):+ # Show the scores the published lift subtracts so the row matches it.+ if _number(lift_overall["with_skill"]) != _number(with_skill) or _number(+ lift_overall["baseline"]+ ) != _number(baseline):+ basis = _mapping(agent.get("lift_basis"))+ excluded_metrics = basis.get("excluded_metrics")+ excluded_cases = basis.get("excluded_cases")+ causes = []+ if isinstance(excluded_metrics, list) and any(+ _mapping(item).get("reason") == "not_applicable" for item in excluded_metrics+ ):+ causes.append("dimensions only one arm scored")+ if isinstance(excluded_cases, list) and any(+ _mapping(item).get("reason") == "judge_mixed" for item in excluded_cases+ ):+ causes.append("cases judged by different models")+ shared_basis_agents.setdefault(tuple(causes), []).append(name)+ with_skill, baseline = lift_overall["with_skill"], lift_overall["baseline"]+ overall_row.append(+ _score_transition_values(+ baseline,+ with_skill,+ skill_never_activated=_mapping(agent.get("skill_activation")).get("status") == "never_activated",+ ))- for agent in agents.values()- )lines.append("| " + " | ".join(_md_cell(value, private_labels) for value in overall_row) + " |")has_partial = False@@ -511,6 +537,35 @@ class BenchmarkReporter(ReporterBase):"",])+ if shared_basis_agents:+ for causes, names in shared_basis_agents.items():+ if causes == ("dimensions only one arm scored",):+ explanation = (+ "compares only the dimensions both arms scored, matching the published Skill Lift; "+ "the detailed report's Overall scores can also include dimensions only one arm scored"+ )+ elif causes == ("cases judged by different models",):+ explanation = (+ "compares cases judged by the same model in both arms, matching the published Skill Lift; "+ "the detailed report's Overall scores can include cases judged by different models"+ )+ elif causes:+ explanation = (+ "uses the dimensions both arms scored and cases judged by the same model, matching the "+ "published Skill Lift; the detailed report's Overall scores can include other dimensions "+ "or cases"+ )+ else:+ explanation = (+ "uses the shared comparison basis for the published Skill Lift; the detailed report's "+ "arm Overall scores can differ"+ )+ lines.extend(+ [+ _md_cell("Overall for " + ", ".join(names) + " " + explanation + ".", private_labels),+ "",+ ]+ )if has_partial:lines.extend([diff --git a/tests/test_overall_cross_format_consistency.py b/tests/test_overall_cross_format_consistency.pynew file mode 100644index 00000000..6d90cde8--- /dev/null+++ b/tests/test_overall_cross_format_consistency.py@@ -0,0 +1,248 @@+"""One run publishes one Overall score and one Skill Lift in every output format."""++from __future__ import annotations++import json+import re+from pathlib import Path++import pytest++from skillevaluator.evaluation.tier3_report import _lift_overall_scores, agent_eval_result_from_directory+from skillevaluator.reporting import HTMLReporter, JSONReporter+from skillevaluator.reporting.benchmark import BenchmarkReporter+from skillevaluator.reporting.markdown import MarkdownReporter+from skillevaluator.tier3.harbor.collector import collect_harbor_results+from skillevaluator.tier3.harbor.metrics import DEFAULT_METRIC_SET, DEFAULT_METRICS, DEFAULT_SCORE_POLICY+from skillevaluator.tier3.result_display import render_result++SKILL_METRICS = ("skill_execution", "skill_efficiency")+WITH_SKILL = {**dict.fromkeys(DEFAULT_METRICS, 0.5), "goal_accuracy": 1.0, "behavior_check": 1.0}+BASELINE = {**dict.fromkeys(DEFAULT_METRICS, 0.85), "goal_accuracy": 0.0, "behavior_check": 0.0}+++def _write(path: Path, payload: dict) -> None:+ path.parent.mkdir(parents=True, exist_ok=True)+ path.write_text(json.dumps(payload), encoding="utf-8")+++def _job(+ job_dir: Path,+ scores: dict[str, float],+ cases: int,+ not_applicable: tuple[str, ...] = (),+ *,+ judge_by_case: dict[str, str] | None = None,+ scores_by_case: dict[str, dict[str, float]] | None = None,+ activated: bool = True,+) -> None:+ trials = []+ for index in range(1, cases + 1):+ trial = f"case-{index}__trial"+ trials.append(trial)+ reward = {**scores, **(scores_by_case or {}).get(f"case-{index}", {})}+ details: dict[str, dict] = {}+ for metric in not_applicable:+ reward[metric] = None+ details[metric] = {"score": None, "status": "not_applicable", "reason": "no skill under test"}+ if "skill_execution" not in not_applicable:+ details["skill_execution"] = {"activation": {"passed": activated, "score": float(activated)}}+ if judge := (judge_by_case or {}).get(f"case-{index}"):+ for metric in ("accuracy", "goal_accuracy", "behavior_check"):+ details.setdefault(metric, {})["judge_model_used"] = judge+ reward.update(+ entry_id=f"case-{index}",+ metric_set=DEFAULT_METRIC_SET,+ score_policy=DEFAULT_SCORE_POLICY,+ details=details,+ )+ _write(job_dir / trial / "verifier" / "reward.json", reward)+ stats = {+ "n_completed_trials": cases,+ "n_errored_trials": 0,+ "n_running_trials": 0,+ "n_pending_trials": 0,+ "n_cancelled_trials": 0,+ "n_retries": 0,+ "evals": {+ "agent__model___tasks": {+ "n_trials": cases,+ "n_errors": 0,+ "reward_stats": {"overall": {"0.5": trials}},+ }+ },+ }+ _write(job_dir / "result.json", {"n_total_trials": cases, "stats": stats})+++def _publish(+ tmp_path: Path,+ baseline_not_applicable: tuple[str, ...],+ *,+ judge_fallback: bool = False,+ never_activated: bool = False,+) -> dict:+ skill = tmp_path / "demo"+ skill.mkdir()+ (skill / "SKILL.md").write_text("---\nname: demo\ndescription: Demo skill.\n---\nBody.\n", encoding="utf-8")+ jobs = tmp_path / "jobs"+ judges_with = {"case-1": "judge-a", "case-2": "judge-a"}+ judges_without = {"case-1": "judge-a", "case-2": "judge-b" if judge_fallback else "judge-a"}+ _job(+ jobs / "demo-codex-with",+ WITH_SKILL,+ 2,+ judge_by_case=judges_with,+ activated=not never_activated,+ )+ _job(+ jobs / "demo-codex-without",+ BASELINE,+ 2,+ baseline_not_applicable,+ judge_by_case=judges_without,+ scores_by_case={"case-2": {"accuracy": 0.0, "goal_accuracy": 1.0, "behavior_check": 1.0}}+ if judge_fallback+ else None,+ )+ run = tmp_path / "results" / "20261106_120000"+ collected = collect_harbor_results(+ "demo", ["codex"], run, jobs, expected_case_ids=["case-1", "case-2"], expected_trials=2+ )+ lift_path = run / "codex" / "lift.json"+ if never_activated:+ lift_path.unlink(missing_ok=True)+ result = agent_eval_result_from_directory(skill, run, use_llm_judge=False)+ return {+ "collected": collected,+ "summaries": {+ arm: json.loads((run / "codex" / arm / "summary.json").read_text(encoding="utf-8"))+ for arm in ("with-skill", "without-skill")+ },+ "lift_json": json.loads(lift_path.read_text(encoding="utf-8")) if lift_path.exists() else None,+ "agent_eval": result.metadata["agent_eval"],+ "json": json.loads(JSONReporter().render_all([result])),+ "html": HTMLReporter(include_timestamp=False).render_all([result]),+ "markdown": MarkdownReporter().render_all([result]),+ "benchmark": BenchmarkReporter(skill_name="demo", report_scope="tier3").render_all([result]),+ "terminal": render_result(collected),+ }+++def _json_values(payload: object, key: str) -> list[object]:+ found: list[object] = []+ if isinstance(payload, dict):+ for name, value in payload.items():+ if name == key:+ found.append(value)+ found.extend(_json_values(value, key))+ elif isinstance(payload, list):+ for value in payload:+ found.extend(_json_values(value, key))+ return found+++def test_lift_overall_scores_accepts_independent_rounding() -> None:+ assert _lift_overall_scores(+ 0.3333,+ {"overall": {"with_skill": 0.6667, "without_skill": 0.3333}},+ 0.6,+ 0.3333,+ ) == {"with_skill": 0.6667, "baseline": 0.3333}+++ (+ "scenario",+ "baseline_not_applicable",+ "with_overall",+ "baseline_overall",+ "lift_pair",+ "lift",+ "benchmark_row",+ ),+ [+ # A six-metric mean would give 0.667 vs 0.567 (+0.10, a passing lift); the+ # five-dimension policy reverses its sign to a failing -0.08.+ ("five-dimension-reverses-six-metric-lift", (), 0.6, 0.68, (0.6, 0.68), -0.08, "68.0% → 60.0% (-8.0 points)"),+ # The baseline has no skill under test, so Discoverability and Efficiency+ # drop out of both arms for lift but stay in the with-skill arm score.+ (+ "baseline-skill-metrics-not-applicable",+ SKILL_METRICS,+ 0.6,+ 0.5667,+ (0.6667, 0.5667),+ 0.1,+ "56.7% → 66.7% (+10.0 points)",+ ),+ ("judge-fallback", (), None, None, None, None, None),+ ("never-activated", (), None, None, None, None, None),+ ],+)+def test_every_output_publishes_one_overall_and_lift(+ tmp_path: Path,+ scenario: str,+ baseline_not_applicable: tuple[str, ...],+ with_overall: float | None,+ baseline_overall: float | None,+ lift_pair: tuple[float, float] | None,+ lift: float | None,+ benchmark_row: str | None,+) -> None:+ out = _publish(+ tmp_path,+ baseline_not_applicable,+ judge_fallback=scenario == "judge-fallback",+ never_activated=scenario == "never-activated",+ )++ for summary in out["summaries"].values():+ assert summary["score_policy"] == DEFAULT_SCORE_POLICY++ recorded = out["lift_json"]["overall"] if out["lift_json"] is not None else None+ if recorded is not None:+ assert out["collected"]["agents"]["codex"]["lift"]["overall"] == recorded++ agent_eval = out["agent_eval"]+ agent = agent_eval["agents"]["codex"]+ if scenario == "judge-fallback":+ excluded_cases = agent["lift_basis"]["excluded_cases"]+ assert any(entry["case"] == "case-2" and entry["reason"] == "judge_mixed" for entry in excluded_cases)+ assert agent["lift_overall"] is not None+ assert "cases judged by the same model in both arms" in out["benchmark"]+ assert "cases judged by different models" in out["benchmark"]+ return+ if scenario == "never-activated":+ assert out["lift_json"] is None+ assert agent["lift"] is agent["lift_overall"] is None+ overall_row = next(line for line in out["benchmark"].splitlines() if line.startswith("| Overall |"))+ assert "INCONCLUSIVE: skill never activated" in overall_row+ assert "uplift unavailable" in overall_row+ assert "→" not in overall_row+ return+ assert with_overall is not None and baseline_overall is not None and lift_pair is not None+ assert lift is not None and benchmark_row is not None+ assert recorded is not None+ assert out["summaries"]["with-skill"]["overall_score"] == pytest.approx(with_overall, abs=1e-4)+ assert out["summaries"]["without-skill"]["overall_score"] == pytest.approx(baseline_overall, abs=1e-4)+ assert (recorded["with_skill"], recorded["without_skill"]) == pytest.approx(lift_pair, abs=1e-4)+ assert recorded["delta"] == pytest.approx(lift, abs=1e-4)+ assert agent_eval["score_policy"] == DEFAULT_SCORE_POLICY+ assert (agent["with_skill"], agent["baseline"]) == pytest.approx((with_overall, baseline_overall), abs=1e-4)+ assert agent["lift"] == agent_eval["overall_lift"] == agent_eval["composite_lift"] == pytest.approx(lift)+ assert (agent["lift_overall"]["with_skill"], agent["lift_overall"]["baseline"]) == pytest.approx(lift_pair)++ json_lifts = _json_values(out["json"], "overall_lift")+ assert json_lifts+ assert json_lifts == pytest.approx([lift] * len(json_lifts))+ assert set(_json_values(out["json"], "score_policy")) == {DEFAULT_SCORE_POLICY}+ assert f"composite lift = {lift:+.2f}" in out["markdown"]+ assert f"| Overall | {benchmark_row} |" in out["benchmark"]+ assert re.search(rf"OVERALL SKILL LIFT\s+{re.escape(f'{lift:+.2f}')}", out["terminal"])+ assert re.search(+ rf"quality score \(0-1\)\s+{lift_pair[0]:.2f}\s+{lift_pair[1]:.2f}\s+{re.escape(f'{lift:+.2f}')}",+ out["terminal"],+ )+ assert f"Skill Lift {lift:+.2f}" in re.sub(r"\s+", " ", re.sub(r"<[^>]+>", " ", out["html"]))+ assert ("compares only the dimensions both arms scored" in out["benchmark"]) is bool(baseline_not_applicable)