[Bug] Windows: file-manager "Show file location" / default-app open silently fails (windowsHide hides Explorer's delegated window) #7842
Replies: 4 comments
|
|
A/B 已完成,因果成立(定案)——按你建议的路径做的,两层都验了:
该特判补丁已在本机生产形态运行(完整 asar 备份/校验/回滚俱全),无其他回归;如果官方愿意采纳,diff 就是主帖 Suggested fix 里那一行条件式。 环境:Windows 11 (build 26200);官方安装版 Desktop 0.1.7-rc.2(tag 正文已按你的建议补充:受影响版本处注明"本报告在正常交互式桌面会话下复现(非服务/计划任务等非交互场景)",与 README:112 的非交互盲区明确区分——避免被按已知盲区结帖。 再次感谢"已知盲区 vs 第二成因"的判定,这正是我们需要的。 |
|
同族发现(第三个表现形态):下拉"打开方式"菜单里的默认应用条目,也是静默启动失败——机理一致,但启动载体不同。 复现:同一 UI(文件预览/交付物卡片的"更多打开方式"下拉),点列表里的默认应用条目(如 "Visual Studio Code (默认)")→ 无窗口、无报错。同列表里的非默认条目(如 WPS Office,经典 GUI)正常弹出——所以是"有的条目能开、有的不能",不是列表整体失效。 机理(对照主帖根因,一层之差):
建议修复: 本地缓解(供参考,暂未部署):前端对 default 条目省略 application 参数、改走 explorer.exe 委托(与顶层图标同路径)即可绕过;命名条目里的 Electron 应用仍会隐身,属上游可修范围。 环境:Windows 11 (build 26200);Desktop 0.1.7-rc.2(官方安装版)。 |
恭喜定案——但你的修法覆盖不到你刚发现的第三个形态,这条得在合并前说清1. 先说 A/B 结论你跑完两层验证(最小复现 + 真实 runner 里只对 2. 但请注意一个修法范围问题你现在的补丁是"仅对 我在源码里核到了一处旁证: export const launchDetachedApp: OpenInAppLauncher = (command, args, options) => … // :74
…
launch: internals.launch ?? launchDetachedApp // :148⇒ 也就是说 "打开方式"这类入口选的是
所以:如果只按当前补丁合并,你主帖的 reveal 症状会好,而你第三个形态仍然坏。 请在报告里明确写出这一点——这正好也解释了你观察到的"有的条目能开、有的不能"(非默认条目如 WPS 是经典 GUI 进程,不受影响)。 3. 建议的最终修法(一条覆盖两个载体)不要在
4. 一条同日同族的线索(建议引用)同一天有人报告:同一个 ⇒ 这两条合起来说明: 5. 版本你验的是 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
[Bug] Windows: "Show file location" / default-app open silently fails —
runNativeCommandforceswindowsHide: true, hiding Explorer's delegated windowEnglish
Affected versions: Desktop 0.1.7-rc.2 (embedded runtime). The same code is present in
@deepseek-ai/dsh-native-command0.1.5-rc.1 (lib/index.js,runNativeCommand,windowsHide: true).Reproduced in a normal interactive desktop session (clicking "Show file location", busy cursor ~0.5 s, then nothing) — distinct from the non-interactive-session blind spot documented in
packages/util/native-command/README.md:112; A/B confirmation in the comments.Component:
@deepseek-ai/dsh-native-command—runNativeCommand(shared execFile runner), consumed byrevealNativePath/openNativePath(Explorer delegation) viarunExplorer.Steps to reproduce
Same result for opening the workspace directory via the session-header "Open In..." control (same
runExplorerpath).Expected
Windows Explorer opens / reveals (selects) the file.
Actual
No window appears at all; the request is answered as successful, so the UI shows no failure.
Minimal reproduction (independent of DSH)
Any existing local file, e.g.
C:\Users\Public\reveal-sample.txt:Observed on Windows 11 (controlled experiment; same command line, same URL — the only variable is
windowsHide):windowsHide): window opens, file selected ✔execFilewithwindowsHide: true: no window ✘execFilewithoutwindowsHide(only variable changed): window opens, file selected ✔Root cause
runNativeCommandhard-codeswindowsHide: truefor every child process:windowsHidebecomesSTARTF_USESHOWWINDOW+SW_HIDEin the CreateProcess STARTUPINFO.explorer.exe /select,<target>is a delegation program: the new explorer process handsthe request to the always-running desktop shell and exits with code 1 (which
runExplorercorrectly accepts as "delegated"). The shell process that finally creates the window
inherits the show-state along the delegation, so the reveal window is created hidden.
The result is a silent no-op from the user's perspective, with a success answer on the wire.
The flag is correct for the console tools this runner also executes (reg.exe, PowerShell
icon extraction, wslpath, ...) — it is only the delegation-style Explorer invocations that
must not force it.
Scope
revealNativePath(Explorer/select,reveal): confirmed broken.openNativePathon win32 also goes throughrunExplorer(explorer.exe <target>),which delegates the same way, so default-app open of files/directories is expected to be
affected by the same mechanism (inferred from the shared code path; not separately tested).
openNativeFileApplication, third-party GUI apps) aretypically unaffected, because those apps create their windows from their own code and
ignore the inherited SW_HIDE (inferred; not separately tested).
Suggested fix
Do not force
windowsHidefor Explorer's delegation-style invocations; keep it for theconsole tools. Minimal change in
runNativeCommand(or an equivalent dedicated runner forrunExplorer):Workaround used locally (for reference)
Patched the embedded runtime's copy of
runNativeCommandwith the same one-linespecial-case (full
app.asarbackup taken first; the patch is overwritten by upgradesand must be re-applied until fixed upstream).
中文
影响版本: Desktop 0.1.7-rc.2(内嵌运行时)——
@deepseek-ai/dsh-native-command0.1.5-rc.1 中同样存在(lib/index.js的runNativeCommand,windowsHide: true)。复现环境:正常交互式桌面会话(点击"显示文件位置"后 busy 约 0.5 秒、无任何窗口)——区别于
README.md:112记录的"非交互式会话"已知盲区(评论区有 A/B 定案)。组件:
@deepseek-ai/dsh-native-command—runNativeCommand(共享 execFile runner),被revealNativePath/openNativePath(explorer 委托)经runExplorer调用。复现步骤
runExplorer接受)。会话头部 "Open In..." 打开工作区目录也走同一条
runExplorer链路,结果相同。期望 / 实际
最小复现(不依赖 DSH)
同上方英文节的脚本:
windowsHide: true不弹窗,去掉该参数立即弹窗并定位。根因
runNativeCommand对所有子进程硬编码windowsHide: true。windowsHide在 CreateProcess 的 STARTUPINFO 里成为STARTF_USESHOWWINDOW+SW_HIDE。explorer.exe /select,<目标>是委托式程序:新 explorer 进程把请求转交给常驻桌面 Shell 后以退出码 1 退出(runExplorer已正确把 1 当作"已转交")。最终创建窗口的 Shell 进程沿委托链继承 show 状态,于是定位窗口被创建为隐藏。用户视角就是静默无效果,而通信层应答成功。该标志对 runner 同时执行的控制台工具(reg.exe、PowerShell 图标提取、wslpath 等)是正确的——只有委托式的 Explorer 调用不应强制它。
影响面
revealNativePath(Explorer/select,定位):已实测损坏。openNativePath同样经runExplorer,默认应用打开文件/目录预期受同一机制影响(依据共享代码路径推断,未单独实测)。openNativeFileApplication,第三方 GUI 应用)通常不受影响:这些应用自行创建窗口、忽略继承的 SW_HIDE(推断,未单独实测)。建议修复
对 Explorer 的委托式调用不强制
windowsHide;控制台工具保持。见上方英文节的 diff(runNativeCommand最小改动,或为runExplorer提供专用 runner)。本地临时方案(供参考)
对内嵌运行时的
runNativeCommand做了同样的一行特判补丁(事先完整备份 app.asar;补丁会被升级覆盖,官方修复前需重新应用)。All reactions