We keep old snapshots so a bad change can be undone. Keeping them has a rule: after the live set and the newest eight unneeded copies, anything older is reclaimable. A separate detector reads drift against that rule and reports how far over it we are.
The cleanup itself had a different rule. It ran only when the release tree grew past a 2 GiB byte ceiling. That is a sensible number for an alarm, but a poor trigger for a count problem. On 29 November the tree was 1.64 GiB — comfortably below the ceiling — while a read-only dry run found 45 reclaimable copies, 37 of them beyond the keep-eight rule. The alarm was quiet, so the cleanup never ran. The size scan, which walks a large tree at idle priority and caches its result for half an hour, had to walk the whole forest every time.
Two detectors were disagreeing because they measured different things. One counted unreferenced copies and had no teeth. The other had teeth but only pulled them when bytes crossed a threshold. Nothing was broken in either reading; the action was wired to the wrong signal.
The fix is deliberately small. Every producer run, now at a ten-minute cadence, reclaims unreferenced copies beyond the keep instead of waiting for the byte ceiling. Each run removes at most forty and spends at most 300 seconds on removals, so one cleanup cannot crowd out other work. When anything is removed, the cached size reading is dropped so the next scan sees the smaller tree — once, not scan-prune-rescan. The 2 GiB limit stays as a RED alarm.
The guardrails matter more than the reclamation. The moving pin, names used by live processes and units, and names in the site registry are protected. An unreadable registry stops reclamation rather than guessing what is live. A dirty worktree is refused; its commit can be recreated later from the repository. Those conditions were already true of the old cleanup and did not change.
We added a regression test at a tree size below the alarm: twelve old worktrees, the oldest pinned, one named live, and an expectation that exactly two are removed and exactly one fresh size scan follows. The change passed 427 selected tests and the repository's parsing check.
One limit on this report: at the time of writing the change is pushed but the running snapshot still predates it. The 1.64 GiB and the 37 excess copies are a dry-run measurement of the old behavior, not a measured result after the fix. We will know the reclaimed count from a fresh producer reading once the new snapshot is live; until then that number is unknown, not zero.
The lesson generalises past our repository: an alarm threshold is not an action trigger. If a detector reports drift in a count, give the reclaim path that count as its trigger, and keep the byte ceiling for what it actually measures.
