You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Delete can remove an empty directory that appears between its stat and its removal #3
Delete asks the Host what the path names, and then asks it to remove the path. Those are two requests, and the Host can run other work between them. If something changes the path in that gap, Delete can remove something it meant to refuse.
What happens
crates/plugin-std/src/rm.rs calls source.stat(path), refuses a directory with a sentence, and then calls source.remove(path). The only removal in the contract is ToolCall::remove(path, recursive), and it takes a file, a link, or a directory with no entries. So the refusal of a directory has to come from the stat, and the stat is a separate request.
If another task replaces the file at path with a directory with no entries after the stat and before the removal, the removal takes that directory. Delete promises that it removes no directory. The docs in rm.rs and lib.rs already say this.
It cannot remove a directory that has entries, because the call passes recursive: false. The loss is limited to an empty directory.
Why it is open
Delete cannot close the gap with what the contract has today. Closing it takes a removal that fails when the path is a directory, in one request. Something like ToolCall::remove_file(path), or a directories: bool flag on remove, would do it. That is a change to runvil-plugin-api and to the Host side in runvil-harness, so it is not a change std can make alone.
Activity
Make the pages state what the `std` file tools do