Skip to content

这次装的是 0.2.0,但它自带的「更新」按钮还是老毛病(代码里没做「先卸载再装」的补偿),以后再升级还是得走这套卸载重装的路。 #423

Closed

Description

@recall350

What happened? / 发生了什么?

这次装的是 0.2.0,但它自带的「更新」按钮还是老毛病(代码里没做「先卸载再装」的补偿),以后再升级还是得走这套卸载重装的路。

Screenshot (strongly recommended) / 截图(强烈建议)

No response

Steps to reproduce / 复现步骤

旧版本更新版本

Diagnostics / 诊断信息

DS Bot 0.2.0
DSH 0.2.1-rc.2
Surface DSH Desktop
OS darwin 22.6.0 x64
Node v24.18.1
Browser Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) DSHDesktop/2.0.18 Chrome/152.0.7977.54 Electron/44.0.0 Safari/537.36
Language zh
Team 4 Bots, 1 Main, 0 group chats
Models ss-chat/deepseek-flash, ss/deepseek-flash

The recent errors do not fit in the link. DS Bot copied the diagnostics to the clipboard: paste them below this line.

Privacy / 隐私

  • This report has no API keys, tokens or personal data. / 报告里没有 API key、token 或个人信息。

Activity

  1. iron-water commented on Oct 22, 2026

    @iron-water

    复核后确认是 ds-bot 侧的问题,不是 DSH 的问题。这里补上根因链和证据,避免再开重复 issue。

    根因

    DSH 的 @deepseek-ai/dsh-plugin-manager 里,installBundle() 在 HMR 在场时,会拒绝任何「已存在于 profile dependencies 的同名包」:

    // dsh-plugin-manager/lib/index.js:1991
    if (this.ownerContext.get("hmr") !== void 0 && known !== void 0 && Object.hasOwn(before, known))
      throw new ManagementFailure("already-installed");

    桌面 profile 恒带 profileContext,而 dsh-base 的补丁里 hmr 是:

    - id: hmr
      name: '@deepseek-ai/dsh-hmr'
      disabled: !!js "!ctx.get('profileContext')"

    所以 hmr 恒存在 → installBundle('ds-bot@0.2.0') 必然被拒。

    但 DSH 自己的「更新」按钮不受影响

    DSH 插件页的 update 不是直接 installBundle,而是先卸载再装:

    // dsh-client-ui-plugin-manager/lib/client.js
    update: (packageName) => {
      ...
      this.run(packageName, { action: "uninstall" }, async () => {
        const removed = await this.ctx.remote.pluginManager.removeBundle(packageName);
        if (removed.ok && removed.value.error?.code === "stop-profile") {
          this.openCatalogInstall(pkg, target, pkg.enabled);
          return;
        }
        this.applied(removed, packageName);
        this.openCatalogInstall(pkg, target, pkg.enabled);   // 这一步才 installBundle
      });
    }

    也就是说,插件的自更新必须走同一条 remove → install 路径;直接调 installBundle 就会撞上这条守卫。

    ds-bot 0.2.0 的实际代码

    src/host/update.js:207-214:

    function start() {
      ...
      void Promise.resolve(service.installBundle(chosen.spec, chosen.registry ? { registry: chosen.registry } : {}))

    只调 installBundle,没有 removeBundle 补偿 → 必然 already-installed。

    复现与证据

    环境:Windows 10 (26100 x64),DSH Desktop 0.2.1-rc.2(runtime 0.2.1-rc.2 / node 24.21.0 / pnpm 11.28.5),ds-bot 0.1.7 → 0.2.0。

    1. ~/.dsh/bot/logs/diagnostics.jsonl 的原文:
      {"level":"warn","source":"host","text":"update to ds-bot@0.2.0 failed: already-installed"}
    2. UI 复现:About 页提示「更新没有完成:already-installed」。
    3. 通过 POST /api/bot {"endpoint":"update-install"} 直接打同一路径,同样 already-installed。
    4. 反向验证:在同一 profile 手动执行 pnpm add ds-bot@0.2.0 成功(0.1.7 → 0.2.0),说明不是 registry、网络或权限问题。
    5. 定位验证:把那条守卫的 known !== void 0 改成 known === void 0 后,同一 UI 更新链路端到端成功(磁盘 node_modules/ds-bot 变 0.2.0,package.json 依赖同步为 0.2.0)——证明唯一阻塞点就是这条守卫。

    建议修复

    在 start() 里对已装包先 removeBundle 再 installBundle,对齐 DSH 官方 update 的路径;或者在捕获 already-installed 时自动回退到 remove → install。

    注意 removeBundle 可能返回 stop-profile(包正在被运行中的 profile 使用),需要像 DSH 官方 UI 那样处理这个分支,否则在某些状态下仍会失败。

  2. added
    P1Hurts daily use
    area/hostServer side: index.js, src/host (roster, turns, tools, permissions, usage)
    on Oct 23, 2026
  3. Fei2411 commented on Oct 23, 2026

    @Fei2411
    Owner

    Confirmed, and thanks @iron-water for the root-cause analysis and @recall350 for the report.

    Since DSH 0.2.1-rc.2 (deepseek-harness commit 879ad372ac), the plugin manager refuses installBundle() for a package the profile already has whenever HMR runs, which is always the case in DSH Desktop; an upgrade there is a removal and an installation. DS Bot's update only calls installBundle('ds-bot@<newest>'), so every update of a registry install fails with already-installed.

    The fix goes into 0.2.2: on already-installed, DS Bot removes itself and installs the new version, as the plugin page's Update does for official plugins, and the new version reports how the update ended. Because the button runs the code of the version you have, 0.2.1 and earlier still need one manual update; I will post the steps here once they are checked.

  4. Fei2411 commented on Oct 23, 2026

    @Fei2411
    Owner

    The fix is in #505 (into dev, for 0.2.2).

    Until then, and once for anyone on DS Bot 0.2.1 or earlier in DSH Desktop 0.2.1-rc.2 or later (the Update button runs the code of the version you have):

    1. In DSH Desktop, open the Plugins page and remove ds-bot.
    2. Add the plugin ds-bot again.

    The Bots, chats and memory stay: they live in DS Bot's data folder under the DSH home, not in the package. Checked on DSH Web 0.2.1-rc.2 with HMR: after removing and adding ds-bot again, the Bot and its chat were back and kept working.

  5. added a commit that references this issue on Oct 25, 2026
    1ce3407
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Hurts daily usearea/hostServer side: index.js, src/host (roster, turns, tools, permissions, usage)bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions