Repository navigation
perf(list): skip fsmonitor daemon starts when the daemon is running - #4284
Merged
Merged
Conversation
On macOS with the builtin fsmonitor enabled, `wt list` and the `wt switch` picker fork `git fsmonitor--daemon start` for every worktree before the per-row tasks can start, and in the steady state each of those forks exits "already running". `start_fsmonitor_daemon_at` now first connects to the worktree's `<git-dir>/fsmonitor--daemon.ipc` socket, the same check git's `start` makes before refusing, and forks only when nothing answers. Any connect failure falls through to the fork. The socket basename is now shared from `git::fsmonitor::IPC_SOCKET_NAME` with the `wt remove` stop path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
Sep 26, 2026
Closed
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On macOS with the builtin fsmonitor enabled (
core.fsmonitor=true),wt listand thewt switchpicker forkgit fsmonitor--daemon startfor every worktree inside the post-skeletonrayon::scope, and the per-row task pool can't start until all of them return. In the steady state nearly every start exits 128 "already running"; in a 128-worktree repo those forks cost 100–300ms before the pool opens.Repository::start_fsmonitor_daemon_atnow first connects to<git-dir>/fsmonitor--daemon.ipcand returns without forking if a daemon answers. That's the check git's ownstartmakes before refusing (ipc_get_active_stateconnects and closes). Any failure — no daemon, stale socket, unresolvable git dir, or a socket path longer thansun_path— falls through to the existing fork. The git dir is already primed from the worktree list on this path, so the probe runs no git command.The socket basename is now shared as
git::fsmonitor::IPC_SOCKET_NAMEwith thewt removestop path.The new unit test binds a
UnixListenerat the repo's socket path and checks, via captured trace records, that nogit fsmonitor--daemon startruns while it answers and that the start does run for a path with no git dir. It fails with the early return removed.🤖 Generated with Claude Code