Skip to content

fix(core): skip file watcher on filesystem roots #45611

Closed

Description

@CannonRS

Description

The file watcher attempts to watch filesystem roots (e.g., C:/ on Windows, / on Linux) which causes unnecessary resource usage and potential permission issues.

Reproduction Steps

  1. Open a project at filesystem root
  2. File watcher attempts to watch the entire root directory
  3. Causes high resource usage / permission errors

Expected Behavior

File watcher should skip filesystem roots and system directories.

Actual Behavior

File watcher attempts to watch roots, wasting resources.

System Info

  • OS: Linux/macOS/Windows
  • opencode version: dev

Fix

Added isRootOrSystemDirectory check in packages/core/src/filesystem/watcher.ts to skip roots (C:/, /, etc.)

Activity

  1. github-actions commented on Aug 27, 2026

    @github-actions
    Contributor

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

    If your fix is distinct from what's described there, please clarify the difference in your issue.

  2. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    In v2, opening a project at a filesystem root no longer sets up a recursive watch on it: the old project-directory watcher is gone, and opencode now only watches the Git HEAD (or Mercurial branch) file to notice branch changes. To get v2: npm i -g @opencode/cli@latest or curl -fsSL https://opencode.ai/v2/install | bash (desktop: update the app). If you still see this on v2, please open a new issue with the details.

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