From 29ee85a8886474f88f4b2d02bfc68de33aebff88 Mon Sep 17 00:00:00 2001 From: Luke Inglis Date: Fri, 21 Aug 2026 10:05:16 -0400 Subject: [PATCH] Fix KeyError crash when non-eval JSON files exist in results/ load_previous_results() loads all .json files from results/, but some (like parity investigation outputs) lack 'model_slug' and 'forecasts' keys, causing a KeyError. Use .get() with a guard to skip these files. Co-Authored-By: Claude Opus 4.6 (1M context) --- eval.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eval.py b/eval.py index 910e6a0..0497a68 100644 --- a/eval.py +++ b/eval.py @@ -429,8 +429,11 @@ async def run_eval( if len(previous) >= 2: all_forecasts = {} for prev in previous: - slug = prev["model_slug"] - all_forecasts[str(slug)] = prev["forecasts"] # type: ignore[assignment] + slug = prev.get("model_slug") + fcs = prev.get("forecasts") + if slug is None or fcs is None: + continue + all_forecasts[str(slug)] = fcs # type: ignore[assignment] logger.info("difficulty_adjustment_enabled", n_peers=len(all_forecasts)) else: logger.info("difficulty_adjustment_skipped",