From 391822bd2defef91d11c0a05981ba942fc0a0a61 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:34:36 -0700 Subject: [PATCH] fix(skill-creator): don't crash report generator on empty history generate_html() called max(history, ...) unconditionally, so rendering a report before the first iteration completes (empty history) raised ValueError: max() iterable argument is empty. Guard the empty case with best_iter = None; the highlight is only consumed by the per-iteration row loop, which does not run when history is empty. Closes #417 --- skills/skill-creator/scripts/generate_report.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/skills/skill-creator/scripts/generate_report.py b/skills/skill-creator/scripts/generate_report.py index 959e30a00..2bd01537c 100755 --- a/skills/skill-creator/scripts/generate_report.py +++ b/skills/skill-creator/scripts/generate_report.py @@ -202,8 +202,12 @@ def generate_html(data: dict, auto_refresh: bool = False, skill_name: str = "") """) - # Find best iteration for highlighting - if test_queries: + # Find best iteration for highlighting. history may be empty (e.g. a live + # report rendered before the first iteration completes); max() would raise + # ValueError, so skip highlighting when there is nothing to highlight. + if not history: + best_iter = None + elif test_queries: best_iter = max(history, key=lambda h: h.get("test_passed") or 0).get("iteration") else: best_iter = max(history, key=lambda h: h.get("train_passed", h.get("passed", 0))).get("iteration")