Skip to content

fix(web): enable file watcher in web/serve mode#24951

Open
tevenfeng wants to merge 1 commit intoanomalyco:devfrom
tevenfeng:fix/web-filewatcher
Open

fix(web): enable file watcher in web/serve mode#24951
tevenfeng wants to merge 1 commit intoanomalyco:devfrom
tevenfeng:fix/web-filewatcher

Conversation

@tevenfeng
Copy link
Copy Markdown

@tevenfeng tevenfeng commented Apr 29, 2026

Issue for this PR

Closes #19182

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

In web/serve mode, the native file watcher (FileWatcher) only subscribes to .git/HEAD for branch change detection but does not monitor the working directory for file changes. This is because OPENCODE_EXPERIMENTAL_FILEWATCHER defaults to false, and neither the web nor serve command sets it — unlike the desktop mode which explicitly sets OPENCODE_EXPERIMENTAL_FILEWATCHER: "true" in desktop-electron/src/main/server.ts line 68.

Without this flag, when files are modified externally (e.g. via VSCode), no file.watcher.updated event is produced, so the SSE stream doesn't push updates to the frontend, and the changes tab / review panel don't refresh.

The fix adds process.env.OPENCODE_EXPERIMENTAL_FILEWATCHER = "true" at the start of both web.ts and serve.ts handlers, matching the desktop mode behavior.

How did you verify your code works?

Started the opencode web server with OPENCODE_EXPERIMENTAL_FILEWATCHER=true, opened the web UI, then modified a file externally. Confirmed that the changes tab and review panel updated in real time.

Screenshots / recordings

N/A — no UI change, only a backend behavior fix.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

The native file watcher was not enabled in web and serve modes because
OPENCODE_EXPERIMENTAL_FILEWATCHER was not set, unlike the desktop mode.
This caused the changes tab and review panel to not update when files
were modified externally.

Closes anomalyco#19182
@tevenfeng tevenfeng force-pushed the fix/web-filewatcher branch from 4fb32ec to 11b1520 Compare May 7, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Desktop app file tree does not update with git changes (file watcher not refreshing)

1 participant