Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(reporting): show the evidence that decided the BENCHMARK.md verdict (#524)

Narendran Raghavand7459a449602
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f6614b02..cef3ee5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -429,6 +429,22 @@ All notable changes to SkillEvaluator are documented in this file.
`/root/.bashrc`, or `/etc/sudoers` scored 0.0 in 0.9.0 and now scores 1.0,
and a view of a credential store such as `~/.netrc` still scores 0.0. Both
the host checker and the bundled Harbor verifier apply the fix.
+- `BENCHMARK.md` now shows the evidence and the policy that decided its overall
+ verdict. The card used to print `Overall verdict: PASS — Recommended for
+ publication` with nothing behind it, so a reader who saw an agent with no
+ dimension scores and another agent below the documented 40% FAIL boundary had
+ no way to tell why the gate still passed. A "Why This Verdict" block under the
+ callout now names the rule that fired, the Tier 3 evidence state with its
+ publication policy, each blocking reason, and, per agent, what the dimension
+ gate read: which agent passed every dimension, which dimension fell below the
+ FAIL or PASS boundary, and which agent the gate did not count, naming the
+ excluded arm when the run recorded one. A PASS that rests on one agent while
+ another fails a dimension now says so. The block is rendered from the same
+ publication assessment the printed verdict is projected from, and from the
+ per-agent breakdown the Tier 3 dimension verdict folds, so it cannot describe
+ a different decision. Optional or skipped Tier 3 runs are explained using
+ their recorded policy, and threshold-adjacent scores retain enough precision
+ to stay in their actual verdict band. No verdict changes.
- `--tolerate-baseline-timeouts` (added in 0.9.0) now follows its own rules
in the printed run verdict, in the notes of both reports and during result
collection. The `RUN QUALITY VERDICT` line that `tier3 evaluate` prints
diff --git a/src/skillevaluator/reporting/base.py b/src/skillevaluator/reporting/base.py
index 5b0dc8bb..d6609da2 100644
--- a/src/skillevaluator/reporting/base.py
+++ b/src/skillevaluator/reporting/base.py
@@ -1244,37 +1244,91 @@ def _agent_eval_dimension_scores(
return scores
-def agent_eval_dimension_verdict(
+@dataclass(frozen=True)
+class AgentDimensionGate:
+ """What the Tier 3 dimension gate made of one recorded agent.
+
+ ``state`` says why the agent did or did not reach the gate:
+
+ ``scored``
+ The gate read a complete dimension set and ``verdict`` is the agent's
+ own verdict.
+ ``never_activated``
+ The skill never activated, so the agent is inconclusive by record
+ rather than by score.
+ ``incomplete_evidence``
+ The agent ran but carried no dimension set the gate could score, so it
+ contributed nothing to the verdict.
+ ``not_supported``
+ The agent's execution did not succeed, so the gate never considered it.
+
+ ``scores`` holds the dimension scores the gate read, in
+ ``DIMENSION_MAPPING`` order, and is empty unless ``state`` is ``scored``.
+ """
+
+ name: str
+ state: str
+ verdict: str | None
+ scores: tuple[tuple[str, float], ...] = ()
+
+
+def agent_eval_dimension_breakdown(
payload: dict[str, Any] | None,
*,
require_baseline: bool = True,
-) -> str | None:
- """Recompute a Tier 3 verdict from complete supported-agent dimensions."""
- supported_agents = [
- agent
- for agent in _agent_eval_agents(payload).values()
- if _agent_eval_safe_text(agent.get("execution_status")).lower() == "succeeded"
- ]
- if not supported_agents:
- return None
+) -> tuple[AgentDimensionGate, ...]:
+ """Return the per-agent evidence the Tier 3 dimension gate reads.
- verdicts: list[str] = []
- has_partial_evidence = False
- for agent in supported_agents:
+ ``agent_eval_dimension_verdict`` folds this breakdown into the one verdict
+ it returns, so a report that renders the breakdown shows the evidence that
+ verdict was computed from and cannot drift from it.
+ """
+ breakdown: list[AgentDimensionGate] = []
+ for name, agent in _agent_eval_agents(payload).items():
+ if _agent_eval_safe_text(agent.get("execution_status")).lower() != "succeeded":
+ breakdown.append(AgentDimensionGate(name, "not_supported", None))
+ continue
activation = agent.get("skill_activation")
if isinstance(activation, dict) and activation.get("status") == "never_activated":
- verdicts.append("inconclusive")
+ breakdown.append(AgentDimensionGate(name, "never_activated", "inconclusive"))
continue
scores = _agent_eval_dimension_scores(agent, require_baseline=require_baseline)
if scores is None:
- has_partial_evidence = True
+ breakdown.append(AgentDimensionGate(name, "incomplete_evidence", None))
continue
if any(score < DIMENSION_VERDICT_NEUTRAL_THRESHOLD for score in scores):
- verdicts.append("fail")
+ verdict = "fail"
elif any(score < DIMENSION_VERDICT_PASS_THRESHOLD for score in scores):
- verdicts.append("neutral")
+ verdict = "neutral"
else:
- verdicts.append("pass")
+ verdict = "pass"
+ breakdown.append(
+ AgentDimensionGate(
+ name,
+ "scored",
+ verdict,
+ tuple(zip(DIMENSION_MAPPING, scores, strict=True)),
+ )
+ )
+ return tuple(breakdown)
+
+
+def agent_eval_dimension_verdict(
+ payload: dict[str, Any] | None,
+ *,
+ require_baseline: bool = True,
+) -> str | None:
+ """Recompute a Tier 3 verdict from complete supported-agent dimensions."""
+ supported = [
+ entry
+ for entry in agent_eval_dimension_breakdown(payload, require_baseline=require_baseline)
+ if entry.state != "not_supported"
+ ]
+ if not supported:
+ return None
+
+ verdicts = [entry.verdict for entry in supported if entry.verdict is not None]
+ has_partial_evidence = any(entry.state == "incomplete_evidence" for entry in supported)
if "pass" in verdicts:
return "pass"
diff --git a/src/skillevaluator/reporting/benchmark.py b/src/skillevaluator/reporting/benchmark.py
index 928884f2..5ed1f435 100644
--- a/src/skillevaluator/reporting/benchmark.py
+++ b/src/skillevaluator/reporting/benchmark.py
@@ -26,9 +26,11 @@ from skillevaluator.constants import (
from skillevaluator.publication_evidence import result_has_publication_evidence, result_publication_evidence
from skillevaluator.publication_text import publication_confusable_skeleton
from skillevaluator.reporting.base import (
+ AgentDimensionGate,
PublicationTargetIdentity,
ReporterBase,
agent_eval_baseline_not_applicable,
+ agent_eval_dimension_breakdown,
agent_eval_dimension_verdict,
agent_eval_publication_dataset_provenance,
agent_eval_publication_evaluated_at,
@@ -69,6 +71,7 @@ from skillevaluator.tier3_environments import HARBOR_ENV_MODES
if TYPE_CHECKING:
from skillevaluator.models import Finding, ValidationResult
+ from skillevaluator.reporting.base import PublicationAssessment
# These fields are empty because the orchestration input did not supply them,
@@ -76,6 +79,8 @@ if TYPE_CHECKING:
_SOURCE_UNRECORDED = "not recorded (not supplied by the orchestration input)"
# Case rows of the token usage table. The card has a size limit; the JSON payload keeps every case.
_MAX_TOKEN_USAGE_CASE_ROWS = 50
+# The card's uppercase vocabulary for one shared publication assessment status.
+_ASSESSMENT_STATUSES = {"pass": "PASS", "neutral": "NEUTRAL", "fail": "FAIL", "incomplete": "INCOMPLETE"}
_SIGNAL_DESCRIPTIONS = {
"security": "unsafe operations, secret leakage, and unauthorized access",
@@ -190,7 +195,10 @@ class BenchmarkReporter(ReporterBase):
skill_name = _publication_safe_skill_name(display_skill_name)
private_labels = _private_environment_labels(ae)
policy = _benchmark_policy(results, ae, expected_skill_name=expected_skill_name)
- status = _overall_status(results, ae, policy, expected_skill_name=expected_skill_name)
+ # One assessment decides the verdict and explains it, so the rendered
+ # evidence cannot drift from the status printed above it.
+ assessment = _publication_assessment(results, ae, expected_skill_name=expected_skill_name)
+ status = _assessment_status(assessment)
run_verdict = ae.get("verdict") if isinstance(ae, dict) else None
run_reason = ae.get("verdict_reason") if isinstance(ae, dict) else None
@@ -212,7 +220,13 @@ class BenchmarkReporter(ReporterBase):
lines: list[str] = (
[tier3_callout, "", f"# Skill Benchmark: {skill_name}", ""]
if self.report_scope == "tier3"
- else [f"# Skill Benchmark: {skill_name}", "", _verdict_callout(status), ""]
+ else [
+ f"# Skill Benchmark: {skill_name}",
+ "",
+ _verdict_callout(status),
+ "",
+ *_verdict_evidence_lines(status, assessment, ae, private_labels),
+ ]
)
if self.report_scope == "tier3":
lines.extend(
@@ -1102,6 +1116,20 @@ def _advisory_agent_eval_skip_message(results: list[ValidationResult]) -> str |
return None
+def _publication_assessment(
+ results: list[ValidationResult],
+ ae: dict[str, Any] | None,
+ *,
+ expected_skill_name: str | None = None,
+) -> PublicationAssessment:
+ """Return the one assessment the card's verdict and its explanation share."""
+ return resolve_run_status(
+ results,
+ agent_eval=ae,
+ expected_skill_name=expected_skill_name,
+ ).publication_assessment
+
+
def _overall_status(
results: list[ValidationResult],
ae: dict[str, Any] | None,
@@ -1113,7 +1141,12 @@ def _overall_status(
# benchmark's uppercase vocabulary while every reporter shares one
# publication assessment implementation.
del benchmark_policy
- return resolve_run_status(results, agent_eval=ae, expected_skill_name=expected_skill_name).publication.verdict
+ return _assessment_status(_publication_assessment(results, ae, expected_skill_name=expected_skill_name))
+
+
+def _assessment_status(assessment: PublicationAssessment) -> str:
+ """Project one assessment onto the card's uppercase verdict vocabulary."""
+ return _ASSESSMENT_STATUSES.get(assessment.status, assessment.status.upper())
def _is_blocking_publication_skip(
@@ -1134,11 +1167,180 @@ def _verdict_callout(status: str) -> str:
"PASS": "✅ **Overall verdict: PASS — Recommended for publication**",
"FAIL": "❌ **Overall verdict: FAIL — Publication blocked**",
"INCOMPLETE": "⚠️ **Overall verdict: INCOMPLETE — Required evidence is missing**",
- "NEUTRAL": "**Overall verdict: NEUTRAL — One or more dimensions remain below PASS**",
+ "NEUTRAL": "**Overall verdict: NEUTRAL — Publication decision deferred**",
}
return f"> {labels.get(status, f'**Overall verdict: {status}**')}"
+# The decision each status records, in the words of the assessment that
+# produced it. A status without a rule here falls back to its recorded reasons.
+_VERDICT_RULES = {
+ "PASS": "every publication-required tier passed and the Tier 3 dimension gate passed.",
+ "NEUTRAL": (
+ "every publication-required tier completed, but no supported agent scored at or above the "
+ "dimension PASS boundary on every dimension."
+ ),
+ "FAIL": "the evidence below blocks publication.",
+ "INCOMPLETE": "required evidence is missing or unproven, as recorded below.",
+}
+
+_GATE_LABELS = {
+ "pass": "pass",
+ "neutral": "neutral",
+ "fail": "fail",
+ "inconclusive": "inconclusive",
+}
+
+_DIMENSION_GATE_STATE_TEXT = {
+ "never_activated": "the skill never activated, so its scores are diagnostic only",
+ "incomplete_evidence": "no complete dimension set was recorded, so the gate read nothing from this agent",
+ "not_supported": "execution did not succeed, so the gate did not consider this agent",
+}
+
+
+def _dimension_boundaries() -> str:
+ return (
+ f"an agent passes when every dimension is at or above {DIMENSION_VERDICT_PASS_THRESHOLD:.0%} "
+ f"and fails when any dimension is below {DIMENSION_VERDICT_NEUTRAL_THRESHOLD:.0%}"
+ )
+
+
+def _dimension_gate_evidence(
+ entry: AgentDimensionGate,
+ agent: dict[str, Any],
+ private_labels: tuple[str, ...],
+) -> str:
+ """Describe, in one cell, what the gate read from one agent."""
+ if entry.state == "scored":
+ failing = [item for item in entry.scores if item[1] < DIMENSION_VERDICT_NEUTRAL_THRESHOLD]
+ below_pass = [
+ item
+ for item in entry.scores
+ if DIMENSION_VERDICT_NEUTRAL_THRESHOLD <= item[1] < DIMENSION_VERDICT_PASS_THRESHOLD
+ ]
+ if failing:
+ listed = "; ".join(f"{name.title()} {_single_score_label(score)}" for name, score in failing)
+ return f"{listed} below the {DIMENSION_VERDICT_NEUTRAL_THRESHOLD:.0%} FAIL boundary"
+ if below_pass:
+ listed = "; ".join(f"{name.title()} {_single_score_label(score)}" for name, score in below_pass)
+ return f"{listed} below the {DIMENSION_VERDICT_PASS_THRESHOLD:.0%} PASS boundary"
+ lowest = min(entry.scores, key=lambda item: item[1])
+ return (
+ f"every dimension at or above the {DIMENSION_VERDICT_PASS_THRESHOLD:.0%} PASS boundary "
+ f"(lowest: {lowest[0].title()} {_single_score_label(lowest[1])})"
+ )
+ text = _DIMENSION_GATE_STATE_TEXT[entry.state]
+ # Name why the agent was held out when the run recorded a reason, so an
+ # excluded agent is visible here rather than silently absent.
+ if excluded := "; ".join(str(arm) for arm in incomplete_arms(agent)):
+ return f"{text} ({_publication_safe_inline(excluded, private_labels)})"
+ return text
+
+
+def _verdict_evidence_lines(
+ status: str,
+ assessment: PublicationAssessment,
+ ae: dict[str, Any] | None,
+ private_labels: tuple[str, ...],
+) -> list[str]:
+ """Render the rule and the evidence that produced *status*.
+
+ Every statement here is read from ``assessment`` — the same object
+ ``_overall_status`` projects the printed verdict from — and from the
+ per-agent breakdown ``agent_eval_dimension_verdict`` folds into the Tier 3
+ verdict that assessment carries. The explanation therefore cannot describe
+ a decision other than the one in the callout above it.
+ """
+ tier3 = assessment.tier3
+ breakdown = agent_eval_dimension_breakdown(tier3.payload if isinstance(tier3.payload, dict) else ae)
+ gate_passed = tier3.status in {"pass", "neutral"} and any(entry.verdict == "pass" for entry in breakdown)
+ rule = _VERDICT_RULES.get(status, "recorded below.")
+ if status == "PASS" and not gate_passed:
+ rule = "every publication-required tier passed; " + (
+ "the recorded Tier 3 verdict is pass."
+ if assessment.benchmark_policy.get("tier3_required")
+ else "Tier 3 was optional by policy."
+ )
+ elif status == "NEUTRAL" and gate_passed:
+ rule = (
+ "every publication-required tier completed and the Tier 3 dimension gate passed, "
+ "but the recorded Tier 3 verdict is neutral."
+ )
+ lines = [
+ "### Why This Verdict",
+ "",
+ f"- Decision: **{status}** — {rule}",
+ ]
+
+ policy_note = (
+ "required for publication" if assessment.benchmark_policy.get("tier3_required") else "optional by policy"
+ )
+ if tier3.status == "skipped":
+ evidence_note = (
+ "recorded agent scores do not certify a skipped evaluation."
+ if breakdown
+ else "no dimension evidence was recorded."
+ )
+ lines.append(f"- Tier 3 live evaluation: skipped ({policy_note}); {evidence_note}")
+ else:
+ completeness = "publication-complete" if tier3.evidence_complete else "not publication-complete"
+ lines.append(
+ f"- Tier 3 evidence: **{tier3.status.upper()}** ({completeness}; {policy_note}). "
+ f"Dimension gate: {_dimension_boundaries()}."
+ )
+
+ for reason in assessment.reasons or (() if status == "PASS" else (tier3.reason,) if tier3.reason else ()):
+ lines.append(f"- Blocking: {_publication_safe_inline(reason, private_labels)}")
+
+ agents = _agents(ae)
+ if breakdown:
+ lines.extend(
+ [
+ "",
+ "| Agent | Dimension gate | Evidence the gate read |",
+ "|---|---|---|",
+ ]
+ )
+ for entry in breakdown:
+ agent = agents.get(entry.name, {})
+ gate = _GATE_LABELS.get(entry.verdict or "", "not counted")
+ lines.append(
+ "| "
+ + " | ".join(
+ (
+ _md_cell(_agent_display_label(entry.name, agent, private_labels), private_labels),
+ _trusted_md_cell(gate),
+ _md_cell(_dimension_gate_evidence(entry, agent, private_labels), private_labels),
+ )
+ )
+ + " |"
+ )
+ # Say why a row that looks worse than the verdict does not contradict
+ # it, but only about rows this table actually shows.
+ if status == "PASS" and gate_passed and any(entry.verdict == "fail" for entry in breakdown):
+ lines.extend(
+ [
+ "",
+ (
+ "A failing agent does not overturn this gate: it asks whether any one supported agent "
+ "passed every dimension, and one did."
+ ),
+ ]
+ )
+ elif status == "PASS" and gate_passed and any(entry.verdict is None for entry in breakdown):
+ lines.extend(
+ [
+ "",
+ (
+ "An agent the gate did not count contributed no evidence either way: the gate asks "
+ "whether any one supported agent passed every dimension, and one did."
+ ),
+ ]
+ )
+ lines.append("")
+ return lines
+
+
def _skill_name(results: list[ValidationResult], ae: dict[str, Any] | None) -> str | None:
if ae:
summary = _mapping(ae.get("summary"))
diff --git a/tests/golden/benchmark_fail/BENCHMARK.md b/tests/golden/benchmark_fail/BENCHMARK.md
index 82d66405..2f220edd 100644
--- a/tests/golden/benchmark_fail/BENCHMARK.md
+++ b/tests/golden/benchmark_fail/BENCHMARK.md
@@ -2,6 +2,17 @@
> ❌ **Overall verdict: FAIL — Publication blocked**
+### Why This Verdict
+
+- Decision: **FAIL** — the evidence below blocks publication.
+- Tier 3 evidence: **FAIL** (not publication-complete; required for publication). Dimension gate: an agent passes when every dimension is at or above 50% and fails when any dimension is below 40%.
+- Blocking: A validator failed.
+
+| Agent | Dimension gate | Evidence the gate read |
+|---|---|---|
+| Claude Code | not counted | no complete dimension set was recorded, so the gate read nothing from this agent |
+| Codex | not counted | no complete dimension set was recorded, so the gate read nothing from this agent |
+
The skill should be reviewed before publication. Address the blocking findings below, then rerun SkillEvaluator.
## Evaluation Metadata
diff --git a/tests/golden/benchmark_pass/BENCHMARK.md b/tests/golden/benchmark_pass/BENCHMARK.md
index 930fe27b..658c7f6e 100644
--- a/tests/golden/benchmark_pass/BENCHMARK.md
+++ b/tests/golden/benchmark_pass/BENCHMARK.md
@@ -2,6 +2,16 @@
> ✅ **Overall verdict: PASS — Recommended for publication**
+### Why This Verdict
+
+- Decision: **PASS** — every publication-required tier passed and the Tier 3 dimension gate passed.
+- Tier 3 evidence: **PASS** (publication-complete; required for publication). Dimension gate: an agent passes when every dimension is at or above 50% and fails when any dimension is below 40%.
+
+| Agent | Dimension gate | Evidence the gate read |
+|---|---|---|
+| Claude Code | pass | every dimension at or above the 50% PASS boundary (lowest: Security 92.0%) |
+| Codex | pass | every dimension at or above the 50% PASS boundary (lowest: Security 88.0%) |
+
## Publication Recommendation
Recommended for publication based on the completed evaluation evidence in this report.
diff --git a/tests/reporting/test_verdict_evidence.py b/tests/reporting/test_verdict_evidence.py
new file mode 100644
index 00000000..27d107a1
--- /dev/null
+++ b/tests/reporting/test_verdict_evidence.py
@@ -0,0 +1,376 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""The full report must show the evidence and policy that decided the verdict.
+
+Issue #192: a card declared ``Overall verdict: PASS`` while one agent carried
+no dimension scores and another sat below the documented FAIL boundary, and the
+report displayed nothing that explained the decision.
+"""
+
+from __future__ import annotations
+
+from copy import deepcopy
+from typing import TYPE_CHECKING, Any
+
+import pytest
+from tests.golden.test_benchmark_card import _deterministic_results, _live_tier3_result
+
+from skillevaluator.constants import DIMENSION_MAPPING
+from skillevaluator.evaluation.tier3_report import advisory_skip_result
+from skillevaluator.reporting import BenchmarkReporter
+from skillevaluator.reporting.base import agent_eval_dimension_breakdown, agent_eval_dimension_verdict
+from skillevaluator.reporting.benchmark import _overall_status, _publication_assessment
+
+if TYPE_CHECKING:
+ from skillevaluator.models.result import ValidationResult
+
+_EVIDENCE_HEADING = "### Why This Verdict"
+
+
+def _dimensions(baseline: float, with_skill: float, overrides: dict[str, float] | None = None) -> list[dict]:
+ rows = []
+ for dimension in DIMENSION_MAPPING:
+ score = (overrides or {}).get(dimension, with_skill)
+ rows.append({"id": dimension, "baseline": baseline, "with_skill": score, "lift": score - baseline})
+ return rows
+
+
+def _succeeded_conditions() -> dict[str, dict[str, Any]]:
+ return {
+ arm: {
+ "execution_status": "succeeded",
+ "execution_errors": [],
+ "expected_attempts": 24,
+ "scored_attempts": 24,
+ }
+ for arm in ("with_skill", "without_skill")
+ }
+
+
+def _issue_192_results() -> list[ValidationResult]:
+ """Build the run issue #192 reports, as current ``main`` can produce it.
+
+ ``claude-code`` is the agent whose dimension scores were withheld, so the
+ gate reads nothing from it. ``codex`` scores Security below the FAIL
+ boundary. ``gemini-cli`` passes every dimension, which is what the gate
+ actually answers, so the run is still a PASS.
+ """
+ results = [*deepcopy(_deterministic_results()), deepcopy(_live_tier3_result())]
+ payload = results[-1].metadata["agent_eval"]
+ agents = payload["agents"]
+
+ claude = agents["claude-code"]
+ for field in ("dimensions", "baseline", "with_skill", "lift"):
+ claude.pop(field, None)
+
+ codex_dimensions = _dimensions(0.55, 0.88, {"security": 0.238})
+ codex = agents["codex"]
+ codex["dimensions"] = codex_dimensions
+ codex["baseline"] = 0.55
+ codex["with_skill"] = sum(row["with_skill"] for row in codex_dimensions) / len(codex_dimensions)
+ codex["lift"] = codex["with_skill"] - 0.55
+
+ gemini_dimensions = _dimensions(0.5, 0.9)
+ agents["gemini-cli"] = {
+ "model": "gemini-pro",
+ "execution_status": "succeeded",
+ "execution_errors": [],
+ "expected_attempts": 48,
+ "scored_attempts": 48,
+ "conditions": _succeeded_conditions(),
+ "baseline": 0.5,
+ "with_skill": 0.9,
+ "lift": 0.4,
+ "dimensions": gemini_dimensions,
+ "evaluators": {"accuracy": {"baseline": 0.5, "with_skill": 0.9}},
+ }
+
+ for container in (payload, payload["summary"]):
+ container["best_agent"] = "gemini-cli"
+ container["agents_run"] = ["claude-code", "codex", "gemini-cli"]
+ container["overall_score"] = 0.9
+ container["overall_lift"] = 0.4
+ container["expected_attempts"] = 144
+ container["scored_attempts"] = 144
+ payload["dimensions"] = gemini_dimensions
+ return results
+
+
+def _render(results: list[ValidationResult]) -> str:
+ return BenchmarkReporter(include_timestamp=True).render_all(results)
+
+
+def _evidence_block(rendered: str) -> str:
+ assert _EVIDENCE_HEADING in rendered, rendered[:400]
+ block = rendered.partition(_EVIDENCE_HEADING)[2]
+ return block.partition("\n## ")[0]
+
+
+def test_issue_192_pass_shows_the_agent_and_dimensions_that_decided_it() -> None:
+ results = _issue_192_results()
+ rendered = _render(results)
+
+ assert "Overall verdict: PASS" in rendered
+ block = _evidence_block(rendered)
+ # The rule that fired, not a restatement of the label.
+ assert "- Decision: **PASS**" in block
+ assert "Tier 3 dimension gate passed" in block
+ # The agent that satisfied the gate, and the one that did not.
+ assert "| Gemini Cli | pass |" in block
+ assert "| Codex | fail |" in block
+ # The dimension the reporter saw below the documented FAIL boundary.
+ assert "Security 23.8% below the 40% FAIL boundary" in block
+ # The agent with no dimension scores is named, not silently absent.
+ assert "| Claude Code | not counted |" in block
+ assert "no complete dimension set was recorded" in block
+ # Why a failing agent does not contradict the PASS.
+ assert "A failing agent does not overturn this gate" in block
+
+
+def test_issue_192_evidence_block_precedes_the_metadata_section() -> None:
+ rendered = _render(_issue_192_results())
+ assert rendered.index(_EVIDENCE_HEADING) < rendered.index("## Evaluation Metadata")
+
+
+def test_excluded_agent_arm_reason_is_rendered() -> None:
+ results = _issue_192_results()
+ payload = results[-1].metadata["agent_eval"]
+ payload["agents"]["claude-code"]["conditions"]["without_skill"] = {
+ "execution_status": "failed",
+ "execution_errors": ["trial-7: AgentTimeoutError: deadline exceeded"],
+ "expected_attempts": 24,
+ "scored_attempts": 0,
+ }
+
+ block = _evidence_block(_render(results))
+ assert "| Claude Code | not counted |" in block
+ assert "baseline unavailable (0 of 24 attempts scored)" in block
+
+
+def test_failing_agent_alone_renders_a_fail_with_its_blocking_reason() -> None:
+ results = _issue_192_results()
+ payload = results[-1].metadata["agent_eval"]
+ del payload["agents"]["gemini-cli"]
+ for container in (payload, payload["summary"]):
+ container["best_agent"] = "codex"
+ container["agents_run"] = ["claude-code", "codex"]
+ container["verdict"] = "fail"
+ container["expected_attempts"] = 96
+ container["scored_attempts"] = 96
+ payload["dimensions"] = payload["agents"]["codex"]["dimensions"]
+
+ rendered = _render(results)
+ assert "Overall verdict: FAIL" in rendered
+ block = _evidence_block(rendered)
+ assert "- Decision: **FAIL**" in block
+ assert "- Blocking: " in block
+ assert "| Codex | fail |" in block
+ assert "Security 23.8% below the 40% FAIL boundary" in block
+ assert "A failing agent does not overturn this gate" not in block
+
+
+def test_neutral_verdict_names_the_dimension_below_the_pass_boundary() -> None:
+ results = _issue_192_results()
+ payload = results[-1].metadata["agent_eval"]
+ del payload["agents"]["claude-code"]
+ del payload["agents"]["codex"]
+ neutral_dimensions = _dimensions(0.4, 0.9, {"efficiency": 0.45})
+ gemini = payload["agents"]["gemini-cli"]
+ gemini["dimensions"] = neutral_dimensions
+ gemini["baseline"] = 0.4
+ gemini["with_skill"] = sum(row["with_skill"] for row in neutral_dimensions) / len(neutral_dimensions)
+ gemini["lift"] = gemini["with_skill"] - 0.4
+ for container in (payload, payload["summary"]):
+ container["best_agent"] = "gemini-cli"
+ container["agents_run"] = ["gemini-cli"]
+ container["verdict"] = "neutral"
+ container["overall_score"] = gemini["with_skill"]
+ container["overall_lift"] = gemini["lift"]
+ container["expected_attempts"] = 48
+ container["scored_attempts"] = 48
+ payload["dimensions"] = neutral_dimensions
+
+ rendered = _render(results)
+ assert "Overall verdict: NEUTRAL" in rendered
+ block = _evidence_block(rendered)
+ assert "- Decision: **NEUTRAL**" in block
+ assert "Efficiency 45.0% below the 50% PASS boundary" in block
+
+
+def test_incomplete_verdict_lists_every_recorded_reason() -> None:
+ results = _issue_192_results()
+ payload = results[-1].metadata["agent_eval"]
+ payload["agents"]["gemini-cli"]["conditions"]["without_skill"]["scored_attempts"] = 11
+
+ rendered = _render(results)
+ assert "Overall verdict: INCOMPLETE" in rendered
+ block = _evidence_block(rendered)
+ assert "- Decision: **INCOMPLETE**" in block
+ assert "- Blocking: " in block
+ assert "not publication-complete" in block
+
+
+def test_skipped_tier3_is_named_with_its_publication_policy() -> None:
+ results = [
+ *deepcopy(_deterministic_results()),
+ advisory_skip_result("Live evaluation runtime unavailable", skill_name="demo-skill"),
+ ]
+
+ block = _evidence_block(_render(results))
+ assert "- Tier 3 live evaluation: skipped" in block
+ assert "no dimension evidence was recorded" in block
+ # The skip is advisory, so the card must still say what the policy asked for.
+ assert "optional by policy" in block or "required for publication" in block
+
+
[email protected]("tier3_state", ["absent", "skipped", "skipped-fail", "skipped-neutral", "skipped-unscored"])
+def test_optional_tier3_without_a_passing_gate_does_not_claim_one(tier3_state: str) -> None:
+ results = deepcopy(_deterministic_results())
+ results[0].metadata["benchmark_policy"] = {"tier3_required": False}
+ if tier3_state != "absent":
+ skipped = advisory_skip_result("Live evaluation intentionally omitted", skill_name="demo-skill")
+ if tier3_state != "skipped":
+ agent = deepcopy(_issue_192_results()[-1].metadata["agent_eval"]["agents"]["codex"])
+ if tier3_state == "skipped-neutral":
+ agent["dimensions"] = _dimensions(0.55, 0.45)
+ agent["with_skill"] = 0.45
+ agent["lift"] = -0.1
+ elif tier3_state == "skipped-unscored":
+ agent.pop("dimensions")
+ skipped.metadata["agent_eval"]["agents"] = {"codex": agent}
+ results.append(skipped)
+
+ rendered = _render(results)
+ block = _evidence_block(rendered)
+
+ assert "Overall verdict: PASS" in rendered
+ assert "optional by policy" in block
+ assert "Tier 3 dimension gate passed" not in block
+ assert "and one did" not in block
+
+
+def test_recorded_neutral_verdict_is_explained_when_every_agent_passes_the_dimension_gate() -> None:
+ results = [*deepcopy(_deterministic_results()), deepcopy(_live_tier3_result())]
+ payload = results[-1].metadata["agent_eval"]
+ for container in (payload, payload["summary"]):
+ container["verdict"] = "neutral"
+
+ rendered = _render(results)
+ block = _evidence_block(rendered)
+
+ assert "Overall verdict: NEUTRAL" in rendered
+ assert "| Claude Code | pass |" in block
+ assert "| Codex | pass |" in block
+ assert "recorded Tier 3 verdict is neutral" in block
+ assert "no supported agent scored" not in block
+ assert "One or more dimensions remain below PASS" not in rendered
+
+
+def test_a_recorded_pass_without_passing_dimensions_does_not_invent_an_optional_policy() -> None:
+ results = [*deepcopy(_deterministic_results()), deepcopy(_live_tier3_result())]
+ for agent in results[-1].metadata["agent_eval"]["agents"].values():
+ agent["skill_activation"] = {"status": "never_activated"}
+
+ rendered = _render(results)
+ block = _evidence_block(rendered)
+
+ assert "Overall verdict: PASS" in rendered
+ assert "required for publication" in block
+ assert "optional by policy" not in block
+ assert "Tier 3 dimension gate passed" not in block
+ assert "recorded Tier 3 verdict is pass" in block
+
+
+ ("score", "expected"),
+ [
+ (0.3999, "| Codex | fail | Security 39.99% below the 40% FAIL boundary |"),
+ (0.4999, "| Codex | neutral | Security 49.99% below the 50% PASS boundary |"),
+ (
+ 0.5005,
+ "| Codex | pass | every dimension at or above the 50% PASS boundary (lowest: Security 50.1%) |",
+ ),
+ ],
+)
+def test_gate_evidence_preserves_score_bands_and_the_card_rounding_policy(score: float, expected: str) -> None:
+ results = _issue_192_results()
+ codex = results[-1].metadata["agent_eval"]["agents"]["codex"]
+ codex["dimensions"] = _dimensions(0.55, 0.88, {"security": score})
+ codex["with_skill"] = sum(row["with_skill"] for row in codex["dimensions"]) / len(codex["dimensions"])
+ codex["lift"] = codex["with_skill"] - codex["baseline"]
+
+ assert expected in _evidence_block(_render(results))
+
+
+def test_evidence_block_is_absent_from_the_tier3_scoped_report() -> None:
+ tier3_only = [_issue_192_results()[-1]]
+ rendered = BenchmarkReporter(include_timestamp=True, report_scope="tier3").render_all(tier3_only)
+ assert _EVIDENCE_HEADING not in rendered
+
+
+def test_untrusted_agent_identity_cannot_inject_markdown_structure() -> None:
+ results = _issue_192_results()
+ payload = results[-1].metadata["agent_eval"]
+ payload["agents"]["gemini-cli | ## Injected"] = payload["agents"].pop("gemini-cli")
+ for container in (payload, payload["summary"]):
+ container["best_agent"] = "gemini-cli | ## Injected"
+ container["agents_run"] = ["claude-code", "codex", "gemini-cli | ## Injected"]
+
+ block = _evidence_block(_render(results))
+ injected = [line for line in block.splitlines() if line.startswith("|") and "Injected" in line]
+ assert injected, block
+ for line in injected:
+ # The untrusted name keeps its text but cannot open a new table column
+ # or a new section.
+ assert "\\| ## Injected" in line
+ assert len(line.split(" | ")) == 3, line
+ assert "\n## Injected" not in block
+
+
+ "mutate",
+ [
+ pytest.param(lambda _payload: None, id="pass"),
+ pytest.param(lambda payload: payload["agents"].pop("gemini-cli"), id="fail"),
+ pytest.param(
+ lambda payload: payload["agents"]["codex"].update({"execution_status": "failed"}),
+ id="agent-not-supported",
+ ),
+ pytest.param(
+ lambda payload: payload["agents"]["gemini-cli"].update({"skill_activation": {"status": "never_activated"}}),
+ id="never-activated",
+ ),
+ ],
+)
+def test_rendered_explanation_never_contradicts_the_computed_verdict(mutate) -> None:
+ """The printed decision is the status ``_overall_status`` computes."""
+ results = _issue_192_results()
+ mutate(results[-1].metadata["agent_eval"])
+ ae = results[-1].metadata["agent_eval"]
+
+ status = _overall_status(results, ae, {}, expected_skill_name="demo-skill")
+ rendered = _render(results)
+ assert f"Overall verdict: {status}" in rendered
+ assert f"- Decision: **{status}**" in _evidence_block(rendered)
+
+
+def test_breakdown_folds_into_the_same_dimension_verdict() -> None:
+ """The gate verdict is a fold of the breakdown the card renders."""
+ payload = _issue_192_results()[-1].metadata["agent_eval"]
+ breakdown = agent_eval_dimension_breakdown(payload)
+
+ assert {entry.name: (entry.state, entry.verdict) for entry in breakdown} == {
+ "claude-code": ("incomplete_evidence", None),
+ "codex": ("scored", "fail"),
+ "gemini-cli": ("scored", "pass"),
+ }
+ assert agent_eval_dimension_verdict(payload) == "pass"
+ assert (
+ _publication_assessment(
+ _issue_192_results(),
+ payload,
+ expected_skill_name="demo-skill",
+ ).tier3.status
+ == "pass"
+ )