mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-27 18:34:58 +08:00
15292ae76c
The setup preflight unloads *crash-looping* peers but ignores a more common leftover: a launchd plist (or systemd unit) whose program no longer exists, left behind when a NanoClaw checkout is deleted without running the uninstaller. The health probe can't see these because an unloaded/inactive job doesn't report via `launchctl print` / `systemctl show`, so they accumulate — the OS keeps retrying a missing binary forever. Detect a registration as dead when its `dist/index.js` target is absent on disk, then unload (best-effort) and delete the orphaned config file. Own-label and still-valid registrations are never touched. Adds peer-cleanup.test.ts (the file previously had no tests) covering both platforms: dead target removed, live target kept, own registration spared, unrecognized config ignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>