Skip to content

Commit 4145018

Browse files
fix: clear plugin discovery cache after plugin installation (openclaw#39752)
Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: GazeKingNuWu <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
1 parent a40c29b commit 4145018

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Docs: https://docs.openclaw.ai
2424

2525
- Docker/runtime image: prune dev dependencies, strip build-only dist metadata for smaller Docker images. (#40307) Thanks @vincentkoc.
2626
- Plugins/channel onboarding: prefer bundled channel plugins over duplicate npm-installed copies during onboarding and release-channel sync, preventing bundled plugins from being shadowed by npm installs with the same plugin ID. (#40092)
27+
- Feishu/plugin onboarding: clear the short-lived plugin discovery cache before reloading the registry after installing a channel plugin, so onboarding no longer re-prompts to download Feishu immediately after a successful install. Fixes #39642. (#39752) Thanks @GazeKingNuWu.
2728
- macOS app/chat UI: route browser proxy through the local node browser service, preserve plain-text paste semantics, strip completed assistant trace/debug wrapper noise from transcripts, refresh permission state after returning from System Settings, and tolerate malformed cron rows in the macOS tab. (#39516) Thanks @Imhermes1.
2829
- Mattermost replies: keep `root_id` pinned to the existing thread root when an agent replies inside a thread, while still using reply-target threading for top-level posts. (#27744) thanks @hnykda.
2930
- Agents/failover: detect Amazon Bedrock `Too many tokens per day` quota errors as rate limits across fallback, cron retry, and memory embeddings while keeping context-window `too many tokens per request` errors out of the rate-limit lane. (#39377) Thanks @gambletan.

src/commands/onboarding/plugin-install.test.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,21 @@ vi.mock("../../plugins/loader.js", () => ({
4949
loadOpenClawPlugins: vi.fn(),
5050
}));
5151

52+
const clearPluginDiscoveryCache = vi.fn();
53+
vi.mock("../../plugins/discovery.js", () => ({
54+
clearPluginDiscoveryCache: () => clearPluginDiscoveryCache(),
55+
}));
56+
5257
import fs from "node:fs";
5358
import type { ChannelPluginCatalogEntry } from "../../channels/plugins/catalog.js";
5459
import type { OpenClawConfig } from "../../config/config.js";
60+
import { loadOpenClawPlugins } from "../../plugins/loader.js";
5561
import type { WizardPrompter } from "../../wizard/prompts.js";
5662
import { makePrompter, makeRuntime } from "./__tests__/test-utils.js";
57-
import { ensureOnboardingPluginInstalled } from "./plugin-install.js";
63+
import {
64+
ensureOnboardingPluginInstalled,
65+
reloadOnboardingPluginRegistry,
66+
} from "./plugin-install.js";
5867

5968
const baseEntry: ChannelPluginCatalogEntry = {
6069
id: "zalo",
@@ -236,4 +245,27 @@ describe("ensureOnboardingPluginInstalled", () => {
236245
expect(note).toHaveBeenCalled();
237246
expect(runtime.error).not.toHaveBeenCalled();
238247
});
248+
249+
it("clears discovery cache before reloading the onboarding plugin registry", () => {
250+
const runtime = makeRuntime();
251+
const cfg: OpenClawConfig = {};
252+
253+
reloadOnboardingPluginRegistry({
254+
cfg,
255+
runtime,
256+
workspaceDir: "/tmp/openclaw-workspace",
257+
});
258+
259+
expect(clearPluginDiscoveryCache).toHaveBeenCalledTimes(1);
260+
expect(loadOpenClawPlugins).toHaveBeenCalledWith(
261+
expect.objectContaining({
262+
config: cfg,
263+
workspaceDir: "/tmp/openclaw-workspace",
264+
cache: false,
265+
}),
266+
);
267+
expect(clearPluginDiscoveryCache.mock.invocationCallOrder[0]).toBeLessThan(
268+
vi.mocked(loadOpenClawPlugins).mock.invocationCallOrder[0] ?? Number.POSITIVE_INFINITY,
269+
);
270+
});
239271
});

src/commands/onboarding/plugin-install.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
findBundledPluginSourceInMap,
1010
resolveBundledPluginSources,
1111
} from "../../plugins/bundled-sources.js";
12+
import { clearPluginDiscoveryCache } from "../../plugins/discovery.js";
1213
import { enablePluginInConfig } from "../../plugins/enable.js";
1314
import { installPluginFromNpmSpec } from "../../plugins/install.js";
1415
import { buildNpmResolutionInstallFields, recordPluginInstall } from "../../plugins/installs.js";
@@ -224,6 +225,7 @@ export function reloadOnboardingPluginRegistry(params: {
224225
runtime: RuntimeEnv;
225226
workspaceDir?: string;
226227
}): void {
228+
clearPluginDiscoveryCache();
227229
const workspaceDir =
228230
params.workspaceDir ?? resolveAgentWorkspaceDir(params.cfg, resolveDefaultAgentId(params.cfg));
229231
const log = createSubsystemLogger("plugins");

src/cron/isolated-agent/run.test-harness.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ vi.mock("../../agents/skills/refresh.js", () => ({
6464
}));
6565

6666
vi.mock("../../agents/workspace.js", () => ({
67+
DEFAULT_IDENTITY_FILENAME: "IDENTITY.md",
6768
ensureAgentWorkspace: vi.fn().mockResolvedValue({ dir: "/tmp/workspace" }),
6869
}));
6970

0 commit comments

Comments
 (0)