What happened?
Upstream's new FSEvents file monitor watches the .git directory to trigger line-count updates dynamically. When a file change is detected, GitClient.lineChanges executes git diff HEAD --shortstat. However, because GIT_OPTIONAL_LOCKS=0 is not passed to the git invocation, git diff implicitly updates the .git/index cache. This index writeback triggers the FSEventStream again, creating an infinite background loop of file-system events and git diffs that drains the CPU and battery on large repositories.
Additionally, the O(N) lstat scan on large repositories is very slow, which can be fixed by passing -c core.fsmonitor=true.
Steps to reproduce
- Open Supacode in a Git repository.
- Make a file change.
- Observe that
WorktreeFileEventMonitor triggers continuously in an infinite loop due to .git/index writebacks.
Supacode version and build
Latest main
macOS version
macOS 26.0+
System locale
en_US
Mac hardware
No response
Relevant logs or screenshots
No response
Are you planning to fix this yourself?
Before submitting
What happened?
Upstream's new FSEvents file monitor watches the
.gitdirectory to trigger line-count updates dynamically. When a file change is detected,GitClient.lineChangesexecutesgit diff HEAD --shortstat. However, becauseGIT_OPTIONAL_LOCKS=0is not passed to the git invocation,git diffimplicitly updates the.git/indexcache. This index writeback triggers theFSEventStreamagain, creating an infinite background loop of file-system events and git diffs that drains the CPU and battery on large repositories.Additionally, the O(N)
lstatscan on large repositories is very slow, which can be fixed by passing-c core.fsmonitor=true.Steps to reproduce
WorktreeFileEventMonitortriggers continuously in an infinite loop due to.git/indexwritebacks.Supacode version and build
Latest main
macOS version
macOS 26.0+
System locale
en_US
Mac hardware
No response
Relevant logs or screenshots
No response
Are you planning to fix this yourself?
ready.Before submitting
ready.