You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fff watcher pegs CPU on repos with nested worktrees: post-rescan directory queue runs a libgit2 status per directory #50719
OpenCode 1.18.32 on macOS 26.5.1 (arm64), bundled @ff-labs/fff-bun 0.9.4.
Related, different trigger: #42557 (per-event status on gitignored build output), #32511 (home-directory scanning), #43356 (crash in the same resubscribe-after-scan path).
What happens
Repo: ~7k tracked files, plus 27 untracked nested git worktrees under wt/ (~240k files). fff at the repo root indexed 245,895 files and 25,847 directories.
Two TUI sessions started at the repo root ran 5-7 h with two fff-watcher-own threads each at 100% CPU (machine load average 31, 10 GB swap). sample <pid> shows the owner thread in Repository::open → Repository::statuses / status_file → git_index_read, one call per queued directory, 10-350 ms each. A third session started inside one worktree (7,874 files) had the same threads idle.
Trigger
Reproduced with @ff-labs/fff-node 0.9.4 watching the root: creating one new worktree under wt/ produced ~8k file-create and ~1k folder-create events, 2 full rescans, and 2,375 owner-thread git_status_for_paths calls (19 s CPU) in ~40 s.
After a full rescan, rescubscribe_watcher_post_scan queues every indexed directory for the owner thread. The queue is unbounded and not deduplicated (scan.rs, background_watcher.rs in fff v0.9.4), so each rescan costs minutes of CPU per fff instance, and the queue never drains while worktrees keep being created.
A read-only experiment (fresh index, one requested rescan, then one minute of measurement):
Measurement
fff 0.9.4
fff 0.11.0
CPU seconds, 10 s baseline
0.739
0.063
CPU seconds, minute after rescan
49.258
11.339
CPU seconds, final 10 s
7.347
0.035
Owner thread
busy in git status
waiting
fff 0.11.0 separates Subscribe from IndexNewDir, so a rescan's subscription no longer indexes every directory on macOS.
Config gaps
watcher.ignore reaches only the Parcel watcher, not fff.
fff InitOptions has no ignore/exclude option; only gitignore rules shrink the index.
disableWatch exists in fff-bun, but OpenCode does not pass it.
OPENCODE_DISABLE_FFF=1 is the only switch. With it, search falls back to ripgrep (one file query on a 7.9k-file tree: 25 ms, 0.11 s CPU).
Workaround
Gitignore the nested-worktree folder (or add it to .git/info/exclude): the root scan drops from 245,895 files to 7,140. Or set OPENCODE_DISABLE_FFF=1.
Asks
Bump the bundled fff to ≥ 0.11, or backport a bounded, deduplicated post-rescan directory queue.
Honour watcher.ignore when creating the fff picker.
Activity
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊