Observed (2026-07-03 production soak, Windows)
A health watchdog polling /health every 60s recorded, over ~7 hours of an otherwise healthy soak:
- 14:51 local: poll timeout (15s); daemon log shows 8 directory events between 14:51:19 and 14:51:44 each logging "directory event: requesting resync" (test/telemetry, src, scripts, and five library/knowledge dirs)
- 16:22: /health response took 12.9s
- 17:52: response took 20.2s
- 19:52: response took 13.1s
- 21:23 and 21:24: two consecutive poll timeouts (25s each); healthy again by 21:25
Pattern is roughly hourly, consistent with an external scanner (search indexer, AV, backup) touching directories and emitting directory-level watch events.
Root cause chain
- An external hourly scan generates directory-change events across many directories at once.
- Each directory event triggers a resync request (the PRD-018c directory-event rule).
- The resync's work is synchronous on the event loop: git ls-files spawn for the shared ignore predicate refresh, statSync walk over the tree, and hashing where needed.
- Multiple back-to-back resyncs monopolize the event loop; the HTTP server cannot answer /health for 13-90s.
Why it matters
Self-recovering on a dev box, but under fleet supervision a doctor probing /health with a 10-15s timeout would classify the daemon unhealthy during every stall window and could start restart remediation against a healthy process (compounding with the single-instance lock).
Fix directions
- Coalesce resync requests: at most one queued resync; a burst of N directory events becomes one pass (cheap, biggest win).
- Let the resync breathe: yield to the event loop between per-file steps (setImmediate batching) or move the walk/hash work off-thread.
- Consider filtering directory events whose children show no content change before requesting a full resync.
Evidence
Watchdog log excerpts and the daemon log burst are preserved in the 2026-07-03 soak session; the resync trigger timestamps above are from the daemon's registration.cycle log lines.
Observed (2026-07-03 production soak, Windows)
A health watchdog polling /health every 60s recorded, over ~7 hours of an otherwise healthy soak:
Pattern is roughly hourly, consistent with an external scanner (search indexer, AV, backup) touching directories and emitting directory-level watch events.
Root cause chain
Why it matters
Self-recovering on a dev box, but under fleet supervision a doctor probing /health with a 10-15s timeout would classify the daemon unhealthy during every stall window and could start restart remediation against a healthy process (compounding with the single-instance lock).
Fix directions
Evidence
Watchdog log excerpts and the daemon log burst are preserved in the 2026-07-03 soak session; the resync trigger timestamps above are from the daemon's registration.cycle log lines.