Skip to content

Open in editor on a remote environment ignores workspaceFile and opens the containing folder #234

Closed

Description

Symptom

With a project whose workspaceFile is set (a .code-workspace listing several repo roots), Open in VS Code opens the directory containing the workspace file rather than the workspace itself, so the editor shows a single folder instead of the multi-root workspace.

This only happens when the environment is remote — i.e. when the client is not on the environment's machine and open-in has to emit a vscode://vscode-remote/ssh-remote+… deep link. The same project opened from a local environment opens correctly as a workspace.

Reproduced on multi-repo-workspaces @ 5b02511cd, macOS desktop client, remote environment added through the SSH launch flow (Settings → Connections → Remote Environments), project pointed at a .code-workspace on the remote host.

Root cause

OpenInPicker has two branches and only the local one passes workspaceFile — apps/web/src/components/chat/OpenInPicker.tsx:214-241:

if (remote.mode === "remote-links") {
  const url = buildRemoteOpenUrl({
    editor,
    host: remote.host.host,
    absolutePath: openInCwd,        // <-- cwd only; openInWorkspaceFile never consulted
  });
  if (url === undefined) return;
  void openRemoteEditorUrl(url).then(...);
  return;
}
const result = openInEditorMutation({
  environmentId,
  input: {
    cwd: openInCwd,
    editor,
    ...(openInWorkspaceFile ? { workspaceFile: openInWorkspaceFile } : {}),   // <-- local path uses it
  },

openInWorkspaceFile is plumbed correctly all the way to this component (ChatView.tsx:2915 → ChatHeader.tsx:434 → OpenInPicker.tsx:181), so the value is available at the point the remote branch runs — it is simply not read.

Why it is not a one-line fix

buildRemoteOpenUrl builds a folder URI (packages/contracts/src/editor.ts:139-153):

return `${scheme}://vscode-remote/ssh-remote+${encodeURIComponent(input.host)}${encodedPath}`;

vscode://vscode-remote/ssh-remote+<host><path> asks VS Code to open <path> as a folder. Opening a .code-workspace over Remote-SSH needs a different URI form, so the builder needs to distinguish "open this folder" from "open this workspace file" rather than the call site just passing a different path. I have not verified which URI form VS Code accepts for a remote workspace file, so I have deliberately not proposed a patch.

Relationship to other issues

#185 fixed workspaceFile reaching the client, and that fix is working — the local branch above consumes it. This is the remote branch, which was never wired up, so it is a separate gap rather than a regression.

It is also adjacent to #125 (isolated runs don't open as a multi-root workspace): both end with the editor showing a folder where a multi-root workspace was intended, though the causes differ.

Verified vs not

  • Verified: the code paths above, the plumbing of openInWorkspaceFile, and the reproduction on a remote SSH-launched environment.
  • Not verified: the correct vscode-remote URI form for opening a workspace file, and whether Cursor and the other remote-capable editors accept the same form.

Reported from Claude Opus 4.6 running in Claude Code.

Activity

  1. added a commit that references this issue on Sep 8, 2026
    a905a0c
  2. LoganRupe commented on Sep 8, 2026

    @LoganRupe
    Owner

    Fixed on multi-repo-workspaces in a905a0c (#235). Thanks for the writeup, the trace through OpenInPicker was exactly right and saved me the hunt.

    On the part you flagged as unverified: a remote workspace file needs no separate URI form. VS Code's protocol handler (getWindowOpenableFromProtocolUrl in src/vs/code/electron-main/app.ts) branches on the file extension rather than the URI shape, returning a workspaceUri instead of a folderUri whenever the path ends in .code-workspace. So vscode://vscode-remote/ssh-remote+<host>/path/to/thing.code-workspace already opens as a multi-root workspace.

    buildRemoteOpenUrl now runs the same resolveEditorTarget the server uses and links the workspace file for editors that support one, and the remote-links branch of OpenInPicker passes openInWorkspaceFile through. That also answers your Cursor question: every remote-capable editor we ship (Cursor, VSCodium, Insiders) is a VS Code fork inheriting this code, so they all get it.

    Confirmed working against a real remote SSH environment. Closing.

  3. added 6 commits that reference this issue on Sep 14, 2026
    f057e55
    fcf977c
    0761abf
    489d9ce
    ef412bc
  4. stefanvandervelden-zipline commented on Oct 11, 2026

    @stefanvandervelden-zipline
    Author

    Reopening: not in the orchestrator v2 re-implementation (#338, now multi-repo-workspaces @ 2ba7964848). The fix (ef412bc798 on multi-repo-workspaces-pre-v2) wasn't ported.

    On v2, OpenInPicker's remote-links branch calls buildRemoteOpenUrl({ absolutePath: openInCwd }) with the folder only, so remote environments open the containing folder again. This depends on #112 being re-implemented first. Once the client knows the workspace file, the remote branch should use it too. As noted when this was fixed, VS Code's protocol handler already opens a .code-workspace path as a workspace, so no new link format is needed.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions