[PR #13659] fix(desktop): change detection on Windows, especially Cygwin #14756

Open
opened 2026-02-16 18:19:31 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13659

State: open
Merged: No


What does this PR do?

Fixes #12849: the Review tab on Desktop now works for me on Windows. The root cause turned out to be that I was using Cygwin's git, which reports paths in a slightly funny way (/cygpath/c/... instead of C:\...). But it's an easy fix. While I was figuring things out, I also improved a few related things related to the review panel and change detection.

I separated out the changes into four commits, for easier review or dropping some changes if you don't approve them:

  1. Fix watcher path normalization on Windows: Normalize Windows watcher/file paths more robustly (e.g. mixed case). Previously, file changes didn't always show up when the file was open in a panel.
  2. Tell user if no git/VCS detected, so changes are disabled: I had to query the server with /project/current to discover that VCS/git wasn't detected, which was the root cause for changes not being detected. I didn't even know changes were VCS based, though it makes sense. (I guessed as much in #12849.) Now the user gets a helpful message if they open a non-VCS project, or as in my case, VCS wasn't correctly detected. This explains the no-changes behavior for non-VCS projects.
  3. Enable file watcher in non-VCS projects: Previously, file watching was only enabled on projects with VCS. But file watching is used to keep the file/tree views up-to-date, and they make sense even in non-VCS projects. I bumped into this while testing (1).
  4. Support Cygwin/WSL paths when working with git: This fixes the main issue I was having: git on my path is from Cygwin, which reports paths as /cygdrive/c/... instead of C:\.... I also included support for /mnt/c/... style paths in case someone is using WSL git. Both of these path mappings only apply to win32 systems, so they should be relatively safe, and broaden support. I know Cygwin is niche, but I hope you'll consider the minor change necessary to support it. (For me it's a pain to run two types of Git, because they don't cooperate well on .git files.)
  5. Refactor Windows path handling into shared helper: I found code in the bash tool that handled Windows paths of the form /c/... that should behave the same as (4), so I factored out a shared helper and used it there as well.

How did you verify your code works?

  • I did a bunch of manual testing within bun run dev:desktop, in particular to see that file watching works better now. Also made changes to a file within a VCS project and saw them appear in the Changes panel.
  • Desktop watcher fix has a new test that passes
  • packages/app tests pass
  • packages/opencode has broader Windows test failures currently (many path-format expectation mismatches), but the number of failures went down from 74 to 43. I also have some more commits that reduce the number down to 8, but I think I'll leave them for a subsequent PR (#13671) as it targets far outside the Review tab.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13659 **State:** open **Merged:** No --- ### What does this PR do? Fixes #12849: the Review tab on Desktop now works for me on Windows. The root cause turned out to be that I was using Cygwin's `git`, which reports paths in a slightly funny way (`/cygpath/c/...` instead of `C:\...`). But it's an easy fix. While I was figuring things out, I also improved a few related things related to the review panel and change detection. I separated out the changes into four commits, for easier review or dropping some changes if you don't approve them: 1. **Fix watcher path normalization on Windows**: Normalize Windows watcher/file paths more robustly (e.g. mixed case). Previously, file changes didn't always show up when the file was open in a panel. 2. **Tell user if no git/VCS detected, so changes are disabled**: I had to query the server with `/project/current` to discover that VCS/git wasn't detected, which was the root cause for changes not being detected. I didn't even know changes were VCS based, though it makes sense. (I guessed as much in #12849.) Now the user gets a helpful message if they open a non-VCS project, or as in my case, VCS wasn't correctly detected. This explains the no-changes behavior for non-VCS projects. 3. **Enable file watcher in non-VCS projects**: Previously, file watching was only enabled on projects with VCS. But file watching is used to keep the file/tree views up-to-date, and they make sense even in non-VCS projects. I bumped into this while testing (1). 4. **Support Cygwin/WSL paths when working with git**: This fixes the main issue I was having: `git` on my path is from Cygwin, which reports paths as `/cygdrive/c/...` instead of `C:\...`. I also included support for `/mnt/c/...` style paths in case someone is using WSL git. Both of these path mappings only apply to win32 systems, so they should be relatively safe, and broaden support. I know Cygwin is niche, but I hope you'll consider the minor change necessary to support it. (For me it's a pain to run two types of Git, because they don't cooperate well on `.git` files.) 5. **Refactor Windows path handling into shared helper**: I found code in the bash tool that handled Windows paths of the form `/c/...` that should behave the same as (4), so I factored out a shared helper and used it there as well. ### How did you verify your code works? - I did a bunch of manual testing within `bun run dev:desktop`, in particular to see that file watching works better now. Also made changes to a file within a VCS project and saw them appear in the Changes panel. - Desktop watcher fix has a new test that passes - `packages/app` tests pass - `packages/opencode` has broader Windows test failures currently (many path-format expectation mismatches), but the number of failures went down from 74 to 43. I also have some more commits that reduce the number down to 8, but I think I'll leave them for a subsequent PR (#13671) as it targets far outside the Review tab.
yindo added the pull-request label 2026-02-16 18:19:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14756