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): retain completed-agent results in Tier 3 reports (#223)
Christopher Kevindf16c85df746
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5f362909..d5b76d88 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -256,6 +256,12 @@ All notable changes to SkillEvaluator are documented in this file.direct-target behavior, plugin discovery errors produce findings, and reportsand external Tier 3 results preserve catalog-relative paths for skills withthe same basename.+- 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 independentquality-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.pyindex 052a103e..c0932043 100644--- a/src/skillevaluator/evaluation/tier3_report.py+++ b/src/skillevaluator/evaluation/tier3_report.py@@ -584,9 +584,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, HTMLReporterskill_path = skill_path.expanduser().resolve()run_dir = run_dir.expanduser().resolve()@@ -618,12 +619,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("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.+ for path in written:+ path.unlink(missing_ok=True)+ raisereturn targetdiff --git a/src/skillevaluator/reporting/benchmark.py b/src/skillevaluator/reporting/benchmark.pyindex 941b6453..3ce93e42 100644--- a/src/skillevaluator/reporting/benchmark.py+++ b/src/skillevaluator/reporting/benchmark.py@@ -49,6 +49,7 @@ from skillevaluator.reporting.base import (tier1_unscanned_publication_paths,unrecognized_tier2_results,)+from skillevaluator.reporting.tier3_scope import completed_agent_result, validate_report_scopefrom skillevaluator.source_identity import evaluated_source_revision, recorded_evaluated_sourcefrom skillevaluator.tier3_environments import HARBOR_ENV_MODES@@ -130,9 +131,12 @@ class BenchmarkReporter(ReporterBase):include_timestamp: bool = True,max_findings_shown: int = 5,skill_name: str | None = None,+ report_scope: str = "publication",) -> None:self.include_timestamp = include_timestampself.max_findings_shown = max_findings_shown+ validate_report_scope(report_scope, [])+ self.report_scope = report_scopeself.skill_name = skill_name@property@@ -147,7 +151,9 @@ class BenchmarkReporter(ReporterBase):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 @@ class BenchmarkReporter(ReporterBase):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 are not covered by this report.",+ "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 @@ class BenchmarkReporter(ReporterBase):])+ 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 @@ class BenchmarkReporter(ReporterBase):expected_skill_name=expected_skill_name,expected_publication_target=publication_target,)+ if self.report_scope == "tier3":+ if tier != "Tier 3":+ 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"+ 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.pyindex 7c7fd018..838a26d6 100644--- a/src/skillevaluator/reporting/html.py+++ b/src/skillevaluator/reporting/html.py@@ -73,6 +73,7 @@ from skillevaluator.reporting.base import ()from skillevaluator.reporting.harbor_viewer import normalize_agent_eval_harbor_linksfrom skillevaluator.reporting.presentation import success_is_not_applicable+from skillevaluator.reporting.tier3_scope import completed_agent_result, validate_report_scopeif TYPE_CHECKING:from skillevaluator.models import ValidationResult@@ -1545,7 +1546,7 @@ class HTMLReporter(ReporterBase):expected_skill_name: str | None = None,explicit_skill_name: str | None = None,ci_context: dict[str, str] | None = None,- scan_root: str | None = None,+ report_scope: str = "publication",) -> None:self.include_timestamp = include_timestampself.title = title or "SkillEvaluator Validation Report"@@ -1557,6 +1558,8 @@ class HTMLReporter(ReporterBase):# 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_scopeself.expected_skill_name = expected_skill_nameself.explicit_skill_name = explicit_skill_nameself.ci_context = _validated_ci_context(ci_context)@@ -2691,8 +2694,10 @@ class HTMLReporter(ReporterBase):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.@@ -3056,6 +3061,8 @@ class HTMLReporter(ReporterBase):template = self._env.get_template("report.html.j2")cl = self.content_labelreturn 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,@@ -3074,7 +3081,10 @@ class HTMLReporter(ReporterBase):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.j2index 3b0fa1e2..fbfdac2a 100644--- a/src/skillevaluator/reporting/templates/report.html.j2+++ b/src/skillevaluator/reporting/templates/report.html.j2@@ -1274,6 +1274,16 @@<span aria-hidden="true">↓</span><span>Download JSON</span></button>{% endif %}</div>+ <span class="header-status-badge {{ 'warn' if has_incomplete else ('pass' if all_passed else 'fail') }}">Process: {{ 'Incomplete' if has_incomplete else ('All Passed' if all_passed else 'Issues Found') }}</span>+ {% if report_scope == 'tier3' %}+ <span class="header-status-badge warn" data-publication-status="not-assessed">Publication: Not assessed (Tier 3 only)</span>+ {% else %}+ <span class="header-status-badge {{ 'pass' if publication_status == 'pass' else ('fail' if publication_status == 'fail' else 'warn') }}"+ data-publication-status="{{ publication_status }}"+ {% if publication_reasons %}title="{{ publication_reasons | join(' ') }}"{% endif %}>+ Publication: {{ publication_status | title }}+ </span>+ {% endif %}</div></div></header>@@ -1303,7 +1313,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 {} %}@@ -1351,10 +1361,12 @@<div class="agent-hero-score {{ 'score-pass' if hero_score is not none and hero_score >= 0.8 else ('score-warn' if hero_score is not none and hero_score >= 0.6 else 'score-fail') }}">{{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }}<span class="hero-score-label">overall score</span></div><div class="agent-hero-detail"><div><strong>Best performing agent:</strong> {{ tier3.best_agent or 'N/A' }}</div>+ {% if completed_agent and completed_agent.needs_attention %}<div class="score-warn">Completed-agent result. Other execution failures need attention; see agent details.</div>{% endif %}+ {% if completed_agent and completed_agent.recovered_attempts %}<div>{{ completed_agent.recovered_attempts }} timeout attempt(s) recovered; failed history retained.</div>{% endif %}<div><strong>Trials:</strong> {{ hero_trials }} across {{ (tier3.agents_run or []) | length }} agent(s)</div><div><strong>Metrics:</strong> {{ hero_metric_count }} evaluators</div>{% if tier3_environment %}<div><strong>Environment:</strong> <code>{{ tier3_environment }}</code></div>{% endif %}- {% if tier3.get('overall_lift') is not none %}<div><strong>Overall lift:</strong> {{ "%+.2f" | format(tier3.get('overall_lift')) }}</div>{% endif %}+ {% if tier3.get('overall_lift') is not none %}<div><strong>Best-agent lift:</strong> {{ "%+.2f" | format(tier3.get('overall_lift')) }}</div>{% endif %}</div>{% endif %}{% endif %}@@ -1436,8 +1448,8 @@</div>{% endif %}{% if has_tier3 %}- {% set tier3_display_verdict = verdict_words['skipped'] if tier3_is_skipped else (advisory_fail_word if tier3_advisory_fail else verdict_words[tier3_verdict if tier3_verdict in ['pass', 'fail', 'neutral'] else 'incomplete']) %}- {% set t3_class = 'skipped' if tier3_is_skipped else ('pass' if tier3_verdict == 'pass' else ('fail' if tier3_verdict == 'fail' else 'warn')) %}+ {% set tier3_display_verdict = 'SKIPPED' if tier3_is_skipped else tier3_verdict | upper %}+ {% 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'))) %}<div class="tier-card {{ t3_class }}{% if initial_tab == 'tier3' %} active{% endif %}"role="button"tabindex="0"@@ -1448,14 +1460,14 @@title="Open Tier 3: Live Agent Evaluation"><div class="tier-card-head"><span class="tier-card-label">Tier 3</span>- <span class="tier-card-verdict">{{ tier3_display_verdict }}</span>+ <span class="tier-card-verdict">{{ tier3_display_verdict }}{% if report_scope == 'tier3' and completed_agent %} · Quality{% if completed_agent.needs_attention %}; needs attention{% endif %}{% endif %}</span></div><p class="tier-card-title">Live Agent Evaluation</p><div class="tier-card-stats">{% if tier3_is_skipped %}<span>{{ tier3_skip_message }}</span>{% else %}- <span>score <strong>{{ "%.2f" | format(tier3.overall_score) if tier3.overall_score is not none else "N/A" }}</strong></span>+ <span>score <strong>{{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }}</strong></span>{% if tier3.get('overall_lift') is not none %}<span>lift <strong>{{ "%+.2f" | format(tier3.get('overall_lift')) }}</strong></span>{% endif %}{% if hero_trials %}<span><strong>{{ hero_trials }}</strong> trial(s)</span>{% endif %}{% endif %}@@ -2411,9 +2423,14 @@<strong>Inconclusive: skill never activated.</strong>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 %}+ <strong>Completed-agent result: {{ completed_agent.verdict | upper }}.</strong>+ {{ completed_agent.name }} scored {{ "%.2f" | format(completed_agent.score) }}.+ Other execution failures need attention. This is not a whole-run or publication PASS.+ {% else %}<strong>Verdict at a glance:</strong>- {{ advisory_fail_word if tier3_advisory_fail else (verdict_words.get(tier3_verdict) or tier3_verdict | title) }}{% if t3_effect %} · {{ t3_effect.message }}{% else %} with an overall score of- {{ "%.2f" | format(tier3.overall_score) if tier3.overall_score is not none else "N/A" }}.+ {{ tier3_verdict | upper }} with an overall score of+ {{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }}.{% if t3_best_name %}Best performing agent is <strong>{{ t3_best_name }}</strong>{% 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 %}@@ -2433,13 +2450,13 @@{% endif %}<div class="dashboard"><div class="dashboard-card {{ 'success' if tier3_verdict == 'pass' else ('danger' if tier3_verdict == 'fail' else '') }}">- <h3 class="dashboard-card-title">Verdict</h3>- <p class="dashboard-card-value">{{ verdict_words['skipped'] if tier3_is_skipped else (advisory_fail_word if tier3_advisory_fail else (verdict_words.get(tier3_verdict) or tier3_verdict | title)) }}</p>- <p class="dashboard-card-subtitle">Evaluation outcome</p>+ <h3 class="dashboard-card-title">{{ 'Quality Verdict' if report_scope == 'tier3' and completed_agent else 'Verdict' }}</h3>+ <p class="dashboard-card-value">{{ 'SKIPPED' if tier3_is_skipped else tier3_verdict | upper }}</p>+ <p class="dashboard-card-subtitle">{{ 'Completed-agent quality; lift shown separately' if report_scope == 'tier3' and completed_agent else 'Evaluation outcome' }}</p></div><div class="dashboard-card">- <h3 class="dashboard-card-title">Overall Score</h3>- <p class="dashboard-card-value">{{ "%.2f" | format(tier3.overall_score) if tier3.overall_score is not none else "N/A" }}</p>+ <h3 class="dashboard-card-title">{{ 'Completed Agent Score' if completed_agent and completed_agent.needs_attention else 'Overall Score' }}</h3>+ <p class="dashboard-card-value">{{ "%.2f" | format(hero_score) if hero_score is not none else "N/A" }}</p><p class="dashboard-card-subtitle">Best run across evaluated dimensions</p></div><div class="dashboard-card">diff --git a/src/skillevaluator/reporting/tier3_scope.py b/src/skillevaluator/reporting/tier3_scope.pynew file mode 100644index 00000000..6a97c9a9--- /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.pyindex 6011cb84..016df1d6 100644--- a/src/skillevaluator/tier3/harbor/runner.py+++ b/src/skillevaluator/tier3/harbor/runner.py@@ -5549,6 +5549,7 @@ def _run_harbor_eval_impl(run_dir,env_mode=env_mode,engine_result=results,+ include_benchmark=True,)if candidate.is_file():return candidate, None@@ -5562,6 +5563,8 @@ def _run_harbor_eval_impl(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 _run_harbor_eval_impl(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):passif 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.pynew file mode 100644index 00000000..6f99557b--- /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++[email protected]("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</div>" 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++[email protected]("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++[email protected]("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 / "tier3-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