Skip to content

fix(app): treat localhost HTTP servers as non-local for desktop workspace picking#27673

Open
0xYiliu wants to merge 1 commit into
anomalyco:devfrom
0xYiliu:fix/wsl-localhost-workspace-picker
Open

fix(app): treat localhost HTTP servers as non-local for desktop workspace picking#27673
0xYiliu wants to merge 1 commit into
anomalyco:devfrom
0xYiliu:fix/wsl-localhost-workspace-picker

Conversation

@0xYiliu
Copy link
Copy Markdown

@0xYiliu 0xYiliu commented May 15, 2026

Issue for this PR

Closes #27674

Type of change

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

What does this PR do?

When Desktop connects to an opencode server running in WSL through localhost on port 4096, the app currently treats that connection as local and opens the native Windows directory picker for Add Workspace.

This change narrows that locality check so only the Desktop sidecar base connection is treated as local for filesystem integration. Manual HTTP connections, even on localhost, now go through the in-app directory picker instead.

I also aligned getTerminalServerScope() with the same rule and added tests for the decision matrix.

How did you verify your code works?

  • bun test src/context/server-islocal.test.ts src/context/terminal.test.ts
  • bun typecheck
  • git push ran the repo's pre-push hook, which also ran the full typecheck successfully
  • traced the affected code paths for both cases:
    • Desktop + WSL server at localhost:4096 -> in-app directory picker
    • Desktop + local sidecar -> native picker still used

Screenshots / recordings

Not included. This changes the connection-locality gate that chooses between the native picker and the in-app picker, but does not modify the UI itself.

Checklist

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

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@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 May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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

- Change isLocal() to only recognize sidecar variant 'base' as local
- Align getTerminalServerScope() with the same semantics
- Extract isLocalConnection() pure function for testability
- Add decision matrix tests for both predicates

Fixes: connecting Desktop to WSL via localhost HTTP was incorrectly
treated as local, causing Windows native Explorer to open instead of
the in-app DialogSelectDirectory for browsing remote filesystem.
@0xYiliu 0xYiliu force-pushed the fix/wsl-localhost-workspace-picker branch from c49dc64 to 33a734e Compare May 15, 2026 05:59
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.

Desktop add workspace uses Windows picker for WSL localhost server

1 participant