mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 16:03:20 +00:00
* Cut fseventsd load: fix macOS exclusion cap, drop wide always-on FSEvents streams - @parcel/watcher maps plain-path ignores to FSEventStreamSetExclusionPaths, but macOS caps exclusions at 8 per stream and fails closed. Orca passed 9, silently disabling ALL daemon-side exclusions: fseventsd delivered every node_modules/.git event to each per-worktree explorer stream (measured 16x client CPU). Cap plain paths at 8 (extras demoted to userspace globs) via a shared filesystem-watcher-ignore module, also unifying the runtime file-watcher host list so identical roots share one native stream. - worktree-base-directory-watcher subscribed recursive FSEvents streams over every repo's ENTIRE workspace root (all worktrees) and whole common .git (objects included) with glob-only ignores (zero daemon-side exclusion), just to observe a few shallow paths. Replace with a 2s readdir/stat poller (zero fseventsd clients, measured 70x less delivery CPU); SSH targets keep provider.watch unchanged. - serve-sim state watcher held an app-lifetime fs.watch on $TMPDIR (the noisiest dir on the system); its existing 250ms existence poll makes the parent watch redundant, so drop it. Co-authored-by: Orca <help@stably.ai> * Eliminate base-poller idle cost: mtime-gated ticks + narrow macOS worktree-metadata stream - base targets: tick is now one stat of each gate dir (root + nested containers); the readdir + marker fan-out runs only when a gate dir changed, with a 30s ungated backstop and a bounded pending-marker recheck list. Idle tick 600us -> 1.1us at 146 worktrees. - git-common targets on macOS: replace the 2s entry sweep with one narrow native stream on <common>/.git/worktrees (tiny, rare-churn tree): zero idle syscalls and external worktree add/remove/HEAD detection back to sub-second. Re-arms via existence poll across git worktree prune deleting/recreating the dir. Win/Linux keep the listing poll (no fseventsd there; a Windows dir handle could block prune). - split git-common logic into worktree-git-common-watch.ts (max-lines). Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>