fix(plugins): recover source-only install shadows

This commit is contained in:
Vincent Koc
2026-05-04 03:26:54 -07:00
parent 4c40686f9e
commit 51d3ec7395
5 changed files with 43 additions and 9 deletions

View File

@@ -421,7 +421,7 @@ function isTerminalPluginInstallSecurityFailure(code?: string): boolean {
);
}
function isAllowedBundledRecoveryIssue(
function isAllowedPluginRecoveryIssue(
issue: { path?: string; message?: string },
request: PluginInstallRequestContext,
): boolean {
@@ -434,7 +434,10 @@ function isAllowedBundledRecoveryIssue(
issue.message === `unknown channel id: ${pluginId}`) ||
(issue.path === "plugins.load.paths" &&
typeof issue.message === "string" &&
issue.message.includes("plugin path not found"))
issue.message.includes("plugin path not found")) ||
(issue.path === "plugins" &&
typeof issue.message === "string" &&
issue.message.includes("requires compiled runtime output"))
);
}
@@ -448,7 +451,7 @@ async function loadConfigFromSnapshotForInstall(
request: PluginInstallRequestContext,
snapshot: Awaited<ReturnType<typeof readConfigFileSnapshot>>,
): Promise<ConfigSnapshotForInstallPersist> {
if (resolvePluginInstallInvalidConfigPolicy(request) !== "allow-bundled-recovery") {
if (resolvePluginInstallInvalidConfigPolicy(request) !== "allow-plugin-recovery") {
throw buildInvalidPluginInstallConfigError(
"Config invalid; run `openclaw doctor --fix` before installing plugins.",
);
@@ -462,11 +465,11 @@ async function loadConfigFromSnapshotForInstall(
if (
snapshot.legacyIssues.length > 0 ||
snapshot.issues.length === 0 ||
snapshot.issues.some((issue) => !isAllowedBundledRecoveryIssue(issue, request))
snapshot.issues.some((issue) => !isAllowedPluginRecoveryIssue(issue, request))
) {
const pluginLabel = request.bundledPluginId ?? "the requested plugin";
throw buildInvalidPluginInstallConfigError(
`Config invalid outside the bundled recovery path for ${pluginLabel}; run \`openclaw doctor --fix\` before reinstalling it.`,
`Config invalid outside the plugin recovery path for ${pluginLabel}; run \`openclaw doctor --fix\` before reinstalling it.`,
);
}
let nextConfig = snapshot.config;