Repository navigation
Sweep orphaned clipboard image files on shell startup - #20001
Conversation
Reclaim pre-existing orphaned files in clipboard-images/ (accumulated before #19966, left behind by legacy inode-less history entries, or orphaned by a crash) once on clipboard plugin initialization before watchers start. Serializes on the same .lock file as capture.sh, skips recent files, dotfiles, temp files, and symlinks, and bails out without deleting if clipboard-history.json is missing or unreadable. Co-authored-by: AnPod <[email protected]> Co-authored-by: JJDizz1L <[email protected]>
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds a startup sweep for old clipboard image files that history no longer references.
Intentional behavior acknowledged by Reviews (1) · Last reviewed commit: "Sweep orphaned clipboard image files on ..." · Reviewed by Greptile |
|
Classification is unsettled. GPT-6 in Codex classifies this as a bug fix because older orphaned clipboard images remain on disk after their history entries are gone; deepseek-v4p1-flash classifies it as an enhancement. Neither model’s effort setting is exposed in this result. I read the diff, discussion, and surrounding capture/history cleanup code. No code was changed or run on a worker, and no verification labels were added. This remains open at the classification-disagreement stage before verification can proceed. |
Reclaim pre-existing orphaned files in clipboard-images/ (accumulated before omacom#19966, left behind by legacy inode-less history entries, or orphaned by a crash) once on clipboard plugin initialization before watchers start. Serializes on the same .lock file as capture.sh, skips recent files, dotfiles, temp files, and symlinks, and bails out without deleting if clipboard-history.json is missing or unreadable. Co-authored-by: AnPod <[email protected]> Co-authored-by: JJDizz1L <[email protected]>
Extracted from #14266 by @AnPod and #14819 by @JJDizz1L.
#19966 added inode-checked pruning when newly captured image entries leave
clipboard-history.json, but existing installations still keep pre-#19966 orphaned images inclipboard-images/indefinitely, along with legacy inode-less entries after deletion/clear and any files orphaned by a shell crash before history is saved.This runs a lightweight startup sweep (
shell/plugins/clipboard/sweep.sh) fromClipboard.qml'sinitProcbefore watchers start:clipboard-history.jsonalready existed andclipboard-images/has non-hidden files.capture.shandpruneRemovedImagesviaflockon.lock(openedO_NOFOLLOW,0600).clipboard-history.jsonis unreadable, malformed, or not a JSON array, and preserves bothtype: "image"and legacykind: "image"references..lock,.gen), in-flightclipboard.*temp files, symlinks/non-regular files, and files modified within the last 60 seconds.Verified by Codex and Claude.