Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No Plonge rule covers the temporary directory (
$TMPDIRon macOS,$TMPDIRor/tmpon Linux), where coding agents can leave tens of thousands of entries. Running apps and agents also keep files there that they still need, so a rule must select only entries that nothing is using.This adds a built-in
tmpdirprune rule, likexcode-derived-data. It runs withscan --globalandclean --global, is a dry run without--apply, and needs no--include-clear. It resolves the directory's real path and skips the rule when that path is/, the home directory or one of its ancestors, or in a Git repository, or whenlsofis missing or fails. It looks only at entries directly in the directory and selects one only when it and everything in it last changed, by the later of modification time and status change time, at leasttmpdir_age_hoursago. The default is 24 hours, because macOS'scom.apple.bsd.dirhelperjob runs daily withCLEAN_FILES_OLDER_THAN_DAYS=3, so a 7-day period would select little on macOS.The rule leaves alone, without checks, names that the system manages:
com.apple.*,TemporaryItems,.AddressBookLocks, andcryptex*on macOS, and.X11-unixand the other X11 socket directories,.X*-lock,systemd-private-*, andsnap-private-tmpon Linux. It refuses, and lists with the reason, a stale entry that is a symlink, belongs to another user, is open or is a working directory aslsof -F nreports, is or holds a socket, named pipe, or device, holds something that changed within the period, or is or holds a Git repository by the existing walk. With--apply, it runslsofand the checks again right before each deletion.lsofsees only the processes that it can inspect, which without root are the user's own. It cannot see a program that will use a path later without holding it open now. The rule reference lists these limits.The command and MCP tests now set
TMPDIRto a directory inside their fake home, soclean --global --applyin the tests cannot reach the real temporary directory.