Summary
The Claude and Codex transcript harvesters can abort an entire sleep cycle when a live session file is removed or rotated between directory discovery and mtime sorting.
Reproduction
On main at 79124b37e9a6371e13b753f8bcd7adb1e493ade1, make os.path.getmtime raise FileNotFoundError for one collected transcript path, or delete a collected file before sorting:
# harvest.py and harvest_codex.py currently sort with:
paths.sort(key=lambda p: os.path.getmtime(p), reverse=True)
The exception escapes before any digest is returned. This is reachable during normal live-session cleanup/rotation, not only through malformed input.
Expected behavior
A vanished transcript should be skipped and harvesting should continue with the remaining files, matching the existing defensive behavior in the Pi harvester.
Actual behavior
FileNotFoundError escapes from the sort key and aborts the harvest, so skillopt-sleep run cannot process the night's remaining sessions.
Impact
A concurrent session cleanup can turn an otherwise recoverable read race into a failed nightly run.
Environment
SkillOpt-Sleep on main at 79124b37e9a6371e13b753f8bcd7adb1e493ade1; reproducible with Python 3.10+ and a mocked disappearing transcript path.
Summary
The Claude and Codex transcript harvesters can abort an entire sleep cycle when a live session file is removed or rotated between directory discovery and mtime sorting.
Reproduction
On
mainat79124b37e9a6371e13b753f8bcd7adb1e493ade1, makeos.path.getmtimeraiseFileNotFoundErrorfor one collected transcript path, or delete a collected file before sorting:The exception escapes before any digest is returned. This is reachable during normal live-session cleanup/rotation, not only through malformed input.
Expected behavior
A vanished transcript should be skipped and harvesting should continue with the remaining files, matching the existing defensive behavior in the Pi harvester.
Actual behavior
FileNotFoundErrorescapes from the sort key and aborts the harvest, soskillopt-sleep runcannot process the night's remaining sessions.Impact
A concurrent session cleanup can turn an otherwise recoverable read race into a failed nightly run.
Environment
SkillOpt-Sleep on
mainat79124b37e9a6371e13b753f8bcd7adb1e493ade1; reproducible with Python 3.10+ and a mocked disappearing transcript path.