Skip to content

fix(sleep): tolerate disappearing transcript files - #285

Open
kaluli123123 wants to merge 1 commit into
microsoft:mainfrom
kaluli123123:fix/harvest-disappearing-transcripts-284
Open

kaluli123123 wants to merge 1 commit into
microsoft:mainfrom
kaluli123123:fix/harvest-disappearing-transcripts-284

Conversation

@kaluli123123

Copy link
Copy Markdown

Summary

  • prevent Claude and Codex transcript discovery from crashing when a live session file disappears during mtime ordering
  • keep harvesting the remaining files and preserve the existing digest behavior
  • add regression coverage for the concurrent-removal race in both harvesters

Root cause

Both harvesters sorted discovered paths with a direct os.path.getmtime call. Live transcript stores can remove or rotate a file after directory enumeration but before sorting, allowing FileNotFoundError to abort the entire harvest.

Changed behavior

A shared _safe_mtime returns a sortable fallback for paths that disappear or become inaccessible. The later transcript read remains fail-closed, so the vanished file is skipped and other sessions continue.

Test plan

  • python3 -m unittest -q tests.test_harvest_race tests.test_harvest_pi tests.test_copilot_harvest tests.test_sleep_skill_harvest tests.test_split_wiring tests.test_holdout_integrity (48 passed)
  • python3 -m compileall -q skillopt_sleep tests/test_harvest_race.py (passed)
  • git diff --check (passed)

The repository-required python -m pytest -q could not run because this environment has no pytest module. The OpenCode-focused unittest modules likewise require that missing dependency.

Issue

Closes #284

Incomplete gates

Full pytest suite and remote CI remain maintainer/CI gates; no merge or issue close was performed locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skillopt-sleep harvest crashes when a transcript disappears during discovery

1 participant