fix(web): enable file watcher in web/serve mode#24951
Open
tevenfeng wants to merge 1 commit intoanomalyco:devfrom
Open
fix(web): enable file watcher in web/serve mode#24951tevenfeng wants to merge 1 commit intoanomalyco:devfrom
tevenfeng wants to merge 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
da23977 to
f4dedf6
Compare
f4dedf6 to
4fb32ec
Compare
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
4fb32ec to
11b1520
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #19182
Type of change
What does this PR do?
In web/serve mode, the native file watcher (
FileWatcher) only subscribes to.git/HEADfor branch change detection but does not monitor the working directory for file changes. This is becauseOPENCODE_EXPERIMENTAL_FILEWATCHERdefaults tofalse, and neither thewebnorservecommand sets it — unlike the desktop mode which explicitly setsOPENCODE_EXPERIMENTAL_FILEWATCHER: "true"indesktop-electron/src/main/server.tsline 68.Without this flag, when files are modified externally (e.g. via VSCode), no
file.watcher.updatedevent 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 bothweb.tsandserve.tshandlers, 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