todo-52.8-benchmark-no-overwrite-publication.md 996 B

Todo 52.8 Benchmark No-Overwrite Publication Plan

Status: in_progress

Goal

Remove the final check-then-replace race from concurrent benchmark report publication.

Scope

  • Fully write and fsync JSON/Markdown temporary files in the destination directory.
  • Publish each file using os.link(temp, final), whose destination creation is atomic and fails if the path already exists.
  • If either candidate path conflicts, remove only links whose inode matches the current temporary file, choose the next suffix, and retry the pair.
  • Remove temporary files after both links succeed; retain no lock or placeholder files.
  • Test a competitor creating/replacing destinations immediately before each link call.

Files

  • Modify: src/agent_lab/infrastructure/benchmark_reporting.py
  • Modify: tests/test_benchmark_reporting.py

Verification

  • uv run pytest tests/test_benchmark_reporting.py -q
  • repeated concurrent/competitor stress tests
  • uv run pytest
  • git diff --check