Skill report generator crashes when history is empty
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4k
- Forks
- 453
- Avg merge
- 12h 30m
- Merged PRs (30d)
- 46
Description
Summary
skills/skill-creator/scripts/generate_report.py::generate_html() assumes that history contains at least one iteration. Passing an empty history raises ValueError: max() iterable argument is empty instead of producing an empty or "no iterations yet" report. This makes the report generator brittle for early live-report states, partial results, or callers that want to render a valid report before the first evaluation result exists.
Code path
skills/skill-creator/scripts/generate_report.py:16-20initializeshistory = data.get("history", []).skills/skill-creator/scripts/generate_report.py:25-30handles query discovery only when history is non-empty.skills/skill-creator/scripts/generate_report.py:205-209always callsmax(history, ...)when choosing the best iteration, even ifhistoryis empty.skills/skill-creator/scripts/run_loop.pyusesgenerate_html()for live report generation during the optimization loop, so this helper is part of the skill-creator reporting path.
Steps to reproduce
Validation level: dynamic reproduction plus source-control-flow inspection.
import importlib.util
from pathlib import Path
path = Path("skills/skill-creator/scripts/generate_report.py")
spec = importlib.util.spec_from_file_location("generate_report", path)
generate_report = importlib.util.module_from_spec(spec)
spec.loader.exec_module(generate_report)
generate_report.generate_html({"history": []})
Observed output:
ValueError: max() iterable argument is empty
Expected behavior
generate_html({"history": []}) should return a valid HTML report with summary information and an empty-state message, or at least a valid report shell that says no iterations have been recorded yet.
Actual behavior
The function raises ValueError at the best-iteration selection step:
max() iterable argument is empty
Existing coverage
I searched current issues and PRs for generate_report.py, generate_html, history, empty, ValueError, max() iterable, and Skill Description Optimization. I did not find an existing issue or PR that covers this root cause.
Suggested fix
Add an early empty-state branch before computing best_iter. For example:
- if
historyis empty, render the summary, legend, and a one-row/paragraph empty-state message; - skip best-row highlighting when there is no iteration;
- keep the existing behavior unchanged for non-empty history.
Suggested tests
- Add a unit test for
generate_html({"history": []})that asserts it returns valid HTML and contains an empty-state message. - Add a test for the existing non-empty path to ensure best-row highlighting still works.
- Add a live-report smoke test that renders before the first optimization iteration completes.
Submitted with Codex.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with skills/skill-creator/scripts/generate_report.py, especially generate_html() and the best-iteration selection around lines 205-209. Reproduce the failure with generate_html({"history": []}), then add coverage for the empty-history report and the existing non-empty best-row behavior. Done means the empty input returns valid HTML with an empty-state message while non-empty reports remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100