mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
fix(update): skip plugins switched through ClawHub
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
resolvePostCoreUpdateChildStdio,
|
||||
resolvePostUpdateServiceStateReadEnv,
|
||||
resolvePostInstallDoctorEnv,
|
||||
resolvePostSyncPluginUpdateSkipIds,
|
||||
shouldPrepareUpdatedInstallRestart,
|
||||
resolveUpdatedGatewayRestartPort,
|
||||
shouldUseLegacyProcessRestartAfterUpdate,
|
||||
@@ -541,6 +542,18 @@ describe("collectMissingPluginInstallPayloads", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolvePostSyncPluginUpdateSkipIds", () => {
|
||||
it("skips plugins already switched through ClawHub or npm and repaired payloads", () => {
|
||||
expect(
|
||||
resolvePostSyncPluginUpdateSkipIds({
|
||||
switchedToClawHub: ["whatsapp"],
|
||||
switchedToNpm: ["voice-call"],
|
||||
repairedMissingPayloadIds: new Set(["telegram"]),
|
||||
}),
|
||||
).toStrictEqual(new Set(["whatsapp", "voice-call", "telegram"]));
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldUseLegacyProcessRestartAfterUpdate", () => {
|
||||
it("never restarts package updates through the pre-update process", () => {
|
||||
expect(shouldUseLegacyProcessRestartAfterUpdate({ updateMode: "npm" })).toBe(false);
|
||||
|
||||
@@ -264,6 +264,18 @@ type MissingPluginInstallPayload = {
|
||||
|
||||
type PostUpdatePluginWarning = NonNullable<PostCorePluginUpdateResult["warnings"]>[number];
|
||||
|
||||
export function resolvePostSyncPluginUpdateSkipIds(params: {
|
||||
switchedToClawHub: readonly string[];
|
||||
switchedToNpm: readonly string[];
|
||||
repairedMissingPayloadIds: ReadonlySet<string>;
|
||||
}): Set<string> {
|
||||
return new Set([
|
||||
...params.switchedToClawHub,
|
||||
...params.switchedToNpm,
|
||||
...params.repairedMissingPayloadIds,
|
||||
]);
|
||||
}
|
||||
|
||||
function isClawHubTrustNotice(message: string): boolean {
|
||||
const trimmed = stripAnsi(message).trimStart();
|
||||
return (
|
||||
@@ -2324,7 +2336,11 @@ export async function updatePluginsAfterCoreUpdate(params: {
|
||||
timeoutMs: params.timeoutMs,
|
||||
updateChannel: pluginUpdateChannel,
|
||||
coreVersion: coreVersion ?? undefined,
|
||||
skipIds: new Set([...syncResult.summary.switchedToNpm, ...missingPayloadIdSet]),
|
||||
skipIds: resolvePostSyncPluginUpdateSkipIds({
|
||||
switchedToClawHub: syncResult.summary.switchedToClawHub,
|
||||
switchedToNpm: syncResult.summary.switchedToNpm,
|
||||
repairedMissingPayloadIds: missingPayloadIdSet,
|
||||
}),
|
||||
skipDisabledPlugins: true,
|
||||
syncOfficialPluginInstalls: true,
|
||||
disableOnFailure: true,
|
||||
|
||||
Reference in New Issue
Block a user