What's wrong with this entry?
The worktree removal and creation code now walks each directory component in a path without following symlinks, refusing to write into or remove a directory if any ancestor is a symlink (O_NOFOLLOW at every level). Rootless worktrees (agent directories that lost their git root) are now handled with a dedicated safe-remove path.
- New
assertDirChainRealfunction raisesELOOP/ENOTDIRat the first symlinked component removeAgentWorktreenow handles the rootless case (no git root) separately: verifies the directory is inside.claude/worktrees/, is not a git repo, and requires an explicitjob_delete_forcesource if the directory has any files- Hook-managed worktrees check for symlinks in the stored worktree path before invoking the remove hook
- Error messages distinguish: "stored worktree path is a symlink", "a component of the stored worktree path is a symlink", "path could not be verified — its resolution changed while being checked"
Path verifier (search for "assertDirChainReal: dir must be strictly inside base" or "Refusing to write under symlinked or non-directory path"). Rootless remove (search for "Removed agent worktree with no git root at:").
Strings lifted out of the shipped bundle, so the claim above can be checked against them.