Skip to content

.watchman-cookie-* files in git worktrees cause periodic /vcs/diff requests #24357

Closed as not planned

Description

@jasonyork

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)

  1. .watchman-cookie-* files are not ignored by default (they likely should be).
  2. 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

  1. Use a project with "workspaces" enabled (secondary git worktree).
  2. Let Watchman run (creates .watchman-cookie-* files in the secondary worktree root).
  3. 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

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    perfIndicates a performance issue or need for optimization
    on Apr 25, 2026
  2. github-actions commented on Apr 25, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    It may be worth coordinating with the authors/assignees of those issues before implementing a separate fix.

  3. removed
    bugSomething isn't working
    perfIndicates a performance issue or need for optimization
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions