fix(plugins): sync official plugin installs during update (#78065)

* fix(plugins): sync official npm installs during update

* fix(plugins): sync official clawhub installs during update

* test(update): mock official plugin sync helpers

---------

Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
This commit is contained in:
Vincent Koc
2026-05-05 17:27:32 -07:00
committed by GitHub
parent 813fe0a3be
commit 2014c2327b
6 changed files with 378 additions and 19 deletions

View File

@@ -168,6 +168,8 @@ vi.mock("../utils.js", async (importOriginal) => {
});
vi.mock("../plugins/update.js", () => ({
resolveTrustedSourceLinkedOfficialClawHubSpec: vi.fn(() => undefined),
resolveTrustedSourceLinkedOfficialNpmSpec: vi.fn(() => undefined),
syncPluginsForUpdateChannel: (...args: unknown[]) => syncPluginsForUpdateChannel(...args),
updateNpmInstalledPlugins: (...args: unknown[]) => updateNpmInstalledPlugins(...args),
}));
@@ -2439,13 +2441,14 @@ describe("update-cli", () => {
| OpenClawConfig
| undefined;
const updateCall = vi.mocked(updateNpmInstalledPlugins).mock.calls[0]?.[0] as
| { skipDisabledPlugins?: boolean }
| { skipDisabledPlugins?: boolean; syncOfficialPluginInstalls?: boolean }
| undefined;
expect(syncConfig?.plugins?.installs).toEqual(pluginInstallRecords);
expect(syncConfig?.update?.channel).toBe("beta");
expect(syncConfig?.gateway?.auth).toBeUndefined();
expect(syncConfig?.plugins?.entries).toBeUndefined();
expect(updateCall?.skipDisabledPlugins).toBe(true);
expect(updateCall?.syncOfficialPluginInstalls).toBe(true);
});
it("persists channel and runs post-update work after switching from package to git", async () => {