Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,22 @@ All notable changes to SkillEvaluator are documented in this file.
Missing lift data is shown as `-`; custom-only and legacy agents retain their
arm-difference comparison.

- `skillevaluator view` no longer asks the LLM again when it regenerates a
missing `report.html` for a Tier 3 run that saved its report feedback in
`result.json`. The regenerated report shows the conclusions,
recommendations, and suggestions that run produced, makes no LLM call, and
reuses the run's `what_to_fix.json` when it has one. It also takes the run's
duration and any Harbor log links recorded in `result.json`, which the 0.8.0
rebuild left out. In 0.8.0 the Insights judge and the what-to-fix writer ran
again: with a provider configured that cost tokens and could change the
advice, without one the run's saved LLM advice was dropped, and either way
`what_to_fix.json` was overwritten. Feedback saved by 0.6.0 or earlier has
no per-case verdict, so the regenerated report adds the verdict and lists
the case fixes as its recommendations and suggestions, without the LLM, as a
new report does. A run that saved no feedback still has its feedback
rebuilt, with the LLM when a provider is configured, and its
`what_to_fix.json` rewritten.

## 0.8.0 - 2026-11-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ skillevaluator init-harbor-task ./my-skill

## view

Open the latest HTML live-evaluation report for a skill. If the results exist but `report.html` is missing, `view` regenerates it before opening.
Open the latest HTML live-evaluation report for a skill. If the results exist but `report.html` is missing, `view` regenerates it before opening. It reuses the feedback the run saved in `result.json`, and the run's `what_to_fix.json` when there is one, and makes no LLM call. A run that saved no feedback still has its feedback rebuilt, with the LLM when a provider is configured, and its `what_to_fix.json` rewritten.

```bash title="Open the latest report"
skillevaluator view ./my-skill
Expand Down
12 changes: 11 additions & 1 deletion docs/reports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,17 @@ policy, agent, model, and environment fixed when interpreting them.
### view

Opens the newest `report.html` for a skill in your browser, regenerating it
from the stored run data if the file is missing.
from the stored run data if the file is missing. The regenerated report reuses
the conclusions, recommendations, and suggestions the run saved in
`result.json`, so it shows the advice the run produced and makes no LLM call.
It also reuses the run's `what_to_fix.json`. When that file is missing or
unusable, `view` writes the rule-based fixes, which can differ from the
recommendations the run saved. The report also takes the run's duration and any
Harbor log links recorded in `result.json`. Feedback saved by 0.6.0 or earlier
has no per-case verdict, so the report adds the verdict and lists the case
fixes as its recommendations and suggestions, without the LLM, as a new report
does. A run that saved no feedback still has its feedback rebuilt, with the LLM
when a provider is configured, and its `what_to_fix.json` rewritten.

```bash title="Open the latest HTML report"
skillevaluator view ./my-skill
Expand Down
72 changes: 66 additions & 6 deletions src/skillevaluator/evaluation/tier3_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,14 @@ def render_agent_eval_html_report(
engine_result: dict[str, Any] | None = None,
use_llm_judge: bool = True,
include_benchmark: bool = False,
saved_feedback: dict[str, list[Any]] | None = None,
) -> Path:
"""Render a standalone Tier 3 HTML report and optional standard benchmark."""
"""Render a standalone Tier 3 HTML report and optional standard benchmark.

``saved_feedback`` is the report feedback a completed run saved in
``result.json``. It replaces the rebuilt feedback fields and nothing calls
an LLM; see ``_apply_saved_feedback``.
"""
from skillevaluator.reporting import BenchmarkReporter, HTMLReporter

skill_path = skill_path.expanduser().resolve()
Expand All @@ -625,14 +631,17 @@ def render_agent_eval_html_report(
run_dir,
env_mode=env_mode,
engine_result=engine_result,
use_llm_judge=use_llm_judge,
use_llm_judge=use_llm_judge and not saved_feedback,
)
if result is None:
raise ValueError(f"No agent results found in {run_dir}")

canonical_payload = result.metadata.get("agent_eval")
if isinstance(canonical_payload, dict):
_apply_case_findings(canonical_payload, engine_result, run_dir, skill_path, use_llm=use_llm_judge)
if saved_feedback:
_apply_saved_feedback(canonical_payload, saved_feedback, engine_result, run_dir, skill_path)
else:
_apply_case_findings(canonical_payload, engine_result, run_dir, skill_path, use_llm=use_llm_judge)
if engine_result is not None and isinstance(canonical_payload, dict):
# Persist only the compact feedback contract needed by the CLI. The
# complete canonical payload remains in the HTML report and can be much
Expand Down Expand Up @@ -3889,15 +3898,65 @@ def _recommendation_category_from(text: str) -> str:
return _RECO_CATEGORY_HINTS.get(first, "Action")


def _is_case_verdict(conclusion: object) -> bool:
"""Whether a conclusion is the per-case verdict that ``_apply_case_findings`` adds (the report headline)."""
return isinstance(conclusion, dict) and conclusion.get("title") == "Skill effect"


def _saved_case_fixes(run_dir: Path) -> list[dict[str, Any]] | None:
"""The run's ``what_to_fix.json`` when the report can show it as is, else ``None``."""
from skillevaluator.tier3.case_summary import load_case_findings

fixes = load_case_findings(run_dir)
if fixes is None or any(
not all(isinstance(fix.get(key), str) for key in ("case", "scope", "kind", "what"))
or not all(isinstance(fix.get(key) or "", str) for key in ("action", "evidence"))
for fix in fixes
):
return None
return fixes


def _apply_saved_feedback(
payload: dict[str, Any],
saved_feedback: dict[str, list[Any]],
engine_result: dict[str, Any] | None,
run_dir: Path,
skill_path: Path,
) -> None:
"""Show the report feedback a completed run saved, with no LLM call.

The case-findings pass still runs without the LLM, on the run's own
``what_to_fix.json`` when it is usable (otherwise it writes the rule-based
fixes), so what it adds beyond the saved fields stays. Saved conclusions
that carry the per-case verdict replace the pass's verdict and fixes, so
rule-based fixes written then can differ from the saved recommendations;
feedback saved before the verdict existed gets both added, as a fresh
render shows them.
"""
saved = {field: list(saved_feedback[field]) for field in _TIER3_FEEDBACK_FIELDS if field in saved_feedback}
fixes = _saved_case_fixes(run_dir)
if any(_is_case_verdict(item) for item in saved.get("conclusions", [])):
_apply_case_findings(payload, engine_result, run_dir, skill_path, use_llm=False, fixes=fixes)
payload.update(saved)
else:
payload.update(saved)
_apply_case_findings(payload, engine_result, run_dir, skill_path, use_llm=False, fixes=fixes)


def _apply_case_findings(
payload: dict[str, Any],
engine_result: dict[str, Any] | None,
run_dir: Path,
skill_path: Path,
*,
use_llm: bool,
fixes: list[dict[str, Any]] | None = None,
) -> None:
"""Lead the report with the case-based verdict and fixes; also saves them as what_to_fix.json for the CLI."""
"""Lead the report with the case-based verdict and fixes; also saves them as what_to_fix.json for the CLI.

``fixes`` already saved for the run are reused as they are and not written again.
"""
from skillevaluator.tier3.case_summary import goal_not_met_count, save_case_findings, what_to_fix
from skillevaluator.tier3.case_summary import verdict as case_verdict

Expand All @@ -3908,8 +3967,9 @@ def _apply_case_findings(
if not isinstance(source, dict) or not isinstance(source.get("agents"), dict):
return
try:
fixes = what_to_fix(source, run_dir=run_dir, skill_path=skill_path, use_llm=use_llm)
save_case_findings(run_dir, fixes)
if fixes is None:
fixes = what_to_fix(source, run_dir=run_dir, skill_path=skill_path, use_llm=use_llm)
save_case_findings(run_dir, fixes)
except Exception: # advisory: the report keeps its metric-based insights
logger.debug("Case findings skipped", exc_info=True)
return
Expand Down
20 changes: 19 additions & 1 deletion src/skillevaluator/tier3/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,25 @@ def view_results(skill_path: Path, *, results_dir: Path | None = None) -> Path:
target = latest.resolve() if latest.is_symlink() else latest
report_path = target / "report.html"
if not report_path.exists():
report_path = render_agent_eval_html_report(skill_path, target)
from skillevaluator.evaluation.tier3_feedback_chat import _read_result_json, saved_feedback_for_run
from skillevaluator.evaluation.tier3_report import _TIER3_FEEDBACK_FIELDS

saved_result = _read_result_json(target)
saved_feedback = saved_feedback_for_run(saved_result, target)
# A run saves every feedback field; anything less is rebuilt as before.
if saved_feedback and saved_feedback.keys() == set(_TIER3_FEEDBACK_FIELDS):
# Rebuild with the feedback this run saved. Asking the judge again
# costs tokens and can change the advice; with no provider it
# silently drops the advice the run saved.
report_path = render_agent_eval_html_report(
skill_path,
target,
engine_result=saved_result,
use_llm_judge=False,
saved_feedback=saved_feedback,
)
else:
report_path = render_agent_eval_html_report(skill_path, target)
console.print(f"Opening: [cyan]{escape_markup(str(report_path))}[/cyan]")
webbrowser.open(report_path.as_uri())
return report_path
Expand Down
Loading
Loading