Before submitting#
Area#
Server / checkpointing
Steps to reproduce#
- On macOS, register a project whose root lives under
/tmp/... (which is a symlink to /private/tmp/...).
- Get two threads pointing at the same worktree directory, where one stored its
worktreePath as /tmp/foo and the other as /private/tmp/foo (for example one created through a path the user typed and one through a resolved picker path).
- Trigger the branch drift check after a turn completes.
Expected behavior#
Both threads are treated as sharing one worktree, so the drift check refuses to adopt a drifted checkout and any shared-worktree guard counts both references.
Actual behavior#
The comparison is raw string equality (other.worktreePath === thread.worktreePath in CheckpointReactor.ts), so the two spellings of the same directory count as different worktrees. The guard proposed in #9185 compares the same way in SQL (worktree_path = ?), so it would inherit the same blind spot: a removal that should be refused can slip through.
Impact#
Low in practice, most people keep projects under their home directory. But when it hits, the failure mode is the bad one these checks exist to prevent: a worktree removed or a branch adopted while another thread still points at the same directory through a different spelling. Normalizing with realpath before comparing (or at write time) would close it. Happy to send a small PR if this is worth fixing.