# REPORT — the self-update folder cleans itself (R-1368 part 2) — committed, NOT released (2026-11-10, operator brief) **Plain words first.** Each agent update left its downloaded file on the box for ever: 49 files and 740 MB on demo-hp. The agent now removes the old files after an update that ended well. It keeps the file of the version that runs. This is a commit only. No version, no build, no vouch. No box has it. It waits for the next agent release. The full report of the run is in `felhom.eu`: `REPORT-endings-kernels-fixes-2026-11-10.md`. | | | |---|---| | Change | `internal/selfupdate/prune.go` (new); the call in `MaybeCommit` (`commit.go`); one lock in `Execute` (`executor.go`) | | Rule | After the wrapper's `commit` returned success: remove every staged binary but the running version's | | Never removed | anything while `pending.json` exists or cannot be read; anything at a plain start or after a rollback; `pending.json`; a folder; a symlink; a name the code does not know | | Rollback | Needs `pending.json` and `/usr/local/bin/felhom-agent.prev`. It reads no staged binary (`configs/felhom-selfupdate-guarded`, read first) | | Tests | `TestPrune_*`, 6 tests. One runs the wrapper's real `commit` and `rollback` verbs from a sandboxed copy | | Red seen | 3 times: no prune call; no pending refusal; no regular-file check | | Gates | `python3 scripts/agent_gates.py --fast`: all OK | | Not reached | `/usr/local/bin/felhom-agent.bak-*`: root-owned, made by a person. R-1368 part 4 stays open | | Not proven | On a box. A box cleans its folder at the first good update AFTER the release that brings this code | | Machines | None touched by this change | **Next.** A release session builds and vouches it. After two updates on a test box, read the folder: it must hold one binary.