Description
When using secondary workspaces (git worktrees), .watchman-cookie-* files created by Watchman at the worktree root trigger the file watcher. This leads to frequent refreshVcs() calls and periodic requests to /vcs/diff.
This can be annoying when attempting to comment on the code because the file will refresh, losing anything typed in the comment.
Root cause(s)
.watchman-cookie-* files are not ignored by default (they likely should be).
- The
watcher.ignore config option is only applied to the project directory subscription, not to the .git directory subscription used for worktrees.
Proposed Fix
Update packages/opencode/src/file/watcher.ts to apply config ignores to the VCS directory subscription:
// Currently:
yield* subscribe(vcsDir, ignore)
// Should be:
yield* subscribe(vcsDir, [...ignore, ...cfgIgnores])
Additionally, add .watchman-cookie-* to the default ignore patterns in src/file/ignore.ts.
Workaround
Disabling the watcher with OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER=true
Plugins
obra/superpowers
OpenCode version
1.14.23
Steps to reproduce
- Use a project with "workspaces" enabled (secondary git worktree).
- Let Watchman run (creates
.watchman-cookie-* files in the secondary worktree root).
- Observe periodic
/vcs/diff requests in network tab or server logs.
Screenshot and/or share link
No response
Operating System
macOS Tahoe 26.4.1
Terminal
iTerm2
Description
When using secondary workspaces (git worktrees),
.watchman-cookie-*files created by Watchman at the worktree root trigger the file watcher. This leads to frequentrefreshVcs()calls and periodic requests to/vcs/diff.This can be annoying when attempting to comment on the code because the file will refresh, losing anything typed in the comment.
Root cause(s)
.watchman-cookie-*files are not ignored by default (they likely should be).watcher.ignoreconfig option is only applied to the project directory subscription, not to the.gitdirectory subscription used for worktrees.Proposed Fix
Update
packages/opencode/src/file/watcher.tsto apply config ignores to the VCS directory subscription:Workaround
Disabling the watcher with
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER=truePlugins
obra/superpowers
OpenCode version
1.14.23
Steps to reproduce
.watchman-cookie-*files in the secondary worktree root)./vcs/diffrequests in network tab or server logs.Screenshot and/or share link
No response
Operating System
macOS Tahoe 26.4.1
Terminal
iTerm2