mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 23:40:23 +00:00
fix: prefer bundled channel plugins over npm duplicates (#40094)
* fix: prefer bundled channel plugins over npm duplicates * fix: tighten bundled plugin review follow-ups * fix: address check gate follow-ups * docs: add changelog for bundled plugin install fix * fix: align lifecycle test formatting with CI oxfmt
This commit is contained in:
@@ -459,42 +459,26 @@ export async function syncPluginsForUpdateChannel(params: {
|
||||
if (!pathsEqual(record.sourcePath, bundledInfo.localPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const spec = record.spec ?? bundledInfo.npmSpec;
|
||||
if (!spec) {
|
||||
summary.warnings.push(`Missing npm spec for ${pluginId}; keeping local path.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
let result: Awaited<ReturnType<typeof installPluginFromNpmSpec>>;
|
||||
try {
|
||||
result = await installPluginFromNpmSpec({
|
||||
spec,
|
||||
mode: "update",
|
||||
expectedPluginId: pluginId,
|
||||
logger: params.logger,
|
||||
});
|
||||
} catch (err) {
|
||||
summary.errors.push(`Failed to install ${pluginId}: ${String(err)}`);
|
||||
continue;
|
||||
}
|
||||
if (!result.ok) {
|
||||
summary.errors.push(`Failed to install ${pluginId}: ${result.error}`);
|
||||
// Keep explicit bundled installs on release channels. Replacing them with
|
||||
// npm installs can reintroduce duplicate-id shadowing and packaging drift.
|
||||
loadHelpers.addPath(bundledInfo.localPath);
|
||||
const alreadyBundled =
|
||||
record.source === "path" &&
|
||||
pathsEqual(record.sourcePath, bundledInfo.localPath) &&
|
||||
pathsEqual(record.installPath, bundledInfo.localPath);
|
||||
if (alreadyBundled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
next = recordPluginInstall(next, {
|
||||
pluginId,
|
||||
source: "npm",
|
||||
spec,
|
||||
installPath: result.targetDir,
|
||||
version: result.version,
|
||||
...buildNpmResolutionInstallFields(result.npmResolution),
|
||||
sourcePath: undefined,
|
||||
source: "path",
|
||||
sourcePath: bundledInfo.localPath,
|
||||
installPath: bundledInfo.localPath,
|
||||
spec: record.spec ?? bundledInfo.npmSpec,
|
||||
version: record.version,
|
||||
});
|
||||
summary.switchedToNpm.push(pluginId);
|
||||
changed = true;
|
||||
loadHelpers.removePath(bundledInfo.localPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user