Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(backups): prune orphaned, stale-active, and leaked staging dirs in backup roots

2 months ago

257bb2d
Authored
mweinbach7/6/2026, 4:53:33 PM
pruneClosedSessions only ever deleted dirs whose metadata.json said
state=closed, so backups from crashed or force-quit sessions (missing or
corrupt metadata, or stuck active) accumulated forever - observed 124GB
of unprunable March backups, including ~9GB .snapshot-stage-* mkdtemp
leftovers holding full workspace copies.

pruneBackupsRoot now also ages out metadata-less orphans (7d), corrupt
metadata dirs, abandoned active dirs (30d without a metadata write), and
leaked .*-stage-* staging dirs (24h), and runs on backup create() so
long-lived installs reclaim space even when close() never fires.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Parentb0105e5

2 files changed
  • src/server/sessionBackup.ts+119−17
  • test/session-backup.test.ts+98−2