agent-watcher/mcp-watcher/test
bob-boat 95ff60ce94 mcp-watcher: safety-poll fallback for dropped inotify events
Adds a periodic timer (default 30s) that calls drain() unconditionally,
covering the case where chokidar/inotify silently drops an IN_MODIFY
event. Observed twice in production: ping appended to inbox, file mtime
updated, but no event delivered to the watcher; a sibling-file touch
unblocked it. Root cause is Linux inotify under brief idle gaps + atomic
writes — not consistently reliable on its own.

drain() is already idempotent (HWM comparison short-circuits when
nothing's new), so the steady-state overhead is one stat + JSON parse
per poll cycle. Event-driven path remains the primary; the poll just
masks the rare miss within the cycle interval.

- safetyPollMs option: default 30_000, set to 0 to disable
- stop() clears the interval before closing chokidar
- Two new tests: safety-poll delivers when fs-event never fires;
  safetyPollMs:0 truly disables the timer

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 12:54:26 -04:00
..
identity.test.ts Fix env var: CLAUDE_CONFIG_DIR not CLAUDE_HOME 2026-05-06 18:05:22 -03:00
inbox.test.ts Layer 2 MCP Watcher v0 scaffold 2026-05-06 17:44:57 -03:00
tools.test.ts Layer 2 MCP Watcher v0 scaffold 2026-05-06 17:44:57 -03:00
watcher.test.ts mcp-watcher: safety-poll fallback for dropped inotify events 2026-05-23 12:54:26 -04:00