Replies: 1 comment
|
Same failure class as #1197 — a single unresolvable entry kills the whole tree with an opaque AggregateError. This exact scenario (dangling reference from a removed/renamed package) is what the #1197 root-cause chain covers (loader resolves against the profile dir, no validation, no degradation, Two things already exist for this:
Worth consolidating this into the #1496 guardrails advisory alongside #1197/#1404 — same missing-validation root. |
Uh oh!
There was an error while loading. Please reload this page.
摘要
当用户的 profile(
~/.dsh/profiles/<name>/)组合里存在一个无法解析的插件条目(包不存在/已改名/被移除)时,loader 在启动阶段 fail-fast,整个dsh web启动中止(plugin tree failed to load),没有任何跳过或降级路径;同时顶层错误链把最深层的"哪个条目、哪个包、从哪个目录导入"信息层层包装成难以定位的AggregateError,不指明该条目声明在哪个 profile 文件、也不给修复动作。这是 #328 的完整现象:用户安装社区组件后 profile 多了一个ui-dsh-aionui-panel(@deepseek-ai/dsh-client-ui-aionui-panel,官方 rc.6 包不存在此包),此后pnpm dsh web必崩,且错误堆栈几乎无法引导修复。复现步骤
~/.dsh/profiles/web/cordis.patch.yml)中加入一条引用不存在包的条目,例如:dsh web(或源码运行pnpm dsh web)。plugin tree failed to load → failed to apply loader entry include (cordis:include) → loader entries failed to apply → failed to import loader entry ui-dsh-aionui-panel ... Cannot find package '@deepseek-ai/dsh-client-ui-aionui-panel' imported from C:\Users\...\.dsh\profiles\web\(win10 运行 pnpm dsh web报错,之前正常,安装完dsh-web-ui 后报错。 #328 原文,此链深达 6 层)。根因(源码定位,rc.6)
抛错(用户堆栈中的
vendor/loader/src/config/entry.ts:282-287:failed to import loader entry <id>: Cannot find package <pkg> imported from <dir>),EntryGroup.update整体reject(
group.ts:80)——一个坏条目 = 整棵插件树失败,没有"跳过缺失条目"的机制。@deepseek-ai/dsh-app-boot/lib/index.jsL1164-1174 把 loader失败统一包装成
plugin tree failed to load(stage 名),后续的failed to apply loader entry include (cordis:include)/loader entries failed to apply只说明"include 组失败",不重复携带最内层的条目 id 与包名——用户看到的第一屏错误无法定位。
的提示;而 profile 文件可能在多个位置(用户 profile、bundle 组合、patch 层),
用户无从知道改哪里。
会话中 agent 编辑 patch 文件(安装一个自己开发的图片识别插件,把dsh搞崩了( 本轮运行失败Invalid schema for function 'vision_query': schema must be a JSON Schema of 'type: "object"', got 'type: null'.) #297 案例)、或官方包改名后的陈旧引用(dsh web fails after global pnpm install: loader cannot resolve ~88 plugin packages #204 族)。
建议修复
方案 A(推荐)· 顶层错误携带条目级上下文与修复指引:在
dsh-app-boot(或 loader的 include 失败包装层)把最内层的"条目 id + 包名 + 导入目录"上浮到第一屏,并追加
一条可执行建议:"entry 'X' 在 <profile 目录> 无法解析——从该 profile 的组合文件中
删除此条目,或安装对应包后重试;也可用 --profile <其他> 启动"。改动小、收益直接。
方案 B · 缺失条目可跳过:给 loader 条目增加
optional: true(或启动参数--ignore-missing-entries),import 失败时记录 warn 并跳过,而不是整树失败。需要区分"可选 UI 装饰插件"(跳过无害)与"核心服务插件"(跳过会半残)——建议只对
optional标记生效,默认仍 fail-fast。方案 C(诊断工具)· profile 预检:
dsh web启动前(或提供dsh doctor子命令)扫描 profile 组合中每条目的包可解析性,先于 loader 给出"哪个文件哪一行"的清单。
社区已有 dsh-doctor 工具(#432)做类似事,官方内置可根治此体验。
影响
dsh web直接不可启动,且修复靠人工翻profile 文件(win10 运行 pnpm dsh web报错,之前正常,安装完dsh-web-ui 后报错。 #328、dsh web fails after global pnpm install: loader cannot resolve ~88 plugin packages #204 族)
坏条目,官方没有兜底
环境
dsh-app-boot/lib/index.jsL1164-1174)group.ts:80,rc.6 同构)
验证材料
@deepseek-ai/dsh-client-ui-aionui-panel,出厂 profile 也无 aionui 引用 → 条目来自用户侧,但产品对坏条目零兜底
First analysis of discussion #328. Happy to open a PR with fix option A.
All reactions