Skip to content

Stop the fsmonitor orphan sweep killing submodule daemons - #4729

Merged
max-sixty merged 1 commit into
mainfrom
nightly/clean-42454540498-fsmonitor
Nov 8, 2026
Merged

max-sixty merged 1 commit into
mainfrom
nightly/clean-42454540498-fsmonitor

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

The orphan fsmonitor sweep that runs after wt remove and wt merge (run_internal_sweep → reap_orphan_fsmonitor_daemons → classify_orphans) treated any daemon as a class-2 orphan when its git-dir sat under the repo's git-common-dir but wasn't a live worktree's git-dir. Submodule git-dirs also live under the common dir, at .git/modules/<name>, and git worktree list never reports them. So with core.fsmonitor=true set globally, every sweep sent SIGTERM and then SIGKILL to the daemons serving live submodules. That breaks the module's own rule that a daemon serving a live checkout is never reaped. Git respawns the daemon on the next command, so the damage is a lost cache, not lost data.

This PR limits class 2 to the git-dirs this repo's own worktrees use: the common dir itself, and <common-dir>/worktrees/<name>. Everything else nested in the common dir is spared, the same way daemons for other repositories already are.

classifies_each_orphan_class_and_spares_others now also has a submodule daemon and a daemon for a submodule's linked worktree. Under the old starts_with check, both would have been selected. Locally, the fsmonitor unit tests and clippy pass. The one other failure, start_fsmonitor_daemon_skips_fork_when_daemon_answers, also fails on main here, because this sandbox blocks AF_UNIX sockets.

Found during the nightly survey by reading the code, not from a user report.

Class-2 orphans were any daemon whose git-dir sat under the repo's
git-common-dir without being a live worktree's git-dir. Submodule
git-dirs live at <common-dir>/modules/<name>, which `git worktree list`
never reports, so with core.fsmonitor=true every sweep (wt remove,
wt merge) SIGTERMed the daemons serving live submodules.

Restrict class 2 to the git-dirs this repo's worktrees use: the
common dir itself and <common-dir>/worktrees/<name>.
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Nov 8, 2026
@max-sixty
max-sixty merged commit f35966e into main Nov 8, 2026
36 of 45 checks passed
@max-sixty
max-sixty deleted the nightly/clean-42454540498-fsmonitor branch November 8, 2026 06:54
@max-sixty max-sixty mentioned this pull request Nov 14, 2026
max-sixty added a commit that referenced this pull request Nov 14, 2026
Prepares Worktrunk 0.82.0, including release notes, contributor credits,
and the minor version bump required by Rust library API changes.

Protects active temporary indexes from concurrent stale-file cleanup
with an owner lock, preserving forced-removal backups. Restores
v0.81.0's daemon-backed removal check and cached macOS fsmonitor startup
configuration, as explicitly [approved by the
maintainer](#4716 (comment)):
the unshipped post-shutdown full scan from #4456 is removed. The
separate fix that spares live submodule daemons during orphan cleanup
(#4729) remains.

Includes current main through `0df653384`, corrected plugin
documentation, and regenerated mirrors. Independent review covered the
rollback, all intervening main changes, and all 30 changelog entries.
Local validation passed 5,502 tests (one skipped), doctests,
documentation checks, and 21 built-site tests. Full cross-platform
validation and all PR checks, including patch coverage, passed.

Tagging awaits explicit sign-off on the full adjudicated release safety
review.

> _This was written by Codex on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants