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
Worktrees: a removal holds the session store's ownership mutex, so unrelated Sessions wait, and a non-force removal follows a swapped symlink #2124
A managed worktree removal runs the whole deletion inside the session store's ownership mutex, so any unrelated Session operation in the daemon waits for it, and the non-force removal follows a symlink that replaces the task directory after the content check.
SessionStore keeps one ownership mutex for Session creation, fork, deletion, worktree association and worktree record removal. Both removal operations hold it from their checks through the callback that deletes the directory: a Git worktree removal with a 30 second timeout, the recursive cleanup of a recorded root Git no longer lists, and the walk plus recursive forced deletion of an unregistered task directory (remove_worktree, remove_unregistered_directory). Every other Session operation in the process therefore queues behind a removal for as long as the file system takes, and both worktree operations are drain interruptions, so a shutdown waits too.
The non-force removal of an unregistered task directory deletes the empty children the content check recorded, one path at a time (remove_checked_entry, remove_empty_dir). Directory removal follows symlinks in intermediate components, so replacing the task directory with a symlink to another directory after the check makes the removal delete a same-named empty directory outside the managed root; only the last step then fails with "not a directory".
Verified with a local test against 6e86d48: a removal parked inside its deletion step keeps an unrelated Session creation from completing for both a recorded worktree and an unregistered task directory, and replacing a task directory that holds one recorded empty child with a symlink to another directory holding a same-named empty child deletes that outside directory.
The minimal reproduction needs no cleanup or timing: park a removal in its deletion step, ask for one Session creation at an unrelated workspace, and observe that it does not return until the removal is released.
Impact: a worktree whose tree is large or on a slow disk makes every Session creation, fork and deletion in the daemon wait, with no time limit for the recursive paths, and the non-force path deletes content outside the managed root when another actor replaces the task directory during the removal.
Expected: a removal refuses its own path for the whole deletion but releases the ownership mutex while it runs, and neither removal path follows a symlink out of the task directory.
Activity