[BUG] "Add Workspace" silently does nothing when dsh web is launched as a detached or background process on Windows or macOS #998
SrtaEstrella
started this conversation in
General
Replies: 1 comment
|
这就是 #358 / #576 / #998 那条缝:官方入口是 Node + npx + 自己填密钥 + 自己选文件夹。Windows 上还没有官方一键启动,后台拉起时「添加工作区」还会没反应。 easy-dsh 只做进门,不是 Electron 桌面壳,也不是 dsh 插件。
安装: 介绍帖:#1738 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
When
dsh webis started by a process that has no visible interactive desktop (for example an automation agent, a detached service, a background task, or any launcher that spawns the server without an attached console window), clicking Add Workspace / Choose workspace in the browser UI does nothing. No dialog appears and no error is logged. The server is healthy, but the feature looks dead.This is reproducible 100 percent of the time under that condition. It is distinct from the WSL and macOS cases already discussed elsewhere because the trigger here is simply "the server process has no foreground desktop", regardless of which OS is involved.
Environment
@deepseek-ai/dsh@0.1.0-rc.6127.0.0.1:3080Steps to reproduce (detached or background process)
node lib/bin.js webspawned by an automation agent or a detached background task on Windows or macOS.http://127.0.0.1:3080in a browser.Expected behavior
Clicking Add Workspace should open a usable folder selection UI, either the native OS dialog (when a desktop is actually available) or the in-browser folder tree (when it is not).
Actual behavior
No UI opens. The native Win32 or macOS folder dialog is spawned by the server process, but that process has no interactive desktop foreground, so the dialog is created behind other windows (or with no focus) and is effectively invisible to the user. The frontend receives no path and no error, so the click looks like a no-op.
This is not a missing native dependency. The koffi binary is present and
user32.dllloads correctly. The dialog is created, it is simply never visible to the user.Root cause
The directory picker backend is resolved in
dsh-host-directory-picker-autothroughresolveDirectoryPickerBackend. The native backend is selected only when all three conditions hold:bindHost === "127.0.0.1"SSH_CONNECTIONand noSSH_TTYin the environmentplatformiswin32ordarwinIn every other case the resolver falls back to
browse(the pure in-browser folder tree). The design already follows the good principle that ambiguous cases resolve tobrowse. Linux, SSH, and remote scenarios all land inbrowseand work fine.The flaw is that
loopback + no SSH + desktop OSis treated as an unambiguous signal for native, but it is actually ambiguous. The server can be running with no interactive desktop at all (a detached agent, a background service, a headless launcher). In that case the native backend relies on a visible desktop and silently fails to surface its dialog.Why existing discussions do not cover this
cordis.patch.ymlworkaround). WSL reportsplatform === "linux", so it never even enters the native branch; its mechanism is different from ours.None of them describes the detached or background server process trigger, which is a separate and fully deterministic way to hit the same silent native failure. Posting this separately keeps the new trigger discoverable instead of buried inside the WSL thread.
Workarounds
Option A (persistent, recommended): force the browse backend via cordis patch. This is the solution posted in discussion #929 and works for this case too. Edit
~/.dsh/profiles/web/cordis.patch.yml:This permanently routes workspace selection to the in-browser folder tree.
Option B (quick test): set
SSH_CONNECTIONto force the browse backend. Confirmed:resolveDirectoryPickerBackend({ bindHost: "127.0.0.1", platform: "win32", env: { SSH_CONNECTION: "x" } })returns"browse".Suggested fix
Treat the native backend as requiring an interactive desktop. When the native path would be chosen but the spawning process has no visible or foreground desktop (detached service, background agent, headless launcher, or no console owner), degrade to
browse. This keeps the existing philosophy (ambiguous cases resolve tobrowse) and removes the silent failure mode.A minimal implementation could detect the absence of an interactive session (for example, no attached console on Windows, or a known headless or service parent) and route those cases to
browseinstead ofnative.Scope and why it matters
Normal interactive use, a developer running
dsh webin their own terminal, is unaffected and works as designed. Remote, SSH, and container scenarios already resolve tobrowse, so they are unaffected too.The realistic trigger is narrow today. A human at a terminal rarely launches the server detached, and most production deployments already run over SSH or in containers where
browseis selected. The case becomes more relevant as AI assistants and automation tools increasingly launch dev servers on behalf of users. Consolidating the WSL case (#929), the macOS latency case (#702), and this detached process case under one root cause (native backend without a usable desktop degrades to browse) should make the fix simpler to land once.All reactions