mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
Address two production issues in the AttachmentStore: 1. TOCTOU race in resolvePath() — concurrent downloads with same filename in the same millisecond could collide. Fixed by appending a 6-char random suffix to the timestamp-based path, ensuring millisecond-level collisions never occur. 2. Orphan .part files from crashed writes never cleaned up. Fixed by extending gc() to recognize .part files and clean them with a shorter grace period (10 minutes by default) rather than the normal retention window. Added two test cases covering heavy collision pressure and .part cleanup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>