

























@@ -2766,6 +2766,16 @@ describe("update-cli", () => {
27662766runtimeConfig: migratedConfig,
27672767valid: true,
27682768hash: "migrated-hash",
2769+})
2770+.mockResolvedValue({
2771+ ...baseSnapshot,
2772+parsed: migratedConfig,
2773+resolved: migratedConfig,
2774+sourceConfig: migratedConfig,
2775+config: migratedConfig,
2776+runtimeConfig: migratedConfig,
2777+valid: true,
2778+hash: "migrated-hash",
27692779});
27702780legacyConfigRepairMocks.repairLegacyConfigForUpdateChannel.mockImplementationOnce(
27712781async (params: { configSnapshot: ConfigFileSnapshot; jsonMode: boolean }) => {
@@ -2953,6 +2963,65 @@ describe("update-cli", () => {
29532963expect(lastWrite?.nextConfig?.update?.channel).toBe("beta");
29542964});
295529652966+it("refreshes post-doctor config before post-update plugin sync", async () => {
2967+const tempDir = createCaseDir("openclaw-update");
2968+mockPackageInstallStatus(tempDir);
2969+const preUpdateConfig = { update: { channel: "stable" } } as OpenClawConfig;
2970+const postDoctorConfig = {
2971+update: { channel: "stable" },
2972+meta: { lastTouchedVersion: "2026.5.14" },
2973+} as OpenClawConfig;
2974+vi.mocked(readConfigFileSnapshot)
2975+.mockResolvedValueOnce({
2976+ ...baseSnapshot,
2977+sourceConfig: preUpdateConfig,
2978+config: preUpdateConfig,
2979+hash: "pre-update-hash",
2980+})
2981+.mockResolvedValue({
2982+ ...baseSnapshot,
2983+sourceConfig: postDoctorConfig,
2984+config: postDoctorConfig,
2985+hash: "post-doctor-hash",
2986+});
2987+syncPluginsForUpdateChannel.mockImplementation(async ({ config }) => ({
2988+changed: true,
2989+config: {
2990+ ...config,
2991+plugins: {
2992+ ...config.plugins,
2993+load: { paths: ["/tmp/openclaw-updated-plugin"] },
2994+},
2995+},
2996+summary: {
2997+switchedToBundled: [],
2998+switchedToNpm: [],
2999+warnings: [],
3000+errors: [],
3001+},
3002+}));
3003+updateNpmInstalledPlugins.mockImplementation(async ({ config }) => ({
3004+changed: false,
3005+ config,
3006+outcomes: [],
3007+}));
3008+3009+await updateCommand({ yes: true });
3010+3011+const syncConfig = syncPluginCall()?.config as
3012+| (OpenClawConfig & { meta?: { lastTouchedVersion?: string } })
3013+| undefined;
3014+const lastWrite = lastReplaceConfigCall() as
3015+| {
3016+baseHash?: string;
3017+nextConfig?: OpenClawConfig & { meta?: { lastTouchedVersion?: string } };
3018+}
3019+| undefined;
3020+expect(syncConfig?.meta?.lastTouchedVersion).toBe("2026.5.14");
3021+expect(lastWrite?.baseHash).toBe("post-doctor-hash");
3022+expect(lastWrite?.nextConfig?.meta?.lastTouchedVersion).toBe("2026.5.14");
3023+});
3024+29563025it("uses source config and plugin index records for post-update plugin sync", async () => {
29573026const tempDir = createCaseDir("openclaw-update");
29583027mockPackageInstallStatus(tempDir);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。