From 4b9a6f45599b3c81d580b4d3fac96188ea8c3dd0 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Thu, 22 Oct 2026 00:03:38 -0700 Subject: [PATCH 1/3] fix(reporting): show completed agent results in scoped Tier 3 reports Signed-off-by: Christopher Kevin --- CHANGELOG.md | 5 + src/skillevaluator/evaluation/tier3_report.py | 21 +- src/skillevaluator/reporting/benchmark.py | 36 +++- src/skillevaluator/reporting/html.py | 13 +- .../reporting/templates/report.html.j2 | 32 ++- src/skillevaluator/reporting/tier3_scope.py | 129 ++++++++++++ src/skillevaluator/tier3/harbor/runner.py | 7 + tests/reporting/test_tier3_scoped_reports.py | 183 ++++++++++++++++++ 8 files changed, 410 insertions(+), 16 deletions(-) create mode 100644 src/skillevaluator/reporting/tier3_scope.py create mode 100644 tests/reporting/test_tier3_scoped_reports.py diff --git a/CHANGELOG.md b/CHANGELOG.md index b5915ee3d..c63e4ad1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,6 +154,11 @@ All notable changes to SkillEvaluator are documented in this file. direct-target behavior, plugin discovery errors produce findings, and reports and external Tier 3 results preserve catalog-relative paths for skills with the same basename. +- Standalone Tier 3 runs now emit the standard `BENCHMARK.md` alongside HTML, + explicitly separate the Tier 3 result from an unassessed publication decision, + and display a completed agent's score and comparable lift when another agent + fails. Failure warnings and the full publication checks remain unchanged. + - Changing finding severities through a policy no longer clears an independent quality-score threshold failure. A score below `--min-score` still fails, and its reason appears in the terminal, HTML, benchmark, and JSON reports. diff --git a/src/skillevaluator/evaluation/tier3_report.py b/src/skillevaluator/evaluation/tier3_report.py index 43b1c2ab0..bb6990773 100644 --- a/src/skillevaluator/evaluation/tier3_report.py +++ b/src/skillevaluator/evaluation/tier3_report.py @@ -581,9 +581,10 @@ def render_agent_eval_html_report( env_mode: str | None = None, engine_result: dict[str, Any] | None = None, use_llm_judge: bool = True, + include_benchmark: bool = False, ) -> Path: - """Render one standalone Tier 3 run with the canonical HTML reporter.""" - from skillevaluator.reporting import HTMLReporter + """Render a standalone Tier 3 HTML report and optional standard benchmark.""" + from skillevaluator.reporting import BenchmarkReporter, HTMLReporter skill_path = skill_path.expanduser().resolve() run_dir = run_dir.expanduser().resolve() @@ -613,12 +614,26 @@ def render_agent_eval_html_report( reporter = HTMLReporter( target_path=str(skill_path), content_label="Skill", + report_scope="tier3", tabs=[{"id": "tier3", "label": "Tier 3: Live Agent Evaluation"}], # The run records the filesystem entry name, which a lexical alias # on a case- or normalization-insensitive filesystem need not match. expected_skill_name=publication_target_name(skill_path) or skill_path.name, ) - reporter.save([result], target) + written: list[Path] = [] + try: + reporter.save([result], target) + written.append(target) + if include_benchmark: + BenchmarkReporter( + skill_name=publication_target_name(skill_path) or skill_path.name, report_scope="tier3" + ).save([result], target.with_name("BENCHMARK.md")) + except Exception: + # Do not advertise half of a newly generated report pair. An unsafe + # destination that the writer rejected is never followed or removed. + for path in written: + path.unlink(missing_ok=True) + raise return target diff --git a/src/skillevaluator/reporting/benchmark.py b/src/skillevaluator/reporting/benchmark.py index 941b64530..0c2f97050 100644 --- a/src/skillevaluator/reporting/benchmark.py +++ b/src/skillevaluator/reporting/benchmark.py @@ -49,6 +49,7 @@ tier1_unscanned_publication_paths, unrecognized_tier2_results, ) +from skillevaluator.reporting.tier3_scope import completed_agent_result, validate_report_scope from skillevaluator.source_identity import evaluated_source_revision, recorded_evaluated_source from skillevaluator.tier3_environments import HARBOR_ENV_MODES @@ -130,9 +131,12 @@ def __init__( include_timestamp: bool = True, max_findings_shown: int = 5, skill_name: str | None = None, + report_scope: str = "publication", ) -> None: self.include_timestamp = include_timestamp self.max_findings_shown = max_findings_shown + validate_report_scope(report_scope, []) + self.report_scope = report_scope self.skill_name = skill_name @property @@ -147,7 +151,9 @@ def render(self, result: ValidationResult) -> str: return self.render_all([result]) def render_all(self, results: list[ValidationResult]) -> str: + validate_report_scope(self.report_scope, results) ae = _agent_eval_payload(results) + completed = completed_agent_result(ae) publication_target = publication_target_for_results( results, ae, @@ -165,10 +171,16 @@ def render_all(self, results: list[ValidationResult]) -> str: lines: list[str] = [ f"# Skill Benchmark: {skill_name}", "", - _verdict_callout(status), + (f"> **Tier 3 completed-agent result: {completed['verdict'].upper()}**" if completed + else "> **Tier 3: No complete agent result**") if self.report_scope == "tier3" else _verdict_callout(status), "", ] - if status == "PASS": + if self.report_scope == "tier3": + lines.extend([ + "Publication: **NOT ASSESSED**. This report covers Tier 3 only; Tiers 1 and 2 were not requested.", + "The verdict describes with-skill quality; lift is a separate baseline comparison.", "", + ]) + elif status == "PASS": self._render_publication_recommendation(lines, results) elif status == "FAIL": lines.extend( @@ -201,6 +213,18 @@ def render_all(self, results: list[ValidationResult]) -> str: ] ) + if completed and (self.report_scope == "tier3" or completed["needs_attention"]): + lines.append( + f"Completed agent: **{_publication_safe_inline(completed['name'], private_labels)}**; " + f"score **{completed['score']:.4f}** ({completed['score'] * 100:.2f}%)." + ) + if completed["lift"] is not None: + lines.append(f"Same-agent comparable lift: **{completed['lift']:+.4f}** ({completed['lift'] * 100:+.2f} percentage points).") + if completed["needs_attention"]: + lines.append("**Needs attention:** other execution failures remain. This completed-agent result does not certify the whole run.") + if completed["recovered_attempts"]: + lines.append(f"Recovered timeout attempts: {completed['recovered_attempts']}; failed history is retained and excluded from scoring.") + lines.append("") self._render_metadata( lines, results, @@ -516,6 +540,14 @@ def _render_tier_status( expected_skill_name=expected_skill_name, expected_publication_target=publication_target, ) + if self.report_scope == "tier3": + if tier != "Tier 3": + status, evidence = "NOT REQUESTED", "Outside this report's Tier 3 scope" + elif completed := completed_agent_result(ae): + status = completed["verdict"].upper() + evidence = "Completed-agent quality result; publication not assessed" + if completed["needs_attention"]: + evidence += "; other execution failures need attention" lines.append(f"| {tier} | {purpose} | **{status}** | {_md_cell(evidence, private_labels)} |") lines.append("") diff --git a/src/skillevaluator/reporting/html.py b/src/skillevaluator/reporting/html.py index a96da6b32..25193f543 100644 --- a/src/skillevaluator/reporting/html.py +++ b/src/skillevaluator/reporting/html.py @@ -71,6 +71,7 @@ ) from skillevaluator.reporting.harbor_viewer import normalize_agent_eval_harbor_links from skillevaluator.reporting.presentation import success_is_not_applicable +from skillevaluator.reporting.tier3_scope import completed_agent_result, validate_report_scope if TYPE_CHECKING: from skillevaluator.models import ValidationResult @@ -1355,6 +1356,7 @@ def __init__( expected_skill_name: str | None = None, explicit_skill_name: str | None = None, ci_context: dict[str, str] | None = None, + report_scope: str = "publication", ) -> None: self.include_timestamp = include_timestamp self.title = title or "SkillEvaluator Validation Report" @@ -1366,6 +1368,8 @@ def __init__( # in the report header so reviewers can tell which audience the # validation gate was applied for. self.profile = profile + validate_report_scope(report_scope, []) + self.report_scope = report_scope self.expected_skill_name = expected_skill_name self.explicit_skill_name = explicit_skill_name self.ci_context = _validated_ci_context(ci_context) @@ -2480,8 +2484,10 @@ def render(self, result: ValidationResult) -> str: return self.render_all([result]) def render_all(self, results: list[ValidationResult]) -> str: + validate_report_scope(self.report_scope, results) tier1_results, tier2_results, tier3_results = self._split_results_by_tier(results) tier3_data = self._tier3_report_data(tier3_results) + completed_agent = completed_agent_result(tier3_data) # Preserve the raw policy/provenance assessment, then let the emitted # payload make the decision only more conservative. Display shaping # must never invent a successful run or erase a persisted waiver. @@ -2783,6 +2789,8 @@ def _attach_quality_scores(skills: dict[str, dict[str, Any]]) -> None: template = self._env.get_template("report.html.j2") cl = self.content_label return template.render( + report_scope=self.report_scope, + completed_agent=completed_agent, title=self.title, ci_context=self.ci_context, explicit_skill_name=self.explicit_skill_name, @@ -2801,7 +2809,10 @@ def _attach_quality_scores(skills: dict[str, dict[str, Any]]) -> None: overall_status=overall_status, publication_status=publication.status, publication_reasons=publication.reasons, - tier3_effective_status=publication.tier3.status, + tier3_effective_status=( + completed_agent["verdict"] if self.report_scope == "tier3" and completed_agent + else publication.tier3.status + ), total_validators=total_validators, executed_count=executed_count, passed_count=passed_count, diff --git a/src/skillevaluator/reporting/templates/report.html.j2 b/src/skillevaluator/reporting/templates/report.html.j2 index 9ab3f5de7..a692bf544 100644 --- a/src/skillevaluator/reporting/templates/report.html.j2 +++ b/src/skillevaluator/reporting/templates/report.html.j2 @@ -1266,11 +1266,15 @@ {% endif %} Process: {{ 'Incomplete' if has_incomplete else ('All Passed' if all_passed else 'Issues Found') }} + {% if report_scope == 'tier3' %} + Publication: Not assessed (Tier 3 only) + {% else %} Publication: {{ publication_status | title }} + {% endif %} @@ -1291,7 +1295,7 @@ title — every step is opportunistic so the hero never goes blank. -#} {% set hero_title = explicit_skill_name | default(none) or friendly_label or (tier3.skill_name if has_tier3 and tier3.skill_name else (target_display or title)) %} - {% set hero_score = tier3.overall_score if has_tier3 and tier3.overall_score is not none else none %} + {% set hero_score = completed_agent.score if completed_agent else (tier3.overall_score if has_tier3 and tier3.overall_score is not none else none) %} {% set hero_trials = ((tier3.trials or []) | length) if has_tier3 else 0 %} {% set hero_metric_count = ((tier3.metric_ids or tier3.evaluators or {}) | length) if has_tier3 else 0 %} {% set hero_harbor = (tier3.get('harbor_viewer') or tier3.get('summary', {}).get('harbor_viewer') or {}) if has_tier3 else {} %} @@ -1337,10 +1341,12 @@
{{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }}
Best performing agent: {{ tier3.best_agent or 'N/A' }}
+ {% if completed_agent and completed_agent.needs_attention %}
Completed-agent result. Other execution failures need attention; see agent details.
{% endif %} + {% if completed_agent and completed_agent.recovered_attempts %}
{{ completed_agent.recovered_attempts }} timeout attempt(s) recovered; failed history retained.
{% endif %}
Trials: {{ hero_trials }} across {{ (tier3.agents_run or []) | length }} agent(s)
Metrics: {{ hero_metric_count }} evaluators
{% if tier3_environment %}
Environment: {{ tier3_environment }}
{% endif %} - {% if tier3.get('overall_lift') is not none %}
Overall lift: {{ "%+.2f" | format(tier3.get('overall_lift')) }}
{% endif %} + {% if tier3.get('overall_lift') is not none %}
Best-agent lift: {{ "%+.2f" | format(tier3.get('overall_lift')) }}
{% endif %}
{% endif %} @@ -1429,7 +1435,7 @@ {% endif %} {% if has_tier3 %} {% set tier3_display_verdict = 'SKIPPED' if tier3_is_skipped else tier3_verdict | upper %} - {% set t3_class = 'skipped' if tier3_is_skipped else ('pass' if tier3_verdict == 'pass' else ('fail' if tier3_verdict == 'fail' else 'warn')) %} + {% set t3_class = 'skipped' if tier3_is_skipped else ('warn' if completed_agent and completed_agent.needs_attention else ('pass' if tier3_verdict == 'pass' else ('fail' if tier3_verdict == 'fail' else 'warn'))) %}
Tier 3 - {{ tier3_display_verdict }} + {{ tier3_display_verdict }}{% if report_scope == 'tier3' and completed_agent %} · Quality{% if completed_agent.needs_attention %}; needs attention{% endif %}{% endif %}

Live Agent Evaluation

{% if tier3_is_skipped %} {{ tier3_skip_message }} {% else %} - score {{ "%.2f" | format(tier3.overall_score) if tier3.overall_score is not none else "N/A" }} + score {{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }} {% if tier3.get('overall_lift') is not none %}lift {{ "%+.2f" | format(tier3.get('overall_lift')) }}{% endif %} {% if hero_trials %}{{ hero_trials }} trial(s){% endif %} {% endif %} @@ -2392,12 +2398,18 @@ Inconclusive: skill never activated. Scores are diagnostic only; no lift verdict was computed. Check skill loading and agent support, then rerun the evaluation. {% else %} + {% if completed_agent and completed_agent.needs_attention %} + Completed-agent result: {{ completed_agent.verdict | upper }}. + {{ completed_agent.name }} scored {{ "%.2f" | format(completed_agent.score) }}. + Other execution failures need attention. This is not a whole-run or publication PASS. + {% else %} Verdict at a glance: {{ tier3_verdict | upper }} with an overall score of - {{ "%.2f" | format(tier3.overall_score) if tier3.overall_score is not none else "N/A" }}. + {{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }}. {% if t3_best_name %}Best performing agent is {{ t3_best_name }}{% else %}No successfully scored agent is available{% endif %} {% if tier3.get('overall_lift') is not none %} with {{ "%+.2f" | format(tier3.get('overall_lift')) }} skill lift{% endif %}. {% endif %} + {% endif %}
{% if t3_harbor_job_url or t3_harbor_analysis_url %}
@@ -2413,13 +2425,13 @@ {% endif %}
-

Verdict

+

{{ 'Quality Verdict' if report_scope == 'tier3' and completed_agent else 'Verdict' }}

{{ 'SKIPPED' if tier3_is_skipped else tier3_verdict | upper }}

-

Evaluation outcome

+

{{ 'Completed-agent quality; lift shown separately' if report_scope == 'tier3' and completed_agent else 'Evaluation outcome' }}

-

Overall Score

-

{{ "%.2f" | format(tier3.overall_score) if tier3.overall_score is not none else "N/A" }}

+

{{ 'Completed Agent Score' if completed_agent and completed_agent.needs_attention else 'Overall Score' }}

+

{{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }}

Best run across evaluated dimensions

diff --git a/src/skillevaluator/reporting/tier3_scope.py b/src/skillevaluator/reporting/tier3_scope.py new file mode 100644 index 000000000..6a97c9a9b --- /dev/null +++ b/src/skillevaluator/reporting/tier3_scope.py @@ -0,0 +1,129 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +"""Display completed-agent evidence separately from the publication decision.""" + +from __future__ import annotations + +import math +from typing import Any + + +def validate_report_scope(scope: str, results: list) -> None: + if scope not in {"publication", "tier3"}: + raise ValueError("report_scope must be publication or tier3") + if scope == "tier3" and any(result.validator_name != "AGENT_EVAL" for result in results): + raise ValueError("Tier 3 report scope cannot hide results from other tiers") + + +def completed_agent_result(payload: dict[str, Any] | None) -> dict[str, Any] | None: + """Return a display-only summary of the canonical best completed agent. + + This never changes the payload, execution status, or publication assessment. + Do not fill gaps using another agent, incompatible metric sets, or failed trials. + """ + if not isinstance(payload, dict): + return None + agents = payload.get("agents") + name = payload.get("best_agent") + if not isinstance(agents, dict) or not isinstance(name, str): + return None + agent = agents.get(name) + if not isinstance(agent, dict) or agent.get("execution_status") != "succeeded": + return None + if agent.get("execution_errors") or agent.get("execution_error_details_total"): + return None + score = agent.get("with_skill") + if ( + isinstance(score, bool) + or not isinstance(score, (int, float)) + or not math.isfinite(score) + or not 0 <= score <= 1 + ): + return None + expected, scored = agent.get("expected_attempts"), agent.get("scored_attempts") + if type(expected) is not int or type(scored) is not int or expected <= 0 or expected != scored: + return None + conditions = agent.get("conditions") + if not isinstance(conditions, dict) or set(conditions) not in ({"with_skill"}, {"with_skill", "without_skill"}): + return None + if "without_skill" not in conditions: + # A standalone --skip-baseline run writes only the with-skill summary. + # Permit its completed score, but never manufacture a baseline or lift. + conditions = { + **conditions, + "without_skill": { + "execution_status": "skipped", + "execution_errors": [], + "expected_attempts": 0, + "scored_attempts": 0, + }, + } + for arm, condition in conditions.items(): + if ( + not isinstance(condition, dict) + or condition.get("execution_errors") + or condition.get("execution_error_details_total") + ): + return None + n, actual = condition.get("expected_attempts"), condition.get("scored_attempts") + if type(n) is not int or type(actual) is not int or n != actual: + return None + if arm == "without_skill" and condition.get("execution_status") == "skipped" and n == 0: + continue + if condition.get("execution_status") != "succeeded" or n <= 0: + return None + if sum(c["scored_attempts"] for c in conditions.values()) != scored: + return None + baseline, lift = agent.get("baseline"), agent.get("lift") + comparable = ( + conditions["without_skill"].get("execution_status") == "succeeded" + and bool(agent.get("metrics_with_skill")) + and agent.get("metrics_with_skill") == agent.get("metrics_without_skill") + ) + if ( + not comparable + or isinstance(baseline, bool) + or not isinstance(baseline, (int, float)) + or not math.isfinite(baseline) + or not 0 <= baseline <= 1 + ): + baseline, lift = None, None + if isinstance(lift, bool) or not isinstance(lift, (int, float)) or not math.isfinite(lift) or not -1 <= lift <= 1: + lift = None + from skillevaluator.reporting.base import ( + _agent_eval_condition_attempt_coverage_complete, + _agent_eval_dataset_count, + ) + + policy = payload.get("attempt_policy") + if not isinstance(policy, dict): + return None + max_attempts, stop_on_pass = policy.get("max_attempts"), policy.get("stop_on_pass") + cases = _agent_eval_dataset_count(payload) + if type(max_attempts) is not int or max_attempts <= 0 or type(stop_on_pass) is not bool or cases <= 0: + return None + if not _agent_eval_condition_attempt_coverage_complete( + {**agent, "conditions": conditions}, + expected_attempts=expected, + scored_attempts=scored, + dataset_tasks=cases, + max_attempts=max_attempts, + stop_on_pass=stop_on_pass, + require_baseline=False, + ): + return None + from skillevaluator.evaluation.tier3_report import _agent_quality_verdict + + return { + "name": name, + "score": score, + "baseline": baseline, + "lift": lift, + "verdict": _agent_quality_verdict(agent), + "needs_attention": payload.get("execution_status") != "succeeded", + "recovered_attempts": sum( + c.get("recovered_attempts_total", 0) + for c in conditions.values() + if type(c.get("recovered_attempts_total", 0)) is int and c.get("recovered_attempts_total", 0) >= 0 + ), + } diff --git a/src/skillevaluator/tier3/harbor/runner.py b/src/skillevaluator/tier3/harbor/runner.py index 6011cb843..016df1d6b 100644 --- a/src/skillevaluator/tier3/harbor/runner.py +++ b/src/skillevaluator/tier3/harbor/runner.py @@ -5549,6 +5549,7 @@ def _render_current_report() -> tuple[Path | None, str | None]: run_dir, env_mode=env_mode, engine_result=results, + include_benchmark=True, ) if candidate.is_file(): return candidate, None @@ -5562,6 +5563,8 @@ def _render_current_report() -> tuple[Path | None, str | None]: report_path, report_warning = _render_current_report() if report_path is not None: results["report_path"] = str(report_path) + if report_path.with_name("BENCHMARK.md").is_file(): + results["benchmark_path"] = str(report_path.with_name("BENCHMARK.md")) identity_after_report = _run_owned_publication_fields() if identity_after_report != identity_before_report: @@ -5570,13 +5573,17 @@ def _render_current_report() -> tuple[Path | None, str | None]: results.pop("publication_target_conflict", None) results.update(identity_after_report) results.pop("report_path", None) + results.pop("benchmark_path", None) report_path, report_warning = _render_current_report() if report_path is not None: results["report_path"] = str(report_path) + if report_path.with_name("BENCHMARK.md").is_file(): + results["benchmark_path"] = str(report_path.with_name("BENCHMARK.md")) elif stale_report_path is not None: try: stale_report_path.resolve().relative_to(run_dir.resolve()) stale_report_path.unlink(missing_ok=True) + stale_report_path.with_name("BENCHMARK.md").unlink(missing_ok=True) except (OSError, RuntimeError, ValueError): pass if is_gke_vertex_workload_identity_active(env_mode, agents): diff --git a/tests/reporting/test_tier3_scoped_reports.py b/tests/reporting/test_tier3_scoped_reports.py new file mode 100644 index 000000000..28ba236f1 --- /dev/null +++ b/tests/reporting/test_tier3_scoped_reports.py @@ -0,0 +1,183 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +"""Completed-agent display never changes whole-run publication evidence.""" + +from __future__ import annotations + +import copy + +import pytest + +from skillevaluator.evaluation.tier3_report import build_agent_eval_payload +from skillevaluator.models import ValidationResult +from skillevaluator.reporting import BenchmarkReporter, HTMLReporter +from skillevaluator.reporting.base import UnsafeReportPathError, assess_publication +from skillevaluator.reporting.tier3_scope import completed_agent_result +from skillevaluator.tier3.harbor.metrics import DEFAULT_METRICS + + +def result_with_completed_peer(*, baseline=0.4, peer_failed=True): + conditions = { + arm: {"execution_status": "succeeded", "execution_errors": [], "expected_attempts": 1, "scored_attempts": 1} + for arm in ("with_skill", "without_skill") + } + agents = { + "opencode": { + "with_skill": dict.fromkeys(DEFAULT_METRICS, 0.8), + "without_skill": dict.fromkeys(DEFAULT_METRICS, baseline), + "execution_status": "succeeded", + "execution_errors": [], + "expected_attempts": 2, + "scored_attempts": 2, + "conditions": conditions, + "num_trials": 1, + "num_trials_baseline": 1, + } + } + if peer_failed: + agents["codex"] = { + "execution_status": "failed", + "execution_errors": ["Agent setup failed"], + "with_skill": {}, + "without_skill": {}, + } + payload = build_agent_eval_payload( + "demo", + agents, + dataset=[{"id": "case-a"}], + attempt_policy={"max_attempts": 1, "stop_on_pass": False, "pass_threshold": 0.5}, + use_llm_judge=False, + ) + result = ValidationResult(validator_name="AGENT_EVAL") + result.metadata["agent_eval"] = payload + if peer_failed: + result.add_error("Agent setup failed") + return result + + +@pytest.mark.parametrize("baseline,lift", [(0.4, "+0.4000"), (0.9, "-0.1000"), (0.8, "+0.0000")]) +def test_scoped_reports_show_completed_agent_and_signed_lift(baseline, lift): + result = result_with_completed_peer(baseline=baseline) + original = copy.deepcopy(result) + assessment = assess_publication([result]) + benchmark = BenchmarkReporter(report_scope="tier3").render(result) + html = HTMLReporter(report_scope="tier3").render(result) + assert "score **0.8000** (80.00%)" in benchmark + assert lift in benchmark + assert "Needs attention" in benchmark + assert "Publication: **NOT ASSESSED**" in benchmark + assert "Publication blocked" not in benchmark + assert "Completed-agent result" in html + assert ">0.80
" in html + assert 'data-publication-status="not-assessed"' in html + assert "Agent setup failed" in html + assert result == original + assert assess_publication([result]) == assessment + assert assessment.status != "pass" + + +def test_default_report_keeps_publication_gate_and_format(): + result = result_with_completed_peer() + benchmark = BenchmarkReporter().render(result) + html = HTMLReporter().render(result) + assert "Overall verdict: FAIL" in benchmark + assert 'data-publication-status="fail"' in html + assert "## Results at a Glance" in benchmark + assert "## Tier Status" in benchmark + + +@pytest.mark.parametrize("corruption", ["bool", "nan", "missing", "errors", "coverage", "conditions"]) +def test_no_completed_summary_for_invalid_agent_evidence(corruption): + result = result_with_completed_peer() + payload = result.metadata["agent_eval"] + agent = payload["agents"]["opencode"] + assert completed_agent_result(payload) + if corruption == "bool": + agent["with_skill"] = True + elif corruption == "nan": + agent["with_skill"] = float("nan") + elif corruption == "missing": + agent["with_skill"] = None + elif corruption == "errors": + agent["execution_errors"] = ["failed"] + elif corruption == "coverage": + agent["scored_attempts"] = 1 + elif corruption == "conditions": + agent["conditions"]["with_skill"]["execution_status"] = "failed" + assert completed_agent_result(payload) is None + + +def test_incompatible_basis_has_no_invented_lift(): + result = result_with_completed_peer() + payload = result.metadata["agent_eval"] + payload["agents"]["opencode"]["metrics_without_skill"] = ["accuracy"] + summary = completed_agent_result(payload) + assert summary["score"] == 0.8 + assert summary["lift"] is None + + +@pytest.mark.parametrize("reporter", [BenchmarkReporter, HTMLReporter]) +def test_scope_cannot_hide_other_tier_results(reporter): + with pytest.raises(ValueError, match="cannot hide"): + reporter(report_scope="tier3").render_all([ValidationResult(validator_name="MANIFEST")]) + with pytest.raises(ValueError, match="report_scope"): + reporter(report_scope="anything") + + +def test_scope_does_not_accept_partial_dataset_coverage(): + result = result_with_completed_peer() + payload = result.metadata["agent_eval"] + payload["dataset_summary"]["total_tasks"] = 32 + assert completed_agent_result(payload) is None + + +def test_standard_report_pair_and_unsafe_companion_destination(tmp_path): + import json + + from skillevaluator.evaluation.tier3_report import render_agent_eval_html_report + + skill = tmp_path / "demo" + skill.mkdir() + run = tmp_path / "run" + for arm in ("with-skill", "without-skill"): + directory = run / "opencode" / arm + directory.mkdir(parents=True) + (directory / "summary.json").write_text( + json.dumps( + { + "scores": dict.fromkeys(DEFAULT_METRICS, 0.8), + "metrics": list(DEFAULT_METRICS), + "num_trials": 1, + "execution_status": "succeeded", + "execution_errors": [], + "expected_attempts": 1, + "scored_attempts": 1, + } + ) + ) + report = render_agent_eval_html_report(skill, run, include_benchmark=True, use_llm_judge=False) + assert report.is_file() + benchmark = run / "BENCHMARK.md" + assert "Publication: **NOT ASSESSED**" in benchmark.read_text() + assert "## Results at a Glance" in benchmark.read_text() + benchmark.unlink() + private = tmp_path / "untouched.md" + private.write_text("preserve this file") + benchmark.symlink_to(private) + with pytest.raises(UnsafeReportPathError, match=r"(?i)symlink|unsafe|regular"): + render_agent_eval_html_report(skill, run, include_benchmark=True, use_llm_judge=False) + assert private.read_text() == "preserve this file" + assert benchmark.is_symlink() + assert not report.exists() + + +def test_without_baseline_preserves_score_without_inventing_comparison(): + result = result_with_completed_peer(peer_failed=False) + payload = result.metadata["agent_eval"] + agent = payload["agents"]["opencode"] + del agent["conditions"]["without_skill"] + agent["expected_attempts"] = agent["scored_attempts"] = 1 + summary = completed_agent_result(payload) + assert summary["score"] == 0.8 + assert summary["baseline"] is None + assert summary["lift"] is None From ecdcfdf094cc4d5823618014e64321d118708b13 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Thu, 29 Oct 2026 02:44:08 +0000 Subject: [PATCH 2/3] fix(reporting): write the Tier 3 companion card as tier3-benchmark.md Name the Tier 3-scoped card so publication tooling does not collect it as a BENCHMARK.md card, and describe Tiers 1 and 2 as not covered by the report rather than not requested. Signed-off-by: Christopher Kevin --- CHANGELOG.md | 9 +++++---- src/skillevaluator/evaluation/tier3_report.py | 2 +- src/skillevaluator/reporting/benchmark.py | 4 ++-- tests/reporting/test_tier3_scoped_reports.py | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c63e4ad1a..ad95e4431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,10 +154,11 @@ All notable changes to SkillEvaluator are documented in this file. direct-target behavior, plugin discovery errors produce findings, and reports and external Tier 3 results preserve catalog-relative paths for skills with the same basename. -- Standalone Tier 3 runs now emit the standard `BENCHMARK.md` alongside HTML, - explicitly separate the Tier 3 result from an unassessed publication decision, - and display a completed agent's score and comparable lift when another agent - fails. Failure warnings and the full publication checks remain unchanged. +- Tier 3 runs now write a Tier 3-scoped `tier3-benchmark.md` alongside HTML, + named so publication tooling does not treat it as a `BENCHMARK.md` card. It + states that Tiers 1 and 2 are not covered by the report, separates the Tier 3 + result from an unassessed publication decision, and displays a completed + agent's score and comparable lift when another agent fails. Failure warnings and the full publication checks remain unchanged. - Changing finding severities through a policy no longer clears an independent quality-score threshold failure. A score below `--min-score` still fails, diff --git a/src/skillevaluator/evaluation/tier3_report.py b/src/skillevaluator/evaluation/tier3_report.py index bb6990773..50ca28f3d 100644 --- a/src/skillevaluator/evaluation/tier3_report.py +++ b/src/skillevaluator/evaluation/tier3_report.py @@ -627,7 +627,7 @@ def render_agent_eval_html_report( if include_benchmark: BenchmarkReporter( skill_name=publication_target_name(skill_path) or skill_path.name, report_scope="tier3" - ).save([result], target.with_name("BENCHMARK.md")) + ).save([result], target.with_name("tier3-benchmark.md")) except Exception: # Do not advertise half of a newly generated report pair. An unsafe # destination that the writer rejected is never followed or removed. diff --git a/src/skillevaluator/reporting/benchmark.py b/src/skillevaluator/reporting/benchmark.py index 0c2f97050..3ce93e42d 100644 --- a/src/skillevaluator/reporting/benchmark.py +++ b/src/skillevaluator/reporting/benchmark.py @@ -177,7 +177,7 @@ def render_all(self, results: list[ValidationResult]) -> str: ] if self.report_scope == "tier3": lines.extend([ - "Publication: **NOT ASSESSED**. This report covers Tier 3 only; Tiers 1 and 2 were not requested.", + "Publication: **NOT ASSESSED**. This report covers Tier 3 only; Tiers 1 and 2 are not covered by this report.", "The verdict describes with-skill quality; lift is a separate baseline comparison.", "", ]) elif status == "PASS": @@ -542,7 +542,7 @@ def _render_tier_status( ) if self.report_scope == "tier3": if tier != "Tier 3": - status, evidence = "NOT REQUESTED", "Outside this report's Tier 3 scope" + status, evidence = "NOT COVERED", "Outside this report's Tier 3 scope" elif completed := completed_agent_result(ae): status = completed["verdict"].upper() evidence = "Completed-agent quality result; publication not assessed" diff --git a/tests/reporting/test_tier3_scoped_reports.py b/tests/reporting/test_tier3_scoped_reports.py index 28ba236f1..6f99557b8 100644 --- a/tests/reporting/test_tier3_scoped_reports.py +++ b/tests/reporting/test_tier3_scoped_reports.py @@ -157,7 +157,7 @@ def test_standard_report_pair_and_unsafe_companion_destination(tmp_path): ) report = render_agent_eval_html_report(skill, run, include_benchmark=True, use_llm_judge=False) assert report.is_file() - benchmark = run / "BENCHMARK.md" + benchmark = run / "tier3-benchmark.md" assert "Publication: **NOT ASSESSED**" in benchmark.read_text() assert "## Results at a Glance" in benchmark.read_text() benchmark.unlink() From d837439157e005faf169d5e737b9d6b73461e572 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Thu, 29 Oct 2026 14:33:31 -0700 Subject: [PATCH 3/3] fix(reporting): retain scoped benchmark paths and cleanup Signed-off-by: Narendran Raghavan --- src/skillevaluator/tier3/harbor/runner.py | 10 ++-- tests/test_tier3_progress.py | 72 +++++++++++++++++++++++ 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/src/skillevaluator/tier3/harbor/runner.py b/src/skillevaluator/tier3/harbor/runner.py index 016df1d6b..dae8df96b 100644 --- a/src/skillevaluator/tier3/harbor/runner.py +++ b/src/skillevaluator/tier3/harbor/runner.py @@ -5563,8 +5563,8 @@ def _render_current_report() -> tuple[Path | None, str | None]: report_path, report_warning = _render_current_report() if report_path is not None: results["report_path"] = str(report_path) - if report_path.with_name("BENCHMARK.md").is_file(): - results["benchmark_path"] = str(report_path.with_name("BENCHMARK.md")) + if report_path.with_name("tier3-benchmark.md").is_file(): + results["benchmark_path"] = str(report_path.with_name("tier3-benchmark.md")) identity_after_report = _run_owned_publication_fields() if identity_after_report != identity_before_report: @@ -5577,13 +5577,13 @@ def _render_current_report() -> tuple[Path | None, str | None]: report_path, report_warning = _render_current_report() if report_path is not None: results["report_path"] = str(report_path) - if report_path.with_name("BENCHMARK.md").is_file(): - results["benchmark_path"] = str(report_path.with_name("BENCHMARK.md")) + if report_path.with_name("tier3-benchmark.md").is_file(): + results["benchmark_path"] = str(report_path.with_name("tier3-benchmark.md")) elif stale_report_path is not None: try: stale_report_path.resolve().relative_to(run_dir.resolve()) stale_report_path.unlink(missing_ok=True) - stale_report_path.with_name("BENCHMARK.md").unlink(missing_ok=True) + stale_report_path.with_name("tier3-benchmark.md").unlink(missing_ok=True) except (OSError, RuntimeError, ValueError): pass if is_gke_vertex_workload_identity_active(env_mode, agents): diff --git a/tests/test_tier3_progress.py b/tests/test_tier3_progress.py index 54e71fcab..d77e1aaf4 100644 --- a/tests/test_tier3_progress.py +++ b/tests/test_tier3_progress.py @@ -2092,6 +2092,78 @@ def write_html(_skill_path, run_dir, *, engine_result, **_kwargs): assert "agent_eval" not in persisted +def _collect_completed_report_input(*, output_dir: Path, **_kwargs: Any) -> dict[str, Any]: + from skillevaluator.tier3.harbor.metrics import DEFAULT_METRICS + + for arm in ("with-skill", "without-skill"): + directory = output_dir / "codex" / arm + directory.mkdir(parents=True) + (directory / "summary.json").write_text( + json.dumps( + { + "scores": dict.fromkeys(DEFAULT_METRICS, 0.8), + "metrics": list(DEFAULT_METRICS), + "num_trials": 1, + "execution_status": "succeeded", + "execution_errors": [], + "expected_attempts": 1, + "scored_attempts": 1, + } + ), + encoding="utf-8", + ) + return {"execution_status": "succeeded", "execution_errors": [], "metrics": list(DEFAULT_METRICS)} + + +def test_runner_persists_scoped_benchmark_path( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, +) -> None: + from skillevaluator.evaluation.tier3_report import render_agent_eval_html_report + + def render_without_judge(skill_path: Path, run_dir: Path, **kwargs: Any) -> Path: + return render_agent_eval_html_report(skill_path, run_dir, use_llm_judge=False, **kwargs) + + runner, skill = _stub_runner( + monkeypatch, tmp_path, collect=_collect_completed_report_input, html_report=render_without_judge + ) + result = runner.run_harbor_eval(skill, ["codex"], output_dir=tmp_path / "results") + benchmark = Path(result["run_dir"]) / "tier3-benchmark.md" + persisted = json.loads(Path(result["result_path"]).read_text(encoding="utf-8")) + + assert benchmark.is_file() + assert result["benchmark_path"] == str(benchmark) + assert persisted["benchmark_path"] == str(benchmark) + assert not benchmark.with_name("BENCHMARK.md").exists() + + +def test_runner_removes_scoped_benchmark_when_identity_rerender_fails( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, +) -> None: + from skillevaluator.evaluation.tier3_report import render_agent_eval_html_report + + def render_then_change_source(skill_path: Path, run_dir: Path, **kwargs: Any) -> Path: + if (run_dir / "tier3-benchmark.md").exists(): + raise OSError("injected rerender failure") + report = render_agent_eval_html_report(skill_path, run_dir, use_llm_judge=False, **kwargs) + (skill_path / "SKILL.md").write_text("# changed during reporting\n", encoding="utf-8") + return report + + runner, skill = _stub_runner( + monkeypatch, tmp_path, collect=_collect_completed_report_input, html_report=render_then_change_source + ) + (skill / "SKILL.md").write_text("# evaluated source\n", encoding="utf-8") + result = runner.run_harbor_eval(skill, ["codex"], output_dir=tmp_path / "results") + run_dir = Path(result["run_dir"]) + + assert result["publication_target_conflict"] + assert "report_path" not in result + assert "benchmark_path" not in result + assert not (run_dir / "report.html").exists() + assert not (run_dir / "tier3-benchmark.md").exists() + + def test_runner_persists_run_owned_publication_identity_in_final_result( monkeypatch: pytest.MonkeyPatch, tmp_path: Path,