Todo 52.11 Bundle Interrupt and Path Safety Plan
Status: done
Goal
Close the post-symlink interruption window and constrain report bundle names to the configured output directory.
Observation
- A
KeyboardInterrupt can arrive after os.symlink() creates the public bundle entry but before the implementation records publication. Cleanup then removes the backing bundle and leaves a dangling public symlink.
- The optional
timestamp argument is used as a path component without basename validation, so an absolute path or separator-containing value can escape output_dir.
- Existing fsync tests count calls but do not prove that both report files, the bundle directory, and the output directory are the objects being synced.
Scope
- Add a regression that injects interruption immediately after successful symlink creation and prove the public bundle remains complete rather than dangling.
- Once public publication is attempted, retain the already-complete private bundle on ambiguous interruption/error paths; cleanup only before publication begins.
- Validate an explicit timestamp as a bounded safe basename using a conservative ASCII identifier character set; reject absolute paths, separators, dot segments, controls, and empty values before filesystem writes.
- Strengthen fsync tests to identify the two report files and both directories, not only count invocations.
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
uv run pytest tests/test_benchmark_reporting.py tests/test_benchmark_cli.py -q
uv run pytest
git diff --check