mcp-watcher: safety-poll fallback for dropped inotify events #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "foreman/safety-poll"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a periodic safety-poll timer (default 30s) to
InboxWatcherthat callsdrain()unconditionally, covering the case where chokidar/inotify silently drops anIN_MODIFYevent.Observed twice in production: a ping is appended to
foreman.inbox, file mtime updates, but no event surfaces to the watcher. A sibling-file touch unblocks it. Root cause is Linux inotify reliability under brief idle gaps + atomic writes — chokidar relies on it without a polling fallback.drain()is already idempotent (HWM comparison short-circuits when nothing's new), so steady-state overhead is one stat + JSON parse per poll cycle. The event-driven path remains primary; the poll just masks the rare miss within the cycle interval.Changes
safetyPollMsoption onWatcherOptions. Default30_000; set to0to disable.start()arms asetInterval;stop()clears it before closing chokidar.watcher.test.ts:safetyPollMs: 0truly disables the timerTest plan
npm run typecheckcleannpm test— 39/39 pass (was 35; added 2 tests for new behavior, +2 pre-existing)🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.