Two cheap robustness gaps around run metadata:
1. One corrupt run-meta.json crashes end-of-batch stats. src/clawbench/runner/batch.py:451 does an unguarded json.loads(meta_file.read_text()) inside print_run_stats, which runs at batch.py:753 — before write_summary_json at :754. So a single malformed metadata file throws after a multi-hour batch, and batch-summary.json is never written at all.
2. The tool can produce that corrupt file itself. run_support/metadata.py:286-288 writes with a plain write_text (no temp file + rename). A run killed mid-write — and batch.py:338/:701 do SIGKILL on double Ctrl+C — can leave truncated JSON on disk.
Together: interrupt a batch, resume it, and the resumed batch can die at the summary step because of a file the previous interrupt truncated.
Ask:
try/except (json.JSONDecodeError, OSError) per run directory in print_run_stats — skip and warn, never abort the summary.
- Make
write_run_meta atomic (NamedTemporaryFile in the same directory + os.replace).
Two cheap robustness gaps around run metadata:
1. One corrupt
run-meta.jsoncrashes end-of-batch stats.src/clawbench/runner/batch.py:451does an unguardedjson.loads(meta_file.read_text())insideprint_run_stats, which runs atbatch.py:753— beforewrite_summary_jsonat:754. So a single malformed metadata file throws after a multi-hour batch, andbatch-summary.jsonis never written at all.2. The tool can produce that corrupt file itself.
run_support/metadata.py:286-288writes with a plainwrite_text(no temp file + rename). A run killed mid-write — andbatch.py:338/:701do SIGKILL on double Ctrl+C — can leave truncated JSON on disk.Together: interrupt a batch, resume it, and the resumed batch can die at the summary step because of a file the previous interrupt truncated.
Ask:
try/except (json.JSONDecodeError, OSError)per run directory inprint_run_stats— skip and warn, never abort the summary.write_run_metaatomic (NamedTemporaryFilein the same directory +os.replace).