fix: pre-clean transient dirs + repeat cleanup before every mackup attempt

Root cause: Claude Code recreates ~/.claude/debug/latest (a dangling
symlink to the current debug session) almost immediately after it is
deleted. The old cleanup ran once before the retry loop, so any retry
after a 2s sleep would hit a freshly recreated symlink.

Fix: move _ssr_mackup_preclean() inside the retry loop so it runs
immediately before each mackup attempt, leaving no window for apps to
recreate problematic files.

Also remove known transient subdirectories by path before the generic
socket/dangling-link sweep:
  .claude/debug  .cursor/logs  .vscode/logs  .npm/_logs

Configurable via SSR_MACKUP_PRECLEAN_PATHS (space-separated, $HOME-relative).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-12 12:17:44 +02:00
parent 1d18dd6a48
commit 3e54f0ca20
2 changed files with 44 additions and 18 deletions
+6
View File
@@ -20,6 +20,12 @@ SSR_MACKUP_SUBDIR=Mackup
# ~/.mackup/ssr-custom.cfg before each backup. Set to "false" to opt out.
SSR_MACKUP_AUTODISCOVER=true
# Subdirs (relative to $HOME) to delete before each mackup backup attempt.
# Handles transient dirs with dangling symlinks or sockets (debug sessions,
# log dirs) that shutil.copytree cannot copy.
# Built-in defaults: .claude/debug .cursor/logs .vscode/logs .npm/_logs
# SSR_MACKUP_PRECLEAN_PATHS=".my-app/tmp .other-app/run"
# Extra paths (relative to $HOME) to always include, space-separated.
# Example: ".easymcp .my-tool .config/my-cli"
# SSR_MACKUP_EXTRA_PATHS=""