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
Move a Kept Tree Whole in bootstrap.ps1, Since Move-Item Splits One Holding an Open File #2492
bootstrap.ps1 swaps a kept tree with Move-Item, on the premise its own comment states: a rename of a directory in use fails whole on Windows. Move-Item does not fail whole. When the directory rename fails, PowerShell 7 falls back to moving the tree entry by entry, so every entry it can move lands at the destination and the held one stays behind, and the error is raised only after that.
Measured natively on Windows with PowerShell 7.6, a tree t holding .bootstrap-owned, a, and locked/file, with locked/file open under FileShare.None:
Move-Item -LiteralPath t -Destination t2 -> IOException
t: locked, locked/file
t2: locked, .bootstrap-owned, a
[IO.Directory]::Move('t', 't3') -> access denied, nothing moved
In Invoke-SwapIn, moving the live skills-tree aside while Claude Code holds a file in it therefore:
empties the live tree the plugin loads down to its held files, and the run dies saying only that the move failed
moves the ownership marker into skills-tree.old, so the next run finds an unmarked skills-tree and refuses it as "this loader did not create it", which is wrong, and its remedy, another -Dir, abandons the tree instead of repairing it
The same fallback applies to Invoke-SwapIn's rollback and to Invoke-Cleanup's restore, both of which move skills-tree.old back.
Fix direction: move a tree with [IO.Directory]::Move through one helper, so a rename either happens whole or not at all, which is what the swap's ordering already assumes. bootstrap.sh's mv within one directory is a single rename(2) and is not affected.
Found while driving the loader's functions natively for #1791.
Activity
Drive bootstrap.ps1's Kept-Tree Functions from the Test Suite, and Mo…