[Windows] Console window flashes on every shell tool call when dsh runs without a host console (Web UI / Electron) #4495
Unanswered
xswt442-cmd
asked this question in
Q&A
Replies: 2 comments 1 reply
|
Update: confirmed the wrapper-side workaround — launching the server without DETACHED_PROCESS (keeping windowsHide: true) gives the whole process tree one hidden shared console; zero window flashing across winbash/pwsh/cmd spawns. Upstream could do the same internally (e.g. a hidden AllocConsole for console-less hosts) to fix this for all GUI/detached launch modes. |
0 replies
|
Checked this in the source. Confirmed: packages/subprocess/subprocess-local/src/spawn.ts is the actual spawn path used by winbash and pwsh, and it does not set windowsHide anywhere. Only cwd, env, stdio, and detached are set there. So your finding is accurate down to the exact file. Your workaround and fix ideas both make sense. |
1 reply
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.
中文摘要:Windows 上以 Electron 壳 / 无控制台方式运行
dsh web时,agent 每次调用 shell 工具都会闪出一个可见控制台窗口(标题为Git\usr\bin\bash.exe或cmd.exe)。根因:Windows ACL 沙箱在受限令牌下无法使用CREATE_NO_WINDOW(子进程会以STATUS_DLL_INIT_FAILED/0xC0000142死亡),因此设计为“子进程共享宿主控制台”;但 Web/Electron 宿主本身没有控制台可共享,Windows 就为每个子进程分配一个全新的可见控制台。0.1.0-rc.6与0.1.1-rc.2行为一致。详细分析与修复建议见下方英文部分。Environment
node ...\@deepseek-ai\dsh\lib\bin.js web --port 3080Steps to reproduce
C:\Program Files\Git\usr\bin\bash.exeorcmd.exe.Expected
Background tool executions should not create visible console windows.
Actual
One visible console window per spawned child, on every tool call, in every active session. Very disruptive when agents run multiple commands.
Root cause analysis
sandbox-windows-acl's own README states:“Children share the host console” only holds when the host has a console (CLI usage). When the host is a GUI/detached process — i.e. the graphical Web UI launch path this project ships — there is no console to share, so Windows allocates a new visible console for every child.
Verified against the installed artifacts:
windowsHideis set anywhere in the executor spawn paths (it is correctly set indsh-native-command,dsh-host-directory-picker-native, and the MCP SDK stdio client).Possible directions to fix
AllocConsolekept hidden, or launch via a hiddenconhost), so sandboxed children can share it instead of each allocating a fresh visible one.windowsHide: trueon all non-restricted spawn paths, as some native helpers already do.Happy to provide additional logs or a minimal repro script if useful. Thanks!
All reactions