Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ All notable changes to SkillEvaluator are documented in this file.

### Added

- The Tier 3 report data and JSON report record which execution backend ran the
evaluation, as `execution_backend` (`harbor` or `nemo-gym`), next to the sandbox
`environment`.
- `report.html` shows the Tier 3 execution backend (Harbor or NeMo Gym) beside the
sandbox environment, in the agent evaluation summary and the evaluation dataset header.
- Document measured real-provider saved-catalog scale separately from 5,000-entry
in-memory qualification, as fixture-dependent examples rather than guarantees.
- `harness` results flag a project skill that has a same-named copy in a user-level
Expand Down
18 changes: 18 additions & 0 deletions src/skillevaluator/evaluation/tier3_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ def agent_eval_result_from_directory(
evaluated_source=evaluated_source,
use_llm_judge=use_llm_judge,
enforce_embedded_size=enforce_embedded_size,
execution_backend=_execution_backend_name(engine_result, persisted_result, run_config),
)
_apply_engine_failure(payload, engine_result if isinstance(engine_result, dict) else persisted_result)
with contextlib.suppress(Exception):
Expand Down Expand Up @@ -795,6 +796,7 @@ def build_agent_eval_payload(
evaluated_source: dict[str, Any] | None = None,
use_llm_judge: bool = True,
enforce_embedded_size: bool = True,
execution_backend: str | None = None,
) -> dict[str, Any] | None:
"""Assemble the canonical Tier 3 ``agent_eval`` payload from loaded agent data.

Expand Down Expand Up @@ -1072,6 +1074,7 @@ def build_agent_eval_payload(
"required_checks": verdict_source.get("required_checks") if verdict_source else None,
"security_clean": verdict_source.get("security_clean") if verdict_source else None,
"environment": env_mode,
"execution_backend": execution_backend,
"runtime_seconds": _finite_float(runtime_seconds) or 0.0,
"evaluated_at": evaluated_at,
"evaluator_version": evaluator_version,
Expand Down Expand Up @@ -1878,6 +1881,7 @@ def _replace_with_minimal_payload(payload: dict[str, Any], report_budget: _Repor
"security_clean",
"verdict_reason",
"environment",
"execution_backend",
"runtime_seconds",
"score_policy",
"execution_status",
Expand Down Expand Up @@ -4894,6 +4898,20 @@ def _read_attempt_policy(run_dir: Path) -> dict[str, Any]:
return policy


def _execution_backend_name(*sources: object) -> str:
"""Return the backend a run recorded; Harbor runs record none."""
from skillevaluator.tier3.nemo_gym.backend import EXECUTION_BACKENDS, HARBOR_BACKEND

for source in sources:
if not isinstance(source, dict):
continue
backend = source.get("execution_backend")
name = backend.get("name") if isinstance(backend, dict) else backend
if name in EXECUTION_BACKENDS:
return str(name)
return HARBOR_BACKEND


def _read_run_config(run_dir: Path) -> dict[str, Any]:
run_config_file = run_dir / "run_config.json"
if run_config_file.exists():
Expand Down
2 changes: 2 additions & 0 deletions src/skillevaluator/reporting/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -3309,6 +3309,7 @@ def merge_strings(value: object, additions: list[str]) -> list[str]:
"publication_target_conflict",
"run_id",
"environment",
"execution_backend",
"evaluated_at",
"evaluator_version",
"benchmark_policy",
Expand All @@ -3325,6 +3326,7 @@ def merge_strings(value: object, additions: list[str]) -> list[str]:
"publication_target_conflict",
"run_id",
"environment",
"execution_backend",
"evaluated_at",
"evaluator_version",
"benchmark_policy",
Expand Down
4 changes: 4 additions & 0 deletions src/skillevaluator/reporting/templates/report.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,7 @@
<div class="hero-side">
{% if has_tier3 %}
{% set tier3_environment = (tier3.summary.environment if tier3.summary is defined and tier3.summary else None) or tier3.environment %}
{% set tier3_backend = {'harbor': 'Harbor', 'nemo-gym': 'NeMo Gym'}.get(tier3.summary.execution_backend if tier3.summary is defined and tier3.summary else None) %}
Comment thread
chrisknvidia marked this conversation as resolved.
Resolved
{% if tier3_is_skipped %}
<span class="verdict-chip warn">Tier 3 quality: {{ verdict_words['skipped'] }}</span>
<div class="agent-hero-detail">
Expand Down Expand Up @@ -3910,6 +3911,8 @@
<span class="t3-ds-chip">{{ content_label }}: <b>{{ tier3.skill_name or 'unknown' }}</b></span>
{% if t3_best_name %}<span class="t3-ds-chip">Best Performing Agent: <b>{{ t3_best_name }}</b></span>{% endif %}
{% set t3_env = (tier3.summary.environment if tier3.summary is defined and tier3.summary else None) or tier3.environment %}
{% set t3_backend = {'harbor': 'Harbor', 'nemo-gym': 'NeMo Gym'}.get(tier3.summary.execution_backend if tier3.summary is defined and tier3.summary else None) %}
{% if t3_backend %}<span class="t3-ds-chip">Backend: <b>{{ t3_backend }}</b></span>{% endif %}
{% if t3_env %}<span class="t3-ds-chip">Environment: <b>{{ t3_env }}</b></span>{% endif %}
<span class="t3-ds-chip">Schema: <b>v{{ tier3.schema_version or '2.0' }}</b></span>
</div>
Expand Down Expand Up @@ -4726,6 +4729,7 @@
{% if has_tier3 %}<div><strong>Agent evaluation</strong> {% if completed_agent and completed_agent.recovered_attempts %}<div>{{ completed_agent.recovered_attempts }} timeout attempt(s) recovered; failed history retained.</div>{% endif %}
<div class="trial-coverage">{{ hero_trials }}</div>{% for detail in presentation.coverage.details %}<div>{{ detail }}</div>{% endfor %}
<div><strong>Metrics:</strong> {{ hero_metric_count }} evaluators</div>
{% if tier3_backend %}<div><strong>Backend:</strong> {{ tier3_backend }}</div>{% endif %}
{% if tier3_environment %}<div><strong>Environment:</strong> <code>{{ tier3_environment }}</code></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 %}
Expand Down
124 changes: 124 additions & 0 deletions tests/reporting/test_execution_backend_reporting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""The Tier 3 report payload names the execution backend a run used."""

from __future__ import annotations

import json

import pytest

from skillevaluator.evaluation import tier3_report
from skillevaluator.reporting import HTMLReporter
from skillevaluator.tier3.harbor import report_data
from skillevaluator.tier3.harbor.metrics import DEFAULT_METRICS


def _agents():
scores = dict.fromkeys(DEFAULT_METRICS, 1.0)
baseline = dict.fromkeys(DEFAULT_METRICS, 0.5)
return {
"agent": {
"execution_status": "succeeded",
"with_skill": scores,
"without_skill": baseline,
"rewards": [{**scores, "entry_id": "case", "trial_id": "case__attempt1"}],
"rewards_baseline": [{**baseline, "entry_id": "case", "trial_id": "case__attempt1"}],
"num_trials": 1,
"num_trials_baseline": 1,
}
}


def _result(monkeypatch, run_dir, **kwargs):
monkeypatch.setattr(report_data, "load_agent_data", lambda *_args, **_kwargs: _agents())
result = tier3_report.agent_eval_result_from_directory(
run_dir / "demo", run_dir, env_mode="docker", use_llm_judge=False, **kwargs
)
assert result is not None
return result


def _payload(monkeypatch, run_dir, **kwargs):
return _result(monkeypatch, run_dir, **kwargs).metadata["agent_eval"]


@pytest.mark.parametrize(
("result_json", "expected"),
[
({}, "harbor"),
({"execution_backend": {"name": "nemo-gym", "version": "0.7.0rc0", "sandbox": "docker"}}, "nemo-gym"),
({"execution_backend": {"name": "unknown"}}, "harbor"),
],
)
def test_payload_records_the_backend_from_result_json(monkeypatch, tmp_path, result_json, expected):
(tmp_path / "result.json").write_text(json.dumps(result_json))

payload = _payload(monkeypatch, tmp_path)

assert payload["summary"]["execution_backend"] == expected
assert payload["summary"]["environment"] == "docker"


def test_live_engine_result_and_run_config_name_the_backend(monkeypatch, tmp_path):
gym = {"execution_backend": {"name": "nemo-gym", "version": "0.7.0rc0", "sandbox": "docker"}}
assert _payload(monkeypatch, tmp_path, engine_result=gym)["summary"]["execution_backend"] == "nemo-gym"

(tmp_path / "run_config.json").write_text(json.dumps(gym))
assert _payload(monkeypatch, tmp_path)["summary"]["execution_backend"] == "nemo-gym"


def test_payload_built_without_a_run_leaves_the_backend_unset():
payload = tier3_report.build_agent_eval_payload("demo", _agents(), use_llm_judge=False)

assert payload is not None
assert payload["summary"]["execution_backend"] is None


@pytest.mark.parametrize(
("result_json", "label"),
[({}, "Harbor"), ({"execution_backend": {"name": "nemo-gym", "sandbox": "docker"}}, "NeMo Gym")],
)
def test_html_report_shows_the_backend_beside_the_environment(monkeypatch, tmp_path, result_json, label):
(tmp_path / "result.json").write_text(json.dumps(result_json))

html = HTMLReporter(report_scope="tier3", include_timestamp=False).render_all([_result(monkeypatch, tmp_path)])

assert f"<div><strong>Backend:</strong> {label}</div>" in html
assert "<div><strong>Environment:</strong> <code>docker</code></div>" in html


@pytest.mark.parametrize(("backend", "label"), [("harbor", "Harbor"), ("nemo-gym", "NeMo Gym")])
def test_dataset_header_shows_the_backend_beside_the_environment(backend, label):
agent = {
"execution_status": "succeeded",
"execution_errors": [],
"expected_attempts": 1,
"scored_attempts": 1,
"with_skill": {"security": 1.0, "goal_accuracy": 1.0},
"rewards": [{"entry_id": "case", "security": 1.0, "goal_accuracy": 1.0}],
}
payload = tier3_report.build_agent_eval_payload(
"demo",
{"codex": agent},
dataset=[{"id": "case", "prompt": "Add 2 and 3."}],
env_mode="docker",
execution_backend=backend,
use_llm_judge=False,
)
result = tier3_report._validation_result_from_payload(payload)

html = HTMLReporter(report_scope="tier3", include_timestamp=False).render_all([result])

assert f'<span class="t3-ds-chip">Backend: <b>{label}</b></span>' in html
assert '<span class="t3-ds-chip">Environment: <b>docker</b></span>' in html


def test_html_report_omits_an_unrecorded_backend():
payload = tier3_report.build_agent_eval_payload("demo", _agents(), use_llm_judge=False)
result = tier3_report._validation_result_from_payload(payload)

html = HTMLReporter(report_scope="tier3", include_timestamp=False).render_all([result])

assert "Backend:" not in html
Loading