Skip to content

Revert "fix: use directory watching instead of globs for chokidar v4 compatibility (#77)"#82

Merged
graydawnc merged 1 commit intomainfrom
revert/pr-77-chokidar-watcher
Apr 15, 2026
Merged

Revert "fix: use directory watching instead of globs for chokidar v4 compatibility (#77)"#82
graydawnc merged 1 commit intomainfrom
revert/pr-77-chokidar-watcher

Conversation

@graydawnc
Copy link
Copy Markdown
Collaborator

@graydawnc graydawnc commented Apr 15, 2026

Reverts #77.

Why

PR #77 switched chokidar.watch(glob) to chokidar.watch(dirs), which restored event delivery on chokidar v4 but introduced a worse regression on macOS:

  • chokidar v4/v5 removed the fsevents dependency entirely — on macOS it falls back to fs.watch, and each watched directory consumes one FD
  • Recursive watching of ~/.claude/projects/ (373 subdirs locally) + ~/.codex/sessions/ (43 subdirs) blows past the macOS per-process soft FD limit (default 256)
  • Result: EMFILE: too many open files, watch thrown inside FSWatcher._handle.onchange repeatedly
  • Because watcher.ts has no .on('error', ...) handler, these surface as unhandled promise rejections that accumulate unboundedly (rejection id 9500+ within minutes)
  • Accumulating rejections + synchronous syncFile() on each event → main process saturates, cursor shows spinner on hover, RSS grows

Reverting gets us back to the zero-events state (a bug) rather than the cascading-failure state (a worse bug). A proper fix is tracked in a follow-up issue.

Test plan

  • pnpm build passes
  • Dev app boots without EMFILE spam in console
  • Accept: new sessions do not auto-appear in the UI until manual re-sync (pre-existing behavior under the silent-glob bug; tracked in follow-up)

🤖 Generated with Claude Code

@graydawnc graydawnc merged commit 43afd10 into main Apr 15, 2026
3 checks passed
@graydawnc graydawnc deleted the revert/pr-77-chokidar-watcher branch April 15, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant