Always remove linked worktree workspaces before archive cleanup (#53672)

When archiving a thread's last reference to a linked worktree, the
worktree workspace must be removed from the MultiWorkspace before the
background cleanup task runs `git worktree remove`. Previously, only the
workspace found via exact PathList match on the thread's `folder_paths`
was removed. This missed cases where the workspace's root paths diverged
from the thread's `folder_paths` (e.g. after folders were added/removed
from the workspace).

Now we also scan `roots_to_archive` for any linked worktree workspaces
that contain the worktree being archived and include them in the removal
set. This ensures all editors are dropped, releasing their
`Entity<Worktree>` references (held through `File` structs in buffers),
so `wait_for_worktree_release` completes and `git worktree remove` can
proceed.

Release Notes:

- Fixed some linked worktree directories not always being cleaned up
from disk when archiving a thread.
15dce9de1cRichard Feldman committed on 4/13/2026, 9:02:32 PM· committed by GitHubparent25e02cb
5 files changedLine totals unavailable