mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-26 18:31:34 +01:00
An aborted admission's cleanup could delete a live sandbox root when a different admission, in the same or a different Runner process, had since reused the same deterministic path. The in-process ownership registry could not prove ownership across processes, since a second process always starts with an empty registry. Add an on-disk marker beside each sandbox root, claimed with O_CREAT|O_EXCL. Only the admission that wins that open call gets delete authority. A later claim for the same root is declined: it shares the root without delete authority and never overwrites the marker. Cleanup proves ownership by reading the marker back before every delete, and releases the marker when the owning admission ends, so a later admission can claim the same root after the first one closes. Co-authored-by: Paperclip <noreply@paperclip.ing>