Fix UnboundLocalError on the report-reuse path

The progress-reporter setup lived inside the generation branch; reuse
skipped it but the success path still advanced the overall bar ->
'cannot access local variable progress_reporter'. Setup now runs for
every path (reuse included).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-14 06:24:10 +00:00
parent 7eb7b26786
commit 6f19719df2

View File

@ -755,11 +755,12 @@ def _cmd_eval_run(args) -> int:
except Exception:
pass # unreadable/stale report: score normally
if report is None and model_spec: # generate + score in one go
from evalharness.model import run_eval
# progress reporter setup runs for EVERY path (report reuse
# included): the success path advances the overall bar even when
# nothing was generated -- previously this block lived inside the
# generation branch and reuse blew up with UnboundLocalError
progress_reporter = None
if args.progress:
if args.progress and model_spec:
from evalharness.progress import PROGRESS_REGISTRY
_pname = getattr(args, 'progress_plugin', 'rich') \
@ -784,6 +785,9 @@ def _cmd_eval_run(args) -> int:
_shared_reporter.owned_externally = True
progress_reporter = _shared_reporter
if report is None and model_spec: # generate + score in one go
from evalharness.model import run_eval
def status_callback(msg, _idx=i + 1, _name=name,
_reporter=progress_reporter,