mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Cron task metadata writes can overlap closely enough that a timestamp-only $temp filename is not stable. Harden the atomic write path by using a collision-resistant temp name and retrying once when rename reports ENOENT. Constraint: Scheduled task persistence must keep atomic replace semantics in ~/.claude/scheduled_tasks.json Rejected: Add explicit file locking around every scheduled task write | more coordination overhead than the observed transient rename race warrants Confidence: high Scope-risk: narrow Directive: Keep scheduled task writes collision-resistant and retriable; do not revert to timestamp-only temp file names without reproducing concurrent writes Tested: bun test src/server/__tests__/scheduled-tasks.test.ts Not-tested: bun test src/server/__tests__/cron-scheduler.test.ts (existing timeouts and unrelated assertion failures in this checkout)