Skip to content

Web directory picker anchored at OS home instead of server directory (V2 follow-up of #43173) #54626

Closed as not planned

Description

@BoYanZh

Summary

The V2 web project picker still starts at the OS home directory instead of the server/current directory. E.g. server runs in \C:\Users\boyanzh\Desktop\Programs\repos\xxx\ but the picker opens at \C:\Users\boyanzh\ (home), so nested projects are unreachable and search is home-scoped. Same class of report as #43173 (also confirmed on Linux+docker there).

Root cause

\packages/app/src/workspaces/selection/dialog.tsx:88-95\ computes the start as:

\\ s
props.start ||
sync.data.path.home || // OS home wins
props.location?.directory ||
sync.data.path.directory || // server/current dir loses
fallbackPath.latest?.directory
\\

Actual precedence: explicit start > home > location.directory > server directory > fallback.

Expected

explicit start > server/location directory > home > fallback (the precedence the V1 fix in #50193 established; it was never disputed, only lost in the V2 rewrite).

References

Activity

  1. opencode-agent commented on Oct 11, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report. I couldn't reproduce it as described on Linux with v2.0.26:

    • With opencode serve started inside a nested project directory, the web Add project picker opened at that directory and listed its subfolders, not at home.
    • The precedence in dialog.tsx doesn't actually decide this. On the web side, the path data always has home set to an empty string (loadPathQuery in packages/app/src/runtime/server/global-sync/bootstrap.ts), so the picker always falls through to the server's location directory.

    The picker did open at home when the web UI was connected to the background service, the server that opencode and opencode pair use. That service reports its own starting directory (home here) as its location, wherever you run the CLI. You can see this with opencode api get /api/location.

    This was tested on Linux, not Windows. Could you tell us:

    1. Your opencode --version.
    2. How you started the server and opened the web UI: opencode serve run inside ...\repos\xxx, a link from opencode pair (background service), or the desktop app.
    3. What opencode api get /api/location prints when run from that directory.

    Related, ordered by relevance:

  2. BoYanZh commented on Oct 11, 2026

    @BoYanZh
    Author

    Reproduced on Windows with pristine dev (707de58, backend serve from a nested dir, password-protected, web dev build):

    • Start location in the serve flow: correct. The Add project picker opened at the serve directory (.../packages/cli), not home. Matches your Linux result — with home: "" from loadPathQuery the precedence can never land on home there.
    • Separator bug: confirmed. Typing C:\...\packages + Tab produced C:\...\packages/, and the suggestion list showed C:\...\ai/ etc. — the hardcoded "/" in complete() and the suggestion rows. Fixed in fix(app): use native separators in directory picker #54630 (verified in-browser against that branch: completions now end with \).
    • On the precedence reorder in fix(app): use native separators in directory picker #54630: it is a no-op for the serve flow (as you said); it only changes flows where home is populated, e.g. child-store/desktop via child-store.ts:237. Kept as hardening plus the separator fix.
    • Background-service flow (pair link): the picker follows location.directory, which is the service's own start dir. That is location reporting, not dialog precedence — separate from this issue.
  3. opencode-agent commented on Oct 11, 2026

    @opencode-agent
    Contributor

    Thanks for testing on Windows with 707de58. That lines up with what I found:

    • Start directory with opencode serve: we agree it works. The picker opens at the server directory, so the problem in this issue's title doesn't happen in that flow.
    • Background service (opencode pair): agreed, that's about which directory the service reports as its location, not about the picker. It's a separate topic from this issue.
    • Windows separator: looks plausible from the code. complete() in packages/app/src/workspaces/selection/dialog.tsx adds a hard-coded "/" after the completed directory, and the suggestion rows build paths with / too. I couldn't check it myself because I only have a Linux environment, which never shows backslash paths, so I'm relying on your in-browser check.

    The separator bug is a different problem from what this issue reports. It would be easier to track if you either opened a new issue for it (version, steps such as typing C:\...\packages + Tab, expected ...\packages\ versus actual ...\packages/) and pointed #54630 at it, or edited this issue's title and description to cover it and left a comment saying you've updated it. Maintainers will review #54630 either way, including whether they want the start-order change for flows where home is filled in.

  4. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Closing this as not planned, since the problem in the title didn't reproduce. With opencode serve, the web picker opens at the server directory: I saw that on Linux with v2.0.26, and you saw the same on Windows with 707de58. The picker starting at home when you use the background service is a separate topic about which directory the service reports.

    The Windows separator bug you found (Tab completion adding / instead of \) is still worth tracking. If it still happens, please open a new issue for it with your version and steps and point #54630 at it, so maintainers can review the fix against it. Thanks for digging into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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