Repository navigation
fix(tier3): show the execution backend in report.html #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5fa3fcd
fix(tier3): record the execution backend in the Tier 3 report data
chrisknvidia 1f0f6e0
fix(tier3): show the execution backend in report.html
chrisknvidia 2420348
fix(tier3): omit a malformed execution backend from report.html inste…
chrisknvidia 581aa1c
test(reporting): exercise untrusted backend metadata rebuild
chrisknvidia a6c8b4d
Merge github/main into fix/tier3-report-html-backend
chrisknvidia a755ede
Merge fix/tier3-report-html-backend into the merge with main
chrisknvidia 8503a8a
Merge main into fix/tier3-report-html-backend
chrisknvidia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.