Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(plugin): 升级没落地不再报成插件故障

hairyff2f05855ce52
diff --git a/src-tauri/src/service/plugin/install/single.rs b/src-tauri/src/service/plugin/install/single.rs
index 5b14b254..094436c8 100644
--- a/src-tauri/src/service/plugin/install/single.rs
+++ b/src-tauri/src/service/plugin/install/single.rs
@@ -391,21 +391,25 @@ async fn run_single_plugin_command(
// 清单依赖 basename),解析不到时跳过核验(警告即可,不误杀成功更新)。
if action == "update" {
// 假成功核验:pnpm 以 0 退出、但该依赖的解析结果与升级前完全一致,说明这次
- // 升级没有落地(典型:档案 spec 是 `catalog:`,范围被 catalog 条目钉死)。
- // 必须如实报错——报成功会让用户以为已在新版本上、实际仍在旧版本,比报失败
- // 更难发现(与 [`remove`] 的「卸载后核验」同理)。
+ // 升级没有落地。两种已知成因都属于「按当前策略不该动」,而不是插件损坏:
+ // 1. 档案 spec 把版本钉死(`catalog:` 条目 / git 提交 / `link:` 本地目录),
+ // `--latest` 也越不过声明范围;
+ // 2. pnpm 的 release-age 策略:新版本发布不足 `minimumReleaseAge`(pnpm 11
+ // 默认 1440 分钟 = 24 小时)时解析会回落到仍达标的最新版本,命令照旧以 0
+ // 退出且**不打印任何说明**——实测 bundled pnpm 11.7.0 在 `^2.10.15` 上
+ // `update --latest` 静默停在 2.10.15,把 `minimumReleaseAge: 0` 写进档案
+ // 才取到 2.11.2。因此这条消息不能只归因于 catalog 钉死(会把人引偏)。
+ // 必须如实报「没升级」——报成功会让用户以为已在新版本上(与 [`remove`] 的
+ // 「卸载后核验」同理);但**不**记进插件错误:插件没坏,记了会让列表挂上
+ // 「可能已损坏或与当前环境不兼容」的误导标记(安装/升级真失败各有记录点)。
if let Some(before) = before_fingerprint.as_deref() {
if dependency_fingerprint(&profile_dir(app_handle), id).as_deref() == Some(before) {
let detail = installed_package_version(&profile_dir(app_handle), id)
.unwrap_or_else(|| before.to_string());
- let message = format!(
- "PLUGIN_UPDATE_NO_CHANGE: pnpm exited successfully but {id} is still at {detail}; the profile pins this dependency (for example a `catalog:` entry in pnpm-workspace.yaml), so the upgrade did not take effect"
- );
- log::error!("dsh plugin update made no change for {id}: {detail}");
- if let Err(e) = errors::record(app_handle, id, action, &message) {
- log::warn!("failed to record plugin error for {id}: {e}");
- }
- return Err(message);
+ log::warn!("dsh plugin update made no change for {id}, still at {detail}");
+ return Err(format!(
+ "PLUGIN_UPDATE_NO_CHANGE: pnpm exited successfully but {id} is still at {detail}; no newer version was installed — either the profile pins this dependency (a `catalog:` entry in pnpm-workspace.yaml, a git spec, or a `link:` directory), or the newest release is still inside pnpm's `minimumReleaseAge` window (releases younger than the configured age are not resolved; bundled pnpm defaults to 24 hours), so the upgrade did not take effect"
+ ));
}
}
let Some(name) = installed_package_name(app_handle, id) else {
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 279e6e36..6b03e2f7 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -263,6 +263,7 @@
"plugins.remove_confirm_desc": "Uninstall {{name}}? Its features will no longer be available after removal.",
"plugins.remove_failed": "Failed to uninstall {{name}}",
"plugins.upgrade_failed": "Failed to upgrade {{name}}",
+ "plugins.upgrade_held": "{{name}} was not upgraded: the profile pins this dependency, or the new release has not passed the supply-chain age window (releases younger than 24 hours are not installed by default)",
"plugins.updated_toast": "Plugin {{name}} updated",
"plugins.removed_toast": "Plugin {{name}} uninstalled",
"plugins.disable": "Disable",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index f9b05bbb..584546c5 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -263,6 +263,7 @@
"plugins.remove_confirm_desc": "确定卸载插件 {{name}} 吗?卸载后其功能将不可用。",
"plugins.remove_failed": "卸载插件 {{name}} 失败",
"plugins.upgrade_failed": "升级插件 {{name}} 失败",
+ "plugins.upgrade_held": "{{name}} 没有升级:档案已钉死该依赖,或新版本尚未通过供应链保护期(默认 24 小时内不安装)",
"plugins.updated_toast": "插件 {{name}} 已更新",
"plugins.removed_toast": "插件 {{name}} 已卸载",
"plugins.disable": "禁用",
diff --git a/src/ui/config/plugin.tsx b/src/ui/config/plugin.tsx
index 465304cf..ab37f55f 100644
--- a/src/ui/config/plugin.tsx
+++ b/src/ui/config/plugin.tsx
@@ -101,6 +101,12 @@ export function ConfigPlugin() {
onError: (err, id) => {
const name = plugins.find(p => p.id === id)?.name ?? id
console.error('[ConfigPlugin] upgrade failed:', err)
+ // 「命令成功但版本没动」不是插件故障(档案钉死或 pnpm 的 release-age 策略,
+ // 见后端 PLUGIN_UPDATE_NO_CHANGE):报「升级失败」会把用户引去排查插件本身。
+ if (String(err).startsWith('PLUGIN_UPDATE_NO_CHANGE:')) {
+ toast(t('plugins.upgrade_held', { name }), { variant: 'warning' })
+ return
+ }
toast(t('plugins.upgrade_failed', { name }), {})
},
})