Replies: 1 comment
|
@Qz-zhong 你的机制链条完全成立, 我在 1. 崩溃机制: 你判断的没错, 且 sandbox 包的 README 已自述
所以: 这个崩溃在 confined 层是 known/限定的, 修它意味着要么给 confined 子进程一个真实控制台(违反隔离语义), 要么接受崩溃并在工具结果层把它转成可读错误。 2. 真正值得修的是: 崩溃不该弹模态框到用户桌面你的痛点不是"进程死了"(这可由工具返回值承载), 而是 Windows 弹出模态 "Application Error" 框到用户桌面——这在 agent 运行期间是骚扰性、非预期的 UI。而这在 dsh 侧是独立可修的, 与 confinement 限制正交:
3. 建议分级(供 maintainer 参考)
一个澄清问题: 你观察到的弹窗是只在 我可以基于这个出一个参考 diff(spawn 层 SetErrorMode 抑制 + 工具结果错误化 + 注入式单测 stub 受限 spawn 抛 0xC0000142 断言不弹窗/转错误)。这个属于 in-tree(subprocess/native-command spawn 层)修复, 非插件面——比造插件价值更高。 |
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.
curl.exe@deepseek-ai/dsh— Windows 文件沙箱 / tool 执行层(@deepseek-ai/dsh-sandbox-windows-acl及使用其 spawn 的工具,如dsh-tool-pwsh、dsh-native-command)English Summary (paste-ready)
When an agent tool command runs under the Windows file sandbox (
read-only/workspace-write), the harness spawns the process under a WRITE_RESTRICTED token (CreateRestrictedToken, restricting SIDs: logon SID + Everyone [+ workspace/temp write SIDs]) viaCreateProcessAsUserW. Any native console executable spawned by that process (observed withcurl.exe, alsowhere.exe,node.exe) dies beforemain()withSTATUS_DLL_INIT_FAILED (0xC0000142)whenever it is launched without a real console (hidden-console /CREATE_NO_WINDOWpattern), and Windows pops the "Application Error" dialog on the user's desktop. The sandbox package's own docs already state this limitation ("hidden-console children die with STATUS_DLL_INIT_FAILED (0xC0000142) — verified empirically"; "children share the host console (CREATE_NO_WINDOW / CREATE_NEW_CONSOLE children die with STATUS_DLL_INIT_FAILED under the restriction)"). Confirmation: the exact samecurl.exeruns fine (exit 0) when the command is escalated to full access (no restricted token). Impact: intermittent OS error dialogs during agent runs + silent failure of native tools in the confined shell. Fix suggestion: suppress the loader error dialog / give confined console children a real console, or route load failures into the tool result instead of a modal dialog.1. 环境 / Environment
10.0.26100(事件日志 ntdll/ucrt 版本10.0.26100.8972)应用程序无法正常启动(0xc0000142))D:\Nodejs\nodev24.15\node_global\node_modules\@deepseek-ai\dsh(含@deepseek-ai/dsh-sandbox-windows-acl等)workspace-write(受限);对照实验用danger-full-access(不受限)C:\Windows\System32\curl.exe(8.21.0,静态链接,Authenticode Valid);D:\git\Git\Git\mingw64\bin\curl.exe(8.11.0,动态 libcurl)2. 现象 / Symptom
用户在 DeepSeek Harness(Web GUI)中运行 agent 任务时,桌面偶发弹出系统错误框:
对应地,该次工具调用的命令无任何输出(进程在
main()之前就死了)。偶发性根因:仅当某次任务里,受限沙箱内的命令去启动原生控制台 exe(本会话中触发点是
curl.exe、where.exe curl、node --version等)时才发生;纯 cmdlet / pnpm(cmd shim) / 进程内 HTTP(Invoke-RestMethod、node fetch)不受影响。3. 复现步骤 / Reproduction
workspace-write)下,通过 pwsh 工具执行任一原生控制台程序:0xC0000142Application Error 框。sandbox_permissions: danger-full-access(无受限令牌)再执行一次:exit 0(curl 8.21.0 … libcurl/8.21.0 Schannel/curl 8.11.0 …)。结论:与 curl 自身、PATH、Git/MinGW、系统文件完整性均无关,差异仅在“是否处于受限令牌沙箱”。
4. 根因分析 / Root Cause
错误码
0xC0000142=STATUS_DLL_INIT_FAILED,是 Windows 加载器在进程初始化阶段(main()之前)的失败。机制链条:
@deepseek-ai/dsh-sandbox-windows-acl)通过CreateRestrictedToken(flags=WRITE_RESTRICTED,restricting SIDs = logon SID + Everyone,workspace-write 再加入 workspace/temp write SID)制造受限令牌,并用CreateProcessAsUserW在该令牌下启动命令子进程。windowsHide: true,见dsh-native-command、dsh-host-directory-picker-native),加载器初始化失败 →0xC0000142。源码内的自述证据(
@deepseek-ai/dsh-sandbox-windows-acl):lib/types-CNjZgO4h.js(spawn 模块注释):即:该 0xC0000142 是已知边界,但当前行为把它暴露成了:① 桌面模态弹窗;② 受限 shell 内原生工具静默不可用。真正缺的是“把加载失败优雅地归入工具结果(而非弹窗)”或“给受限控制台子进程真实控制台”。
5. 影响 / Impact
curl等原生工具完全不可用(每次调用都静默失败)——例如 agent 在默认策略下用curl做 HTTP 探测/下载一律拿不到结果,只能靠升级权限或换进程内 HTTP。6. 建议修复 / Suggested Fix(按优先级)
SetErrorMode(SEM_NOGPFAULTERRORBOX)/SetThreadErrorMode(或 spawn 后兜底),使0xC0000142类加载失败静默化,并让工具层能拿到退出码/错误文本而非空输出。改动点:dsh-sandbox-windows-acl的 spawn 封装。CREATE_NO_WINDOW(正是触发条件)。7. 规避方法 / Workaround(用户侧,已在用)
sandbox_permissions: danger-full-access(实测 exit 0)执行,或改用进程内Invoke-RestMethod/Invoke-WebRequest/ node fetch。8. 附:无关的旁证(请勿据此排查)
事件日志里
NahimicSvc32.exe、HnTrustCircleService.exe、python.exe(Qt6Core.dll)、DllHost(combase)等另有崩溃记录,与本问题无因果关系(本问题仅在受限令牌 spawn 路径出现,完整权限下 curl/node 全部正常)。All reactions