From 3b64bc752a44b5f6536d9c3d500f9b9417adc6f4 Mon Sep 17 00:00:00 2001 From: Marc J Saint-jour <82672745+Junebugg1214@users.noreply.github.com> Date: Thu, 12 Mar 2026 20:32:59 -0400 Subject: [PATCH] fix: invalidate command cache on plugin registry updates --- src/auto-reply/commands-registry.test.ts | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/auto-reply/commands-registry.test.ts b/src/auto-reply/commands-registry.test.ts index daff7304726..d72209c2871 100644 --- a/src/auto-reply/commands-registry.test.ts +++ b/src/auto-reply/commands-registry.test.ts @@ -198,6 +198,41 @@ describe("commands registry", () => { ]); }); + it("invalidates cached command lists after plugin registry updates", () => { + const before = listChatCommands(); + expect(before.find((command) => command.key === "dock:msteams")).toBeFalsy(); + + setActivePluginRegistry( + createTestRegistry([ + { + pluginId: "test-plugin", + source: "test", + plugin: { + id: "msteams", + meta: { + id: "msteams", + label: "Microsoft Teams", + selectionLabel: "Microsoft Teams", + docsPath: "/channels/msteams", + blurb: "test stub.", + }, + capabilities: { + chatTypes: ["direct"], + nativeCommands: true, + }, + config: { + listAccountIds: () => ["default"], + resolveAccount: () => ({}), + }, + }, + }, + ]), + ); + + const after = listChatCommands(); + expect(after.find((command) => command.key === "dock:msteams")).toBeTruthy(); + }); + it("detects known text commands", () => { const detection = getCommandDetection(); expect(detection.exact.has("/commands")).toBe(true);