
























@@ -535,18 +535,6 @@ describe("doctor repair sequencing", () => {
535535],
536536warnings: [],
537537});
538-mocks.maybeRepairStalePluginConfig.mockImplementationOnce((cfg: OpenClawConfig) => ({
539-config: {
540- ...cfg,
541-plugins: {
542- ...cfg.plugins,
543-allow: [],
544-entries: {},
545-},
546-},
547-changes: ["- plugins.entries: removed 1 stale plugin entry (brave)"],
548-}));
549-550538const result = await runDoctorRepairSequence({
551539state: {
552540cfg: {
@@ -610,18 +598,30 @@ describe("doctor repair sequencing", () => {
610598warnings: [
611599'Failed to install missing configured plugin "brave" from @openclaw/brave-plugin: package install failed',
612600],
601+failedPluginIds: ["brave"],
613602});
614-mocks.maybeRepairStalePluginConfig.mockImplementationOnce((cfg: OpenClawConfig) => ({
615-config: {
616- ...cfg,
617-plugins: {
618- ...cfg.plugins,
619-allow: [],
620-entries: {},
621-},
603+mocks.maybeRepairStalePluginConfig.mockImplementationOnce(
604+(
605+cfg: OpenClawConfig,
606+_env: NodeJS.ProcessEnv | undefined,
607+params: { preservePluginIds?: string[] },
608+) => {
609+expect(params.preservePluginIds).toEqual(["brave"]);
610+return {
611+config: {
612+ ...cfg,
613+plugins: {
614+ ...cfg.plugins,
615+allow: ["brave"],
616+entries: {
617+brave: cfg.plugins?.entries?.brave,
618+},
619+},
620+},
621+changes: ["plugins.entries: removed 1 stale plugin entry (old-plugin)"],
622+};
622623},
623-changes: ["plugins.entries: removed 1 stale plugin entry (brave)"],
624-}));
624+);
625625626626const result = await runDoctorRepairSequence({
627627state: {
@@ -641,6 +641,9 @@ describe("doctor repair sequencing", () => {
641641},
642642},
643643},
644+"old-plugin": {
645+enabled: true,
646+},
644647},
645648},
646649} as OpenClawConfig,
@@ -660,6 +663,9 @@ describe("doctor repair sequencing", () => {
660663},
661664},
662665},
666+"old-plugin": {
667+enabled: true,
668+},
663669},
664670},
665671} as OpenClawConfig,
@@ -669,12 +675,68 @@ describe("doctor repair sequencing", () => {
669675doctorFixCommand: "openclaw doctor --fix",
670676});
671677672-expect(mocks.maybeRepairStalePluginConfig).not.toHaveBeenCalled();
673678expect(result.state.candidate.plugins?.allow).toEqual(["brave"]);
674679expect(result.state.candidate.plugins?.entries?.brave?.enabled).toBe(true);
675-expect(result.state.pendingChanges).toBe(false);
680+expect(result.state.candidate.plugins?.entries?.["old-plugin"]).toBeUndefined();
681+expect(result.state.pendingChanges).toBe(true);
682+expect(result.changeNotes).toContain(
683+"plugins.entries: removed 1 stale plugin entry (old-plugin)",
684+);
676685expect(result.warningNotes).toStrictEqual([
677686'Failed to install missing configured plugin "brave" from @openclaw/brave-plugin: package install failed',
678687]);
679688});
689+690+it("preserves configured channels when their install repair fails", async () => {
691+mocks.repairMissingConfiguredPluginInstalls.mockResolvedValueOnce({
692+changes: [],
693+warnings: [
694+'Failed to install missing configured channel plugin "whatsapp" from @openclaw/whatsapp: package install failed',
695+],
696+failedPluginIds: ["whatsapp"],
697+});
698+mocks.maybeRepairStalePluginConfig.mockImplementationOnce(
699+(
700+cfg: OpenClawConfig,
701+_env: NodeJS.ProcessEnv | undefined,
702+params: { preservePluginIds?: string[] },
703+) => {
704+expect(params.preservePluginIds).toEqual(["whatsapp"]);
705+return {
706+config: cfg,
707+changes: [],
708+};
709+},
710+);
711+712+const result = await runDoctorRepairSequence({
713+state: {
714+cfg: {
715+channels: {
716+whatsapp: {
717+allowFrom: ["+15555550123"],
718+},
719+},
720+} as OpenClawConfig,
721+candidate: {
722+channels: {
723+whatsapp: {
724+allowFrom: ["+15555550123"],
725+},
726+},
727+} as OpenClawConfig,
728+pendingChanges: false,
729+fixHints: [],
730+},
731+doctorFixCommand: "openclaw doctor --fix",
732+});
733+734+expect(mocks.maybeRepairStalePluginConfig).toHaveBeenCalledOnce();
735+expect(result.state.candidate.channels?.whatsapp).toEqual({
736+allowFrom: ["+15555550123"],
737+});
738+expect(result.warningNotes).toStrictEqual([
739+'Failed to install missing configured channel plugin "whatsapp" from @openclaw/whatsapp: package install failed',
740+]);
741+});
680742});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。