From e27fe55aa8e345806e252c2e1d12f9a442b894d4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 29 Apr 2026 04:33:10 +0100 Subject: [PATCH] refactor: simplify plugin cache boundaries --- docs/plugins/architecture-internals.md | 4 + .../provider-catalog.contract-test-support.ts | 7 +- src/agents/models-config.e2e-harness.ts | 9 -- ...els-config.runtime-source-snapshot.test.ts | 2 - .../pi-embedded-runner-extraparams.test.ts | 1 - ...r.sanitize-session-history.test-harness.ts | 2 - ...ed-runner.sanitize-session-history.test.ts | 2 - ...orward-compat.errors-and-overrides.test.ts | 1 - .../model.forward-compat.test.ts | 1 - .../model.provider-runtime.test-support.ts | 2 - .../model.startup-retry.test.ts | 21 ++-- src/agents/pi-embedded-runner/model.test.ts | 1 - src/agents/pi-embedded-runner/model.ts | 15 +-- .../skills-runtime.integration.test.ts | 3 - src/agents/runtime-plan/build.test.ts | 2 - src/agents/skills.test.ts | 4 - .../pi-embedded-runner-e2e-mocks.ts | 1 - src/auto-reply/reply/commands-plugins.test.ts | 4 - src/auto-reply/reply/commands-plugins.ts | 5 - src/channels/plugins/bootstrap-registry.ts | 2 - .../plugins/bundled.shape-guard.test.ts | 2 +- .../channel-import-guardrails.test.ts | 1 - .../plugins-core.loader.contract.test.ts | 4 - .../plugins-core.registry.contract.test.ts | 4 - src/channels/plugins/read-only.ts | 6 - .../setup-helpers.import-safety.test.ts | 2 - src/channels/plugins/setup-helpers.test.ts | 2 - src/channels/plugins/setup-helpers.ts | 2 - src/cli/plugins-cli-test-helpers.ts | 3 - src/cli/plugins-cli.install.test.ts | 2 - src/cli/plugins-install-command.ts | 6 - .../channel-setup/plugin-install.test.ts | 10 +- src/commands/channel-setup/plugin-install.ts | 1 - src/commands/doctor-plugin-manifests.ts | 1 - src/commands/doctor-state-integrity.ts | 2 - .../shared/plugin-registry-migration.ts | 1 - .../models/list.provider-catalog.test.ts | 1 - src/commands/models/list.provider-catalog.ts | 1 - .../plugin-control-plane-cold-imports.test.ts | 4 - src/config/config.pruning-defaults.test.ts | 3 - src/config/doc-baseline.ts | 2 - src/config/model-alias-defaults.test.ts | 3 - src/config/plugin-auto-enable.test-helpers.ts | 8 +- src/config/runtime-schema.test.ts | 5 +- src/config/runtime-schema.ts | 1 - src/gateway/server-methods/cron.ts | 1 - ...otstrap.browser-plugin.integration.test.ts | 4 - src/hooks/plugin-hooks.ts | 1 - ...rovider-usage.auth.normalizes-keys.test.ts | 2 - .../facade-activation-check.runtime.ts | 111 ++---------------- src/plugin-sdk/facade-loader.ts | 41 +------ src/plugin-sdk/facade-resolution-shared.ts | 13 -- src/plugin-sdk/facade-runtime.test.ts | 4 - src/plugin-sdk/facade-runtime.ts | 15 +-- src/plugin-sdk/provider-catalog-runtime.ts | 5 +- src/plugin-sdk/qa-runner-runtime.test.ts | 1 - src/plugin-sdk/qa-runner-runtime.ts | 2 +- .../test-helpers/provider-catalog.ts | 5 +- src/plugins/activation-planner.ts | 2 - src/plugins/bundle-commands.ts | 1 - src/plugins/bundle-mcp.test-support.ts | 4 - src/plugins/bundled-capability-runtime.ts | 2 - src/plugins/bundled-plugin-metadata.test.ts | 13 -- src/plugins/bundled-plugin-metadata.ts | 5 - .../capability-provider-runtime.test.ts | 9 +- src/plugins/capability-provider-runtime.ts | 9 -- src/plugins/channel-presence-policy.ts | 10 -- .../cli.browser-plugin.integration.test.ts | 4 - src/plugins/config-contracts.ts | 2 - .../contracts/runtime-seams.contract.test.ts | 6 - .../test-helpers/bundled-plugin-roots.ts | 2 +- src/plugins/discovery.test.ts | 5 +- src/plugins/discovery.ts | 6 - src/plugins/doctor-contract-registry.ts | 1 - .../installed-plugin-index-registry.ts | 3 - src/plugins/installed-plugin-index-types.ts | 1 - src/plugins/installed-plugin-index.ts | 2 +- src/plugins/loader.prefer-over.test.ts | 4 - src/plugins/loader.test-fixtures.ts | 4 - src/plugins/loader.test.ts | 2 +- src/plugins/loader.ts | 5 - .../manifest-model-id-normalization.test.ts | 6 +- .../manifest-model-id-normalization.ts | 5 - .../manifest-registry-installed.test.ts | 6 +- src/plugins/manifest-registry-installed.ts | 6 - src/plugins/manifest-registry-state.ts | 4 - src/plugins/manifest-registry.test.ts | 16 +-- src/plugins/manifest-registry.ts | 4 - src/plugins/plugin-registry-snapshot.ts | 5 - src/plugins/provider-hook-runtime.ts | 11 -- src/plugins/provider-public-artifacts.ts | 5 - ...r-runtime.synthetic-auth-discovery.test.ts | 2 - src/plugins/provider-runtime.test.ts | 6 +- src/plugins/provider-runtime.ts | 24 ---- src/plugins/providers.test.ts | 3 - src/plugins/providers.ts | 4 - .../runtime/runtime-plugin-boundary.ts | 2 - src/plugins/setup-registry.runtime.test.ts | 2 +- src/plugins/setup-registry.runtime.ts | 2 +- .../stage-bundled-plugin-runtime.test.ts | 2 - src/plugins/status.registry-snapshot.test.ts | 4 - src/plugins/synthetic-auth.runtime.test.ts | 4 +- src/plugins/synthetic-auth.runtime.ts | 2 +- .../web-fetch-providers.runtime.test.ts | 7 +- src/plugins/web-fetch-providers.runtime.ts | 9 -- .../web-search-providers.runtime.test.ts | 13 +- src/plugins/web-search-providers.runtime.ts | 9 -- ...-config-collectors-plugins.bundled.test.ts | 1 - .../runtime-config-collectors-plugins.ts | 1 - .../runtime.integration.test-helpers.ts | 8 -- src/secrets/runtime.ts | 1 - src/security/dangerous-config-flags.ts | 1 - .../trigger-handling-test-harness.ts | 2 - test/setup-openclaw-runtime.ts | 25 +--- 114 files changed, 58 insertions(+), 617 deletions(-) delete mode 100644 src/plugins/manifest-registry-state.ts diff --git a/docs/plugins/architecture-internals.md b/docs/plugins/architecture-internals.md index fe153015108..eafbcab5300 100644 --- a/docs/plugins/architecture-internals.md +++ b/docs/plugins/architecture-internals.md @@ -92,6 +92,10 @@ backends registered by setup-api without blocking legacy plugins. OpenClaw does not cache plugin discovery results or direct manifest registry data behind wall-clock windows. Installs, manifest edits, and load-path changes must become visible on the next explicit metadata read or snapshot rebuild. +The manifest file parser may keep a bounded file-signature cache keyed by the +opened manifest path, inode, size, and timestamps; that cache only avoids +re-parsing unchanged bytes and must not cache discovery, registry, owner, or +policy answers. The safe metadata fast path is explicit object ownership, not a hidden cache. Gateway startup hot paths should pass the current `PluginMetadataSnapshot`, the diff --git a/extensions/openai/test-support/provider-catalog.contract-test-support.ts b/extensions/openai/test-support/provider-catalog.contract-test-support.ts index 70d201ae87e..2e40510b4d5 100644 --- a/extensions/openai/test-support/provider-catalog.contract-test-support.ts +++ b/extensions/openai/test-support/provider-catalog.contract-test-support.ts @@ -74,11 +74,9 @@ export function describeOpenAIProviderCatalogContract() { }) ).providers; const openaiProvider = requireRegisteredProvider(openaiProviders, "openai", "provider"); - const { augmentModelCatalogWithProviderPlugins, resetProviderRuntimeHookCacheForTest } = - await importProviderRuntimeCatalogModule(); + const { augmentModelCatalogWithProviderPlugins } = await importProviderRuntimeCatalogModule(); return { augmentModelCatalogWithProviderPlugins, - resetProviderRuntimeHookCacheForTest, openaiProviders, openaiProvider, }; @@ -89,8 +87,7 @@ export function describeOpenAIProviderCatalogContract() { { timeout: PROVIDER_CATALOG_CONTRACT_TIMEOUT_MS }, () => { beforeEach(async () => { - const { resetProviderRuntimeHookCacheForTest, openaiProviders } = await contractDepsPromise; - resetProviderRuntimeHookCacheForTest(); + const { openaiProviders } = await contractDepsPromise; resolvePluginProvidersMock.mockReset(); resolvePluginProvidersMock.mockImplementation((params?: { onlyPluginIds?: string[] }) => { diff --git a/src/agents/models-config.e2e-harness.ts b/src/agents/models-config.e2e-harness.ts index 9e6422ffbb5..7ef19844b02 100644 --- a/src/agents/models-config.e2e-harness.ts +++ b/src/agents/models-config.e2e-harness.ts @@ -6,7 +6,6 @@ import type { OpenClawConfig } from "../config/types.openclaw.js"; import { withTempHome as withTempHomeBase } from "../plugin-sdk/test-helpers/temp-home.js"; import { resolveBundledPluginsDir } from "../plugins/bundled-dir.js"; import { resetPluginLoaderTestStateForTest } from "../plugins/loader.test-fixtures.js"; -import { resetProviderRuntimeHookCacheForTest } from "../plugins/provider-runtime.js"; import { resolveOwningPluginIdsForProvider } from "../plugins/providers.js"; import type { MockFn } from "../test-utils/vitest-mock-fn.js"; import { resetModelsJsonReadyCacheForTest } from "./models-config-state.js"; @@ -24,14 +23,12 @@ export function withModelsTempHome(fn: (home: string) => Promise): Promise export function installModelsConfigTestHooks(opts?: { restoreFetch?: boolean; resetPluginLoaderState?: boolean; - resetProviderRuntimeHookCache?: boolean; }) { let previousHome: string | undefined; let previousOpenClawAgentDir: string | undefined; let previousPiCodingAgentDir: string | undefined; const originalFetch = globalThis.fetch; const shouldResetPluginLoaderState = opts?.resetPluginLoaderState !== false; - const shouldResetProviderRuntimeHookCache = opts?.resetProviderRuntimeHookCache !== false; beforeEach(() => { previousHome = process.env.HOME; @@ -45,9 +42,6 @@ export function installModelsConfigTestHooks(opts?: { resetPluginLoaderTestStateForTest(); } resetModelsJsonReadyCacheForTest(); - if (shouldResetProviderRuntimeHookCache) { - resetProviderRuntimeHookCacheForTest(); - } }); afterEach(() => { @@ -68,9 +62,6 @@ export function installModelsConfigTestHooks(opts?: { resetPluginLoaderTestStateForTest(); } resetModelsJsonReadyCacheForTest(); - if (shouldResetProviderRuntimeHookCache) { - resetProviderRuntimeHookCacheForTest(); - } if (opts?.restoreFetch && originalFetch) { globalThis.fetch = originalFetch; } diff --git a/src/agents/models-config.runtime-source-snapshot.test.ts b/src/agents/models-config.runtime-source-snapshot.test.ts index fa424700099..51da30ffc5c 100644 --- a/src/agents/models-config.runtime-source-snapshot.test.ts +++ b/src/agents/models-config.runtime-source-snapshot.test.ts @@ -11,7 +11,6 @@ import { import { enforceSourceManagedProviderSecrets } from "./models-config.providers.source-managed.js"; vi.mock("../plugins/manifest-registry.js", () => ({ - clearPluginManifestRegistryCache: () => undefined, loadPluginManifestRegistry: () => ({ plugins: [] }), })); @@ -25,7 +24,6 @@ vi.mock("../plugins/provider-runtime.js", () => ({ applyProviderConfigDefaultsWithPlugin: (config: OpenClawConfig) => config, applyProviderNativeStreamingUsageCompatWithPlugin: () => undefined, normalizeProviderConfigWithPlugin: () => undefined, - resetProviderRuntimeHookCacheForTest: () => undefined, resolveProviderConfigApiKeyWithPlugin: () => undefined, resolveProviderSyntheticAuthWithPlugin: () => undefined, })); diff --git a/src/agents/pi-embedded-runner-extraparams.test.ts b/src/agents/pi-embedded-runner-extraparams.test.ts index 5d7067d9fd7..2370a46ed65 100644 --- a/src/agents/pi-embedded-runner-extraparams.test.ts +++ b/src/agents/pi-embedded-runner-extraparams.test.ts @@ -9,7 +9,6 @@ vi.mock("../plugins/provider-hook-runtime.js", () => ({ }, prepareProviderExtraParams: () => undefined, resolveProviderExtraParamsForTransport: () => undefined, - resetProviderRuntimeHookCacheForTest: () => {}, wrapProviderStreamFn: (params: { context: { streamFn?: StreamFn } }) => params.context.streamFn, })); diff --git a/src/agents/pi-embedded-runner.sanitize-session-history.test-harness.ts b/src/agents/pi-embedded-runner.sanitize-session-history.test-harness.ts index 268f54439ec..e62caa7946d 100644 --- a/src/agents/pi-embedded-runner.sanitize-session-history.test-harness.ts +++ b/src/agents/pi-embedded-runner.sanitize-session-history.test-harness.ts @@ -92,8 +92,6 @@ export function createSanitizeSessionHistoryProviderHookRuntimeMock( resolveProviderPluginsForHooks: vi.fn(() => []), prepareProviderExtraParams: vi.fn(() => undefined), wrapProviderStreamFn: vi.fn(() => undefined), - clearProviderRuntimeHookCache: vi.fn(), - resetProviderRuntimeHookCacheForTest: vi.fn(), __testing: {}, ...extra, }; diff --git a/src/agents/pi-embedded-runner.sanitize-session-history.test.ts b/src/agents/pi-embedded-runner.sanitize-session-history.test.ts index 982f3fddbd9..91ad06c239d 100644 --- a/src/agents/pi-embedded-runner.sanitize-session-history.test.ts +++ b/src/agents/pi-embedded-runner.sanitize-session-history.test.ts @@ -30,9 +30,7 @@ vi.mock("./pi-embedded-helpers.js", async () => ({ vi.mock("../plugins/provider-hook-runtime.js", async () => ({ __testing: {}, - clearProviderRuntimeHookCache: vi.fn(), prepareProviderExtraParams: vi.fn(() => undefined), - resetProviderRuntimeHookCacheForTest: vi.fn(), resolveProviderHookPlugin: vi.fn(() => undefined), resolveProviderPluginsForHooks: vi.fn(() => []), resolveProviderRuntimePlugin: vi.fn(({ provider }: { provider?: string }) => diff --git a/src/agents/pi-embedded-runner/model.forward-compat.errors-and-overrides.test.ts b/src/agents/pi-embedded-runner/model.forward-compat.errors-and-overrides.test.ts index ff708c3a0b1..08e61896b85 100644 --- a/src/agents/pi-embedded-runner/model.forward-compat.errors-and-overrides.test.ts +++ b/src/agents/pi-embedded-runner/model.forward-compat.errors-and-overrides.test.ts @@ -12,7 +12,6 @@ vi.mock("../../plugins/provider-runtime.js", async () => { applyProviderResolvedModelCompatWithPlugins: () => undefined, applyProviderResolvedTransportWithPlugin: () => undefined, buildProviderUnknownModelHintWithPlugin: () => undefined, - clearProviderRuntimeHookCache: () => {}, normalizeProviderTransportWithPlugin: () => undefined, normalizeProviderResolvedModelWithPlugin: () => undefined, prepareProviderDynamicModel: async () => {}, diff --git a/src/agents/pi-embedded-runner/model.forward-compat.test.ts b/src/agents/pi-embedded-runner/model.forward-compat.test.ts index 3b35e8b32e7..e5663876b68 100644 --- a/src/agents/pi-embedded-runner/model.forward-compat.test.ts +++ b/src/agents/pi-embedded-runner/model.forward-compat.test.ts @@ -10,7 +10,6 @@ vi.mock("../../plugins/provider-runtime.js", () => ({ applyProviderResolvedModelCompatWithPlugins: () => undefined, applyProviderResolvedTransportWithPlugin: () => undefined, buildProviderUnknownModelHintWithPlugin: () => undefined, - clearProviderRuntimeHookCache: () => undefined, normalizeProviderResolvedModelWithPlugin: () => undefined, normalizeProviderTransportWithPlugin: () => undefined, prepareProviderDynamicModel: async () => undefined, diff --git a/src/agents/pi-embedded-runner/model.provider-runtime.test-support.ts b/src/agents/pi-embedded-runner/model.provider-runtime.test-support.ts index 9172d655101..2add52d2ad5 100644 --- a/src/agents/pi-embedded-runner/model.provider-runtime.test-support.ts +++ b/src/agents/pi-embedded-runner/model.provider-runtime.test-support.ts @@ -32,7 +32,6 @@ type NormalizedTransportLike = { }; type ProviderRuntimeTestMockOptions = { - clearHookCache?: () => void; getOpenRouterModelCapabilities?: (modelId: string) => OpenRouterModelCapabilities | undefined; handledDynamicProviders?: readonly string[]; loadOpenRouterModelCapabilities?: (modelId: string) => Promise; @@ -526,7 +525,6 @@ export function createProviderRuntimeTestMock(options: ProviderRuntimeTestMockOp options.loadOpenRouterModelCapabilities ?? (async () => {}); return { - clearProviderRuntimeHookCache: options.clearHookCache ?? (() => {}), buildProviderUnknownModelHintWithPlugin: (params: { provider: string }) => { switch (params.provider) { case "ollama": diff --git a/src/agents/pi-embedded-runner/model.startup-retry.test.ts b/src/agents/pi-embedded-runner/model.startup-retry.test.ts index be046b9c33b..1bc4483621c 100644 --- a/src/agents/pi-embedded-runner/model.startup-retry.test.ts +++ b/src/agents/pi-embedded-runner/model.startup-retry.test.ts @@ -7,13 +7,10 @@ const discoverModelsMock = vi.fn< (authStorage: unknown, agentDir: string) => { find: ReturnType } >(() => ({ find: vi.fn(() => null) })); -let hookCacheCleared = false; -const clearProviderRuntimeHookCacheMock = vi.fn<() => void>(() => { - hookCacheCleared = true; -}); const prepareProviderDynamicModelMock = vi.fn<(params: unknown) => Promise>(async () => {}); +let dynamicAttempts = 0; const runProviderDynamicModelMock = vi.fn<(params: unknown) => unknown>(() => - hookCacheCleared + dynamicAttempts > 1 ? { id: "gpt-5.4", name: "gpt-5.4", @@ -38,7 +35,6 @@ vi.mock("../../plugins/provider-runtime.js", () => ({ applyProviderResolvedModelCompatWithPlugins: () => undefined, applyProviderResolvedTransportWithPlugin: () => undefined, buildProviderUnknownModelHintWithPlugin: () => undefined, - clearProviderRuntimeHookCache: () => {}, normalizeProviderResolvedModelWithPlugin: () => undefined, normalizeProviderTransportWithPlugin: () => undefined, prepareProviderDynamicModel: async () => {}, @@ -50,7 +46,6 @@ describe("resolveModelAsync startup retry", () => { const runtimeHooks = { applyProviderResolvedModelCompatWithPlugins: () => undefined, buildProviderUnknownModelHintWithPlugin: () => undefined, - clearProviderRuntimeHookCache: clearProviderRuntimeHookCacheMock, normalizeProviderResolvedModelWithPlugin: () => undefined, normalizeProviderTransportWithPlugin: () => undefined, prepareProviderDynamicModel: (params: unknown) => prepareProviderDynamicModelMock(params), @@ -59,15 +54,17 @@ describe("resolveModelAsync startup retry", () => { }; beforeEach(() => { - hookCacheCleared = false; - clearProviderRuntimeHookCacheMock.mockClear(); + dynamicAttempts = 0; prepareProviderDynamicModelMock.mockClear(); + prepareProviderDynamicModelMock.mockImplementation(async () => { + dynamicAttempts += 1; + }); runProviderDynamicModelMock.mockClear(); discoverAuthStorageMock.mockClear(); discoverModelsMock.mockClear(); }); - it("retries once after clearing the provider-runtime hook cache", async () => { + it("retries once after a transient provider-runtime miss", async () => { const { resolveModelAsync } = await import("./model.js"); const result = await resolveModelAsync( @@ -87,12 +84,11 @@ describe("resolveModelAsync startup retry", () => { id: "gpt-5.4", api: "openai-codex-responses", }); - expect(clearProviderRuntimeHookCacheMock).toHaveBeenCalledTimes(1); expect(prepareProviderDynamicModelMock).toHaveBeenCalledTimes(2); expect(runProviderDynamicModelMock).toHaveBeenCalledTimes(2); }); - it("does not clear the hook cache during steady-state misses", async () => { + it("does not retry during steady-state misses", async () => { const { resolveModelAsync } = await import("./model.js"); const result = await resolveModelAsync( @@ -105,7 +101,6 @@ describe("resolveModelAsync startup retry", () => { expect(result.model).toBeUndefined(); expect(result.error).toBe("Unknown model: openai-codex/gpt-5.4"); - expect(clearProviderRuntimeHookCacheMock).not.toHaveBeenCalled(); expect(prepareProviderDynamicModelMock).toHaveBeenCalledTimes(1); expect(runProviderDynamicModelMock).toHaveBeenCalledTimes(1); }); diff --git a/src/agents/pi-embedded-runner/model.test.ts b/src/agents/pi-embedded-runner/model.test.ts index b6b7cb5fde8..8f61c605130 100644 --- a/src/agents/pi-embedded-runner/model.test.ts +++ b/src/agents/pi-embedded-runner/model.test.ts @@ -2191,7 +2191,6 @@ describe("resolveModel", () => { runtimeHooks: { applyProviderResolvedModelCompatWithPlugins: () => undefined, buildProviderUnknownModelHintWithPlugin: () => undefined, - clearProviderRuntimeHookCache: () => {}, prepareProviderDynamicModel: async () => {}, runProviderDynamicModel: () => undefined, applyProviderResolvedTransportWithPlugin: ({ provider, context }) => diff --git a/src/agents/pi-embedded-runner/model.ts b/src/agents/pi-embedded-runner/model.ts index d5a5580b2a7..1dddf97fca5 100644 --- a/src/agents/pi-embedded-runner/model.ts +++ b/src/agents/pi-embedded-runner/model.ts @@ -11,7 +11,6 @@ import { applyProviderResolvedModelCompatWithPlugins, applyProviderResolvedTransportWithPlugin, buildProviderUnknownModelHintWithPlugin, - clearProviderRuntimeHookCache, normalizeProviderTransportWithPlugin, prepareProviderDynamicModel, runProviderDynamicModel, @@ -53,7 +52,6 @@ type ProviderRuntimeHooks = { buildProviderUnknownModelHintWithPlugin: ( params: Parameters[0], ) => string | undefined; - clearProviderRuntimeHookCache: () => void; prepareProviderDynamicModel: ( params: Parameters[0], ) => Promise; @@ -73,7 +71,6 @@ const DEFAULT_PROVIDER_RUNTIME_HOOKS: ProviderRuntimeHooks = { applyProviderResolvedModelCompatWithPlugins, applyProviderResolvedTransportWithPlugin, buildProviderUnknownModelHintWithPlugin, - clearProviderRuntimeHookCache, prepareProviderDynamicModel, runProviderDynamicModel, shouldPreferProviderRuntimeResolvedModel, @@ -85,7 +82,6 @@ const STATIC_PROVIDER_RUNTIME_HOOKS: ProviderRuntimeHooks = { applyProviderResolvedModelCompatWithPlugins: () => undefined, applyProviderResolvedTransportWithPlugin: () => undefined, buildProviderUnknownModelHintWithPlugin: () => undefined, - clearProviderRuntimeHookCache: () => {}, prepareProviderDynamicModel: async () => {}, runProviderDynamicModel: () => undefined, normalizeProviderResolvedModelWithPlugin: () => undefined, @@ -1020,10 +1016,7 @@ export async function resolveModelAsync( }; } const providerConfig = resolveConfiguredProviderConfig(cfg, normalizedRef.provider); - const resolveDynamicAttempt = async (attemptOptions?: { clearHookCache?: boolean }) => { - if (attemptOptions?.clearHookCache) { - runtimeHooks.clearProviderRuntimeHookCache(); - } + const resolveDynamicAttempt = async () => { await runtimeHooks.prepareProviderDynamicModel({ provider: normalizedRef.provider, config: cfg, @@ -1058,9 +1051,9 @@ export async function resolveModelAsync( : await resolveDynamicAttempt(); if (!model && !explicitModel && options?.retryTransientProviderRuntimeMiss) { // Startup can race the first provider-runtime snapshot load on a fresh - // gateway boot. Retry once with a cleared hook cache before surfacing a - // user-visible "Unknown model" that disappears on the next message. - model = await resolveDynamicAttempt({ clearHookCache: true }); + // gateway boot. Retry once before surfacing a user-visible "Unknown model" + // that disappears on the next message. + model = await resolveDynamicAttempt(); } if (model) { return { model, authStorage, modelRegistry }; diff --git a/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts b/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts index a8924adeae7..7acaa176888 100644 --- a/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts +++ b/src/agents/pi-embedded-runner/skills-runtime.integration.test.ts @@ -3,7 +3,6 @@ import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import type { OpenClawConfig } from "../../config/config.js"; -import { clearPluginManifestRegistryCache } from "../../plugins/manifest-registry.js"; import { writePluginWithSkill } from "../test-helpers/skill-plugin-fixtures.js"; import { resolveEmbeddedRunSkillEntries } from "./skills-runtime.js"; @@ -42,14 +41,12 @@ async function setupBundledDiffsPlugin() { async function resolveBundledDiffsSkillEntries(config?: OpenClawConfig) { const { bundledPluginsDir, workspaceDir } = await setupBundledDiffsPlugin(); process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = bundledPluginsDir; - clearPluginManifestRegistryCache(); return resolveEmbeddedRunSkillEntries({ workspaceDir, ...(config ? { config } : {}) }); } afterEach(async () => { restoreBundledPluginsDir(); - clearPluginManifestRegistryCache(); await Promise.all(tempDirs.splice(0).map((dir) => fs.rm(dir, { recursive: true, force: true }))); }); diff --git a/src/agents/runtime-plan/build.test.ts b/src/agents/runtime-plan/build.test.ts index 5e8b424d428..3789ad5764c 100644 --- a/src/agents/runtime-plan/build.test.ts +++ b/src/agents/runtime-plan/build.test.ts @@ -4,9 +4,7 @@ import { buildAgentRuntimePlan } from "./build.js"; vi.mock("../../plugins/provider-hook-runtime.js", () => ({ __testing: {}, - clearProviderRuntimeHookCache: vi.fn(), prepareProviderExtraParams: vi.fn(() => undefined), - resetProviderRuntimeHookCacheForTest: vi.fn(), resolveProviderAuthProfileId: vi.fn(() => undefined), resolveProviderExtraParamsForTransport: vi.fn(() => undefined), resolveProviderFollowupFallbackRoute: vi.fn(() => undefined), diff --git a/src/agents/skills.test.ts b/src/agents/skills.test.ts index 70a51896d37..6bd216e25f3 100644 --- a/src/agents/skills.test.ts +++ b/src/agents/skills.test.ts @@ -6,8 +6,6 @@ import { setRuntimeConfigSnapshot, } from "../config/runtime-snapshot.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; -import { clearPluginDiscoveryCache } from "../plugins/discovery.js"; -import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; import { captureEnv, withPathResolutionEnv } from "../test-utils/env.js"; import { createFixtureSuite } from "../test-utils/fixture-suite.js"; import { createTempHomeEnv, type TempHomeEnv } from "../test-utils/temp-home.js"; @@ -173,8 +171,6 @@ afterAll(async () => { afterEach(() => { clearRuntimeConfigSnapshot(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); }); describe("buildWorkspaceSkillCommandSpecs", () => { diff --git a/src/agents/test-helpers/pi-embedded-runner-e2e-mocks.ts b/src/agents/test-helpers/pi-embedded-runner-e2e-mocks.ts index 93aaaee5b90..91279357240 100644 --- a/src/agents/test-helpers/pi-embedded-runner-e2e-mocks.ts +++ b/src/agents/test-helpers/pi-embedded-runner-e2e-mocks.ts @@ -132,7 +132,6 @@ export function installEmbeddedRunnerFastRunE2eMocks( applyProviderResolvedTransportWithPlugin: vi.fn(() => undefined), buildProviderMissingAuthMessageWithPlugin: vi.fn(() => undefined), buildProviderUnknownModelHintWithPlugin: vi.fn(() => undefined), - clearProviderRuntimeHookCache: vi.fn(), normalizeProviderResolvedModelWithPlugin: vi.fn(() => undefined), normalizeProviderTransportWithPlugin: vi.fn(() => undefined), prepareProviderDynamicModel: vi.fn(async () => undefined), diff --git a/src/auto-reply/reply/commands-plugins.test.ts b/src/auto-reply/reply/commands-plugins.test.ts index 41267e60868..4d0e3e5f59b 100644 --- a/src/auto-reply/reply/commands-plugins.test.ts +++ b/src/auto-reply/reply/commands-plugins.test.ts @@ -61,10 +61,6 @@ vi.mock("../../plugins/installed-plugin-index-records.js", () => ({ ), })); -vi.mock("../../plugins/manifest-registry.js", () => ({ - clearPluginManifestRegistryCache: vi.fn(), -})); - vi.mock("../../plugins/status.js", () => ({ buildAllPluginInspectReports: buildAllPluginInspectReportsMock, buildPluginDiagnosticsReport: buildPluginDiagnosticsReportMock, diff --git a/src/auto-reply/reply/commands-plugins.ts b/src/auto-reply/reply/commands-plugins.ts index c8d3e6633fb..1f046ec2f07 100644 --- a/src/auto-reply/reply/commands-plugins.ts +++ b/src/auto-reply/reply/commands-plugins.ts @@ -21,7 +21,6 @@ import { parseClawHubPluginSpec } from "../../infra/clawhub.js"; import { installPluginFromClawHub } from "../../plugins/clawhub.js"; import { installPluginFromNpmSpec, installPluginFromPath } from "../../plugins/install.js"; import { loadInstalledPluginIndexInstallRecords } from "../../plugins/installed-plugin-index-records.js"; -import { clearPluginManifestRegistryCache } from "../../plugins/manifest-registry.js"; import type { PluginRecord } from "../../plugins/registry.js"; import { buildAllPluginInspectReports, @@ -180,7 +179,6 @@ async function installPluginFromPluginsCommand(params: { if (!result.ok) { return { ok: false, error: result.error }; } - clearPluginManifestRegistryCache(); const source: "archive" | "path" = resolveArchiveKind(resolved) ? "archive" : "path"; await persistPluginInstall({ snapshot: params.snapshot, @@ -208,7 +206,6 @@ async function installPluginFromPluginsCommand(params: { if (!result.ok) { return { ok: false, error: result.error }; } - clearPluginManifestRegistryCache(); await persistPluginInstall({ snapshot: params.snapshot, pluginId: result.pluginId, @@ -235,7 +232,6 @@ async function installPluginFromPluginsCommand(params: { logger: createPluginInstallLogger(), }); if (clawhubResult.ok) { - clearPluginManifestRegistryCache(); await persistPluginInstall({ snapshot: params.snapshot, pluginId: clawhubResult.pluginId, @@ -266,7 +262,6 @@ async function installPluginFromPluginsCommand(params: { if (!result.ok) { return { ok: false, error: result.error }; } - clearPluginManifestRegistryCache(); const installRecord = buildNpmInstallRecordFields({ spec: params.raw, installPath: result.targetDir, diff --git a/src/channels/plugins/bootstrap-registry.ts b/src/channels/plugins/bootstrap-registry.ts index e55f849186c..1e09adaf98b 100644 --- a/src/channels/plugins/bootstrap-registry.ts +++ b/src/channels/plugins/bootstrap-registry.ts @@ -110,5 +110,3 @@ export function getBootstrapChannelSecrets(id: ChannelId): ChannelPlugin["secret return undefined; } } - -export function clearBootstrapChannelPluginCache(): void {} diff --git a/src/channels/plugins/bundled.shape-guard.test.ts b/src/channels/plugins/bundled.shape-guard.test.ts index e0353e6983f..c23b266146c 100644 --- a/src/channels/plugins/bundled.shape-guard.test.ts +++ b/src/channels/plugins/bundled.shape-guard.test.ts @@ -104,7 +104,7 @@ afterEach(() => { }); describe("bundled channel entry shape guards", () => { - const bundledPluginRoots = loadPluginManifestRegistry({ cache: true, config: {} }) + const bundledPluginRoots = loadPluginManifestRegistry({ config: {} }) .plugins.filter((plugin) => plugin.origin === "bundled") .map((plugin) => plugin.rootDir); diff --git a/src/channels/plugins/contracts/channel-import-guardrails.test.ts b/src/channels/plugins/contracts/channel-import-guardrails.test.ts index 7c48c22028f..337e9cec2fa 100644 --- a/src/channels/plugins/contracts/channel-import-guardrails.test.ts +++ b/src/channels/plugins/contracts/channel-import-guardrails.test.ts @@ -12,7 +12,6 @@ const ALLOWED_EXTENSION_PUBLIC_SURFACES = new Set(GUARDED_EXTENSION_PUBLIC_SURFA ALLOWED_EXTENSION_PUBLIC_SURFACES.add("test-api.js"); const BUNDLED_PLUGIN_ROOT_DIR = "extensions"; const bundledPluginRecords = loadPluginManifestRegistry({ - cache: true, config: {}, }).plugins.filter((plugin) => plugin.origin === "bundled"); const bundledPluginRoots = new Map( diff --git a/src/channels/plugins/contracts/plugins-core.loader.contract.test.ts b/src/channels/plugins/contracts/plugins-core.loader.contract.test.ts index 3203357c6f7..93f8fff7959 100644 --- a/src/channels/plugins/contracts/plugins-core.loader.contract.test.ts +++ b/src/channels/plugins/contracts/plugins-core.loader.contract.test.ts @@ -1,6 +1,4 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest"; -import { clearPluginDiscoveryCache } from "../../../plugins/discovery.js"; -import { clearPluginManifestRegistryCache } from "../../../plugins/manifest-registry.js"; import { setActivePluginRegistry } from "../../../plugins/runtime.js"; import { createChannelTestPluginBase, @@ -102,8 +100,6 @@ describe("channel plugin loader", () => { afterEach(() => { setActivePluginRegistry(emptyRegistry); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); }); it.each([ diff --git a/src/channels/plugins/contracts/plugins-core.registry.contract.test.ts b/src/channels/plugins/contracts/plugins-core.registry.contract.test.ts index 33da0105f27..b4631b497a3 100644 --- a/src/channels/plugins/contracts/plugins-core.registry.contract.test.ts +++ b/src/channels/plugins/contracts/plugins-core.registry.contract.test.ts @@ -1,6 +1,4 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest"; -import { clearPluginDiscoveryCache } from "../../../plugins/discovery.js"; -import { clearPluginManifestRegistryCache } from "../../../plugins/manifest-registry.js"; import { setActivePluginRegistry } from "../../../plugins/runtime.js"; import { createTestRegistry } from "../../../test-utils/channel-plugins.js"; import { listChannelPlugins } from "../index.js"; @@ -40,8 +38,6 @@ describe("channel plugin registry", () => { afterEach(() => { setActivePluginRegistry(emptyRegistry); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); }); it.each([ diff --git a/src/channels/plugins/read-only.ts b/src/channels/plugins/read-only.ts index f841a7b6163..fe831462136 100644 --- a/src/channels/plugins/read-only.ts +++ b/src/channels/plugins/read-only.ts @@ -83,7 +83,6 @@ type ReadOnlyChannelPluginOptions = { activationSourceConfig?: OpenClawConfig; includePersistedAuthState?: boolean; includeSetupRuntimeFallback?: boolean; - cache?: boolean; }; type ReadOnlyChannelPluginResolution = { @@ -578,7 +577,6 @@ function resolveExternalReadOnlyChannelPluginIds(params: { records: readonly PluginManifestRecord[]; workspaceDir?: string; env: NodeJS.ProcessEnv; - cache?: boolean; }): string[] { if (params.channelIds.length === 0) { return []; @@ -589,7 +587,6 @@ function resolveExternalReadOnlyChannelPluginIds(params: { channelIds: params.channelIds, workspaceDir: params.workspaceDir, env: params.env, - cache: params.cache, manifestRecords: params.records, }); if (candidatePluginIds.length === 0) { @@ -626,7 +623,6 @@ export function resolveReadOnlyChannelPluginsForConfig( stateDir: options.stateDir, workspaceDir, env, - cache: options.cache, includeDisabled: true, }).plugins; const bundledManifestRecords = listBundledChannelManifestRecords(manifestRecords); @@ -638,7 +634,6 @@ export function resolveReadOnlyChannelPluginsForConfig( activationSourceConfig: options.activationSourceConfig ?? cfg, workspaceDir, env, - cache: options.cache, includePersistedAuthState: options.includePersistedAuthState, manifestRecords, }), @@ -677,7 +672,6 @@ export function resolveReadOnlyChannelPluginsForConfig( records: externalManifestRecords, workspaceDir, env, - cache: options.cache, }); if (externalPluginIds.length > 0) { const externalPluginIdSet = new Set(externalPluginIds); diff --git a/src/channels/plugins/setup-helpers.import-safety.test.ts b/src/channels/plugins/setup-helpers.import-safety.test.ts index a5e24fe6361..1b7ac732066 100644 --- a/src/channels/plugins/setup-helpers.import-safety.test.ts +++ b/src/channels/plugins/setup-helpers.import-safety.test.ts @@ -1,10 +1,8 @@ import { importFreshModule } from "openclaw/plugin-sdk/test-fixtures"; import { afterEach, describe, expect, it, vi } from "vitest"; -import { clearSetupPromotionRuntimeModuleCache } from "./setup-helpers.js"; afterEach(() => { vi.doUnmock("../../plugins/discovery.js"); - clearSetupPromotionRuntimeModuleCache(); }); describe("setup helper import safety", () => { diff --git a/src/channels/plugins/setup-helpers.test.ts b/src/channels/plugins/setup-helpers.test.ts index edcd3c0841d..8c8df3086d4 100644 --- a/src/channels/plugins/setup-helpers.test.ts +++ b/src/channels/plugins/setup-helpers.test.ts @@ -8,7 +8,6 @@ import { } from "../../test-utils/channel-plugins.js"; import { applySetupAccountConfigPatch, - clearSetupPromotionRuntimeModuleCache, createEnvPatchedAccountSetupAdapter, createPatchedAccountSetupAdapter, moveSingleAccountChannelSectionToDefaultAccount, @@ -84,7 +83,6 @@ beforeEach(() => { }); afterAll(() => { - clearSetupPromotionRuntimeModuleCache(); resetPluginRuntimeStateForTest(); }); diff --git a/src/channels/plugins/setup-helpers.ts b/src/channels/plugins/setup-helpers.ts index 8605dbf7b71..6378cd1b82b 100644 --- a/src/channels/plugins/setup-helpers.ts +++ b/src/channels/plugins/setup-helpers.ts @@ -153,8 +153,6 @@ export function prepareScopedSetupConfig(params: { }); } -export function clearSetupPromotionRuntimeModuleCache(): void {} - export function applySetupAccountConfigPatch(params: { cfg: OpenClawConfig; channelKey: string; diff --git a/src/cli/plugins-cli-test-helpers.ts b/src/cli/plugins-cli-test-helpers.ts index 663ae0fc234..d5ade74d7c3 100644 --- a/src/cli/plugins-cli-test-helpers.ts +++ b/src/cli/plugins-cli-test-helpers.ts @@ -52,7 +52,6 @@ export const writePersistedInstalledPluginIndexInstallRecords: AsyncUnknownMock ); }, ); -export const clearPluginManifestRegistryCache: UnknownMock = vi.fn(); export const loadPluginManifestRegistry: UnknownMock = vi.fn(); export const buildPluginSnapshotReport: UnknownMock = vi.fn(); export const buildPluginRegistrySnapshotReport: UnknownMock = vi.fn(); @@ -211,7 +210,6 @@ vi.mock("../plugins/installed-plugin-index-records.js", async (importOriginal) = }); vi.mock("../plugins/manifest-registry.js", () => ({ - clearPluginManifestRegistryCache: () => clearPluginManifestRegistryCache(), loadPluginManifestRegistry: ((...args: unknown[]) => invokeMock(loadPluginManifestRegistry, ...args)) as ( ...args: unknown[] @@ -525,7 +523,6 @@ export function resetPluginsCliTestState() { mockInstalledPluginIndexInstallRecords = {}; loadInstalledPluginIndexInstallRecords.mockReset(); writePersistedInstalledPluginIndexInstallRecords.mockReset(); - clearPluginManifestRegistryCache.mockReset(); loadPluginManifestRegistry.mockReset(); buildPluginSnapshotReport.mockReset(); buildPluginRegistrySnapshotReport.mockReset(); diff --git a/src/cli/plugins-cli.install.test.ts b/src/cli/plugins-cli.install.test.ts index 0d6754fd0cd..0d8bdec54eb 100644 --- a/src/cli/plugins-cli.install.test.ts +++ b/src/cli/plugins-cli.install.test.ts @@ -7,7 +7,6 @@ import type { OpenClawConfig } from "../config/config.js"; import { applyExclusiveSlotSelection, buildPluginSnapshotReport, - clearPluginManifestRegistryCache, enablePluginInConfig, installHooksFromNpmSpec, installHooksFromPath, @@ -374,7 +373,6 @@ describe("plugins cli install", () => { await runPluginsCommand(["plugins", "install", "alpha", "--marketplace", "local/repo"]); - expect(clearPluginManifestRegistryCache).toHaveBeenCalledTimes(1); expect(writePersistedInstalledPluginIndexInstallRecords).toHaveBeenCalledWith({ alpha: expect.objectContaining({ source: "marketplace", diff --git a/src/cli/plugins-install-command.ts b/src/cli/plugins-install-command.ts index 765679cc4ed..50301cbdbcf 100644 --- a/src/cli/plugins-install-command.ts +++ b/src/cli/plugins-install-command.ts @@ -15,7 +15,6 @@ import { installPluginFromNpmSpec, installPluginFromPath, } from "../plugins/install.js"; -import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; import { installPluginFromMarketplace, resolveMarketplaceInstallShortcut, @@ -307,7 +306,6 @@ async function tryInstallPluginOrHookPackFromNpmSpec(params: { return { ok: false }; } - clearPluginManifestRegistryCache(); const installRecord = resolvePinnedNpmInstallRecordForCli( params.spec, Boolean(params.pin), @@ -485,7 +483,6 @@ export async function runPluginInstallCommand(params: { return defaultRuntime.exit(1); } - clearPluginManifestRegistryCache(); await persistPluginInstall({ snapshot, pluginId: result.pluginId, @@ -588,7 +585,6 @@ export async function runPluginInstallCommand(params: { return defaultRuntime.exit(1); } - clearPluginManifestRegistryCache(); const source: "archive" | "path" = resolveArchiveKind(resolved) ? "archive" : "path"; await persistPluginInstall({ snapshot, @@ -682,7 +678,6 @@ export async function runPluginInstallCommand(params: { return defaultRuntime.exit(1); } - clearPluginManifestRegistryCache(); await persistPluginInstall({ snapshot, pluginId: result.pluginId, @@ -712,7 +707,6 @@ export async function runPluginInstallCommand(params: { logger: createPluginInstallLogger(), }); if (clawhubResult.ok) { - clearPluginManifestRegistryCache(); await persistPluginInstall({ snapshot, pluginId: clawhubResult.pluginId, diff --git a/src/commands/channel-setup/plugin-install.test.ts b/src/commands/channel-setup/plugin-install.test.ts index accaa79ae59..ab7bab3504f 100644 --- a/src/commands/channel-setup/plugin-install.test.ts +++ b/src/commands/channel-setup/plugin-install.test.ts @@ -905,14 +905,10 @@ describe("ensureChannelSetupPluginInstalled", () => { onlyPluginIds: ["custom-external-chat-plugin"], }), ); - expect(loadPluginManifestRegistry).toHaveBeenCalledWith( - expect.objectContaining({ - cache: false, - }), - ); + expect(loadPluginManifestRegistry).toHaveBeenCalledWith(expect.objectContaining({})); }); - it("uses uncached manifest discovery for activation-declared setup scoping", () => { + it("uses live manifest discovery for activation-declared setup scoping", () => { const runtime = makeRuntime(); const cfg: OpenClawConfig = {}; mockActivationOnlyPlugin({ id: "custom-external-chat-plugin" }); @@ -927,7 +923,7 @@ describe("ensureChannelSetupPluginInstalled", () => { expect(loadPluginManifestRegistry).toHaveBeenCalled(); expect( loadPluginManifestRegistry.mock.calls.every( - ([params]) => (params as { cache?: boolean }).cache === false, + ([params]) => !Object.prototype.hasOwnProperty.call(params ?? {}, "cache"), ), ).toBe(true); }); diff --git a/src/commands/channel-setup/plugin-install.ts b/src/commands/channel-setup/plugin-install.ts index 01966c1bdf8..070ce4eb043 100644 --- a/src/commands/channel-setup/plugin-install.ts +++ b/src/commands/channel-setup/plugin-install.ts @@ -129,7 +129,6 @@ function resolveUniqueManifestScopedChannelPluginId(params: { channelIds: [params.channel], workspaceDir: params.workspaceDir, env: process.env, - cache: false, }); return matches.length === 1 ? matches[0] : undefined; } diff --git a/src/commands/doctor-plugin-manifests.ts b/src/commands/doctor-plugin-manifests.ts index 0f2127fc50b..10f70b842f7 100644 --- a/src/commands/doctor-plugin-manifests.ts +++ b/src/commands/doctor-plugin-manifests.ts @@ -124,7 +124,6 @@ export function collectLegacyPluginManifestContractMigrations(params?: { } for (const plugin of loadPluginManifestRegistry({ - cache: false, ...(params?.config ? { config: params.config } : {}), ...(params?.env ? { env: params.env } : {}), ...(params?.workspaceDir ? { workspaceDir: params.workspaceDir } : {}), diff --git a/src/commands/doctor-state-integrity.ts b/src/commands/doctor-state-integrity.ts index 291e7881e46..3b3129594a4 100644 --- a/src/commands/doctor-state-integrity.ts +++ b/src/commands/doctor-state-integrity.ts @@ -560,14 +560,12 @@ function shouldRequireOAuthDir(cfg: OpenClawConfig, env: NodeJS.ProcessEnv): boo listConfiguredChannelIdsForReadOnlyScope({ config: cfg, env, - cache: true, }), ); const withoutPersistedAuth = new Set( listConfiguredChannelIdsForReadOnlyScope({ config: cfg, env, - cache: true, includePersistedAuthState: false, }), ); diff --git a/src/commands/doctor/shared/plugin-registry-migration.ts b/src/commands/doctor/shared/plugin-registry-migration.ts index fc75b650474..6da27228335 100644 --- a/src/commands/doctor/shared/plugin-registry-migration.ts +++ b/src/commands/doctor/shared/plugin-registry-migration.ts @@ -299,7 +299,6 @@ export async function migratePluginRegistryForInstall( const inspection = await inspectPersistedInstalledPluginIndex(migrationParams); const candidateIndex = loadInstalledPluginIndex({ ...migrationParams, - cache: false, }); const current: InstalledPluginIndex = { ...candidateIndex, diff --git a/src/commands/models/list.provider-catalog.test.ts b/src/commands/models/list.provider-catalog.test.ts index aa26b1604aa..9d98290077b 100644 --- a/src/commands/models/list.provider-catalog.test.ts +++ b/src/commands/models/list.provider-catalog.test.ts @@ -205,7 +205,6 @@ describe("loadProviderCatalogModelsForList", () => { expect(providerDiscoveryMocks.loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledWith({ config: baseParams.cfg, env: baseParams.env, - cache: true, }); expect(providerDiscoveryMocks.resolveOwningPluginIdsForProvider).not.toHaveBeenCalled(); }); diff --git a/src/commands/models/list.provider-catalog.ts b/src/commands/models/list.provider-catalog.ts index 27dd7d87de0..4d9aaf482f6 100644 --- a/src/commands/models/list.provider-catalog.ts +++ b/src/commands/models/list.provider-catalog.ts @@ -73,7 +73,6 @@ function resolveInstalledIndexPluginIdsForProviderFilter(params: { const snapshot = loadPluginRegistrySnapshotWithMetadata({ config: params.cfg, env: params.env, - cache: true, }); if (snapshot.source !== "persisted" && snapshot.source !== "provided") { return undefined; diff --git a/src/commands/plugin-control-plane-cold-imports.test.ts b/src/commands/plugin-control-plane-cold-imports.test.ts index 3f52603d548..06d558b6241 100644 --- a/src/commands/plugin-control-plane-cold-imports.test.ts +++ b/src/commands/plugin-control-plane-cold-imports.test.ts @@ -1,6 +1,4 @@ import { afterEach, describe, expect, it } from "vitest"; -import { clearPluginDiscoveryCache } from "../plugins/discovery.js"; -import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; import { refreshPluginRegistry } from "../plugins/plugin-registry.js"; import { createColdPluginConfig, @@ -20,8 +18,6 @@ function makeTempDir() { } afterEach(() => { - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); cleanupTrackedTempDirs(tempDirs); }); diff --git a/src/config/config.pruning-defaults.test.ts b/src/config/config.pruning-defaults.test.ts index 896b31dd3ed..e17a10c09a7 100644 --- a/src/config/config.pruning-defaults.test.ts +++ b/src/config/config.pruning-defaults.test.ts @@ -1,6 +1,5 @@ import path from "node:path"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import { clearBundledProviderPolicySurfaceCache } from "../plugins/provider-public-artifacts.js"; import type { OpenClawConfig } from "./config.js"; import { applyProviderConfigDefaultsForConfig } from "./provider-policy.js"; @@ -16,7 +15,6 @@ function applyAnthropicDefaultsForTest(config: OpenClawConfig) { describe("config pruning defaults", () => { beforeEach(() => { - clearBundledProviderPolicySurfaceCache(); vi.stubEnv( "OPENCLAW_BUNDLED_PLUGINS_DIR", path.resolve(import.meta.dirname, "../../extensions"), @@ -25,7 +23,6 @@ describe("config pruning defaults", () => { afterEach(() => { vi.unstubAllEnvs(); - clearBundledProviderPolicySurfaceCache(); }); it("does not enable contextPruning by default", () => { diff --git a/src/config/doc-baseline.ts b/src/config/doc-baseline.ts index 1c18edc4d0b..c4f2b7d75a9 100644 --- a/src/config/doc-baseline.ts +++ b/src/config/doc-baseline.ts @@ -365,7 +365,6 @@ async function loadBundledConfigSchemaResponse(): Promise }; const manifestRegistry = runtime.loadPluginManifestRegistry({ - cache: false, env, config: {}, bundledChannelConfigCollector: runtime.collectBundledChannelConfigs, @@ -381,7 +380,6 @@ async function loadBundledConfigSchemaResponse(): Promise ); return runtime.buildConfigSchema({ - cache: false, plugins: runtime.collectPluginSchemaMetadata(bundledRegistry), channels: channelPlugins, }); diff --git a/src/config/model-alias-defaults.test.ts b/src/config/model-alias-defaults.test.ts index 36a90ae069a..f7ce7f5f4eb 100644 --- a/src/config/model-alias-defaults.test.ts +++ b/src/config/model-alias-defaults.test.ts @@ -1,13 +1,11 @@ import path from "node:path"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { DEFAULT_CONTEXT_TOKENS } from "../agents/defaults.js"; -import { clearBundledProviderPolicySurfaceCache } from "../plugins/provider-public-artifacts.js"; import { applyModelDefaults } from "./defaults.js"; import type { OpenClawConfig } from "./types.js"; describe("applyModelDefaults", () => { beforeEach(() => { - clearBundledProviderPolicySurfaceCache(); vi.stubEnv( "OPENCLAW_BUNDLED_PLUGINS_DIR", path.resolve(import.meta.dirname, "../../extensions"), @@ -16,7 +14,6 @@ describe("applyModelDefaults", () => { afterEach(() => { vi.unstubAllEnvs(); - clearBundledProviderPolicySurfaceCache(); }); function buildProxyProviderConfig(overrides?: { contextWindow?: number; maxTokens?: number }) { diff --git a/src/config/plugin-auto-enable.test-helpers.ts b/src/config/plugin-auto-enable.test-helpers.ts index a758be3bdf6..d07456bfe8d 100644 --- a/src/config/plugin-auto-enable.test-helpers.ts +++ b/src/config/plugin-auto-enable.test-helpers.ts @@ -1,10 +1,6 @@ import fs from "node:fs"; import path from "node:path"; -import { clearPluginDiscoveryCache } from "../plugins/discovery.js"; -import { - clearPluginManifestRegistryCache, - type PluginManifestRegistry, -} from "../plugins/manifest-registry.js"; +import { type PluginManifestRegistry } from "../plugins/manifest-registry.js"; import { clearPluginSetupRegistryCache } from "../plugins/setup-registry.js"; import { cleanupTrackedTempDirs, @@ -15,8 +11,6 @@ import { const tempDirs: string[] = []; export function resetPluginAutoEnableTestState(): void { - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); clearPluginSetupRegistryCache(); cleanupTrackedTempDirs(tempDirs); } diff --git a/src/config/runtime-schema.test.ts b/src/config/runtime-schema.test.ts index 9cca0bdc766..b3f680b00e1 100644 --- a/src/config/runtime-schema.test.ts +++ b/src/config/runtime-schema.test.ts @@ -188,7 +188,6 @@ describe("readBestEffortRuntimeConfigSchema", () => { expect(mockLoadPluginManifestRegistry).toHaveBeenCalledWith( expect.objectContaining({ config: { plugins: { entries: { demo: { enabled: true } } } }, - cache: true, }), ); expect(mockLoadPluginManifestRegistry.mock.calls[0]?.[0]).not.toHaveProperty("cache", false); @@ -208,7 +207,6 @@ describe("readBestEffortRuntimeConfigSchema", () => { expect(mockLoadPluginManifestRegistry).toHaveBeenCalledWith( expect.objectContaining({ config: { plugins: { enabled: true } }, - cache: true, }), ); expect(mockLoadPluginManifestRegistry.mock.calls[0]?.[0]).not.toHaveProperty("cache", false); @@ -237,7 +235,6 @@ describe("loadGatewayRuntimeConfigSchema", () => { expect(mockLoadPluginManifestRegistry).toHaveBeenCalledWith( expect.objectContaining({ config: { plugins: { entries: { demo: { enabled: true } } } }, - cache: true, }), ); expect(mockLoadPluginManifestRegistry.mock.calls[0]?.[0]).not.toHaveProperty( @@ -312,7 +309,7 @@ describe("loadGatewayRuntimeConfigSchema", () => { expect(mockLoadPluginManifestRegistry).toHaveBeenCalledTimes(3); for (const call of mockLoadPluginManifestRegistry.mock.calls) { - expect(call[0]).toMatchObject({ cache: true }); + expect(call[0]).toMatchObject({ includeDisabled: true }); expect(call[0]).not.toHaveProperty("bundledChannelConfigCollector"); } expect(getActivePluginRegistry()).toBe(activeRegistry); diff --git a/src/config/runtime-schema.ts b/src/config/runtime-schema.ts index 2aab1a3b065..d4dd138dcf3 100644 --- a/src/config/runtime-schema.ts +++ b/src/config/runtime-schema.ts @@ -19,7 +19,6 @@ function loadManifestRegistry(config: OpenClawConfig, env?: NodeJS.ProcessEnv) { config, // Bundled channel schemas are already generated into the base schema; avoid // loading plugin config-schema modules on every config.get/config.schema. - cache: true, env, workspaceDir, includeDisabled: true, diff --git a/src/gateway/server-methods/cron.ts b/src/gateway/server-methods/cron.ts index 5ea9166d5fb..51abf6b6296 100644 --- a/src/gateway/server-methods/cron.ts +++ b/src/gateway/server-methods/cron.ts @@ -32,7 +32,6 @@ function listConfiguredAnnounceChannelIds(cfg: OpenClawConfig): string[] { return listConfiguredAnnounceChannelIdsForConfig({ config: cfg, env: process.env, - cache: true, }); } diff --git a/src/gateway/server-plugin-bootstrap.browser-plugin.integration.test.ts b/src/gateway/server-plugin-bootstrap.browser-plugin.integration.test.ts index efb29915460..0dcec6bfb76 100644 --- a/src/gateway/server-plugin-bootstrap.browser-plugin.integration.test.ts +++ b/src/gateway/server-plugin-bootstrap.browser-plugin.integration.test.ts @@ -1,16 +1,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { createBundledBrowserPluginFixture } from "../../test/helpers/browser-bundled-plugin-fixture.js"; import type { OpenClawConfig } from "../config/config.js"; -import { clearPluginDiscoveryCache } from "../plugins/discovery.js"; import { clearPluginLoaderCache } from "../plugins/loader.js"; -import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; import { resetPluginRuntimeStateForTest } from "../plugins/runtime.js"; import { loadGatewayStartupPlugins } from "./server-plugin-bootstrap.js"; function resetPluginState() { clearPluginLoaderCache(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); resetPluginRuntimeStateForTest(); } diff --git a/src/hooks/plugin-hooks.ts b/src/hooks/plugin-hooks.ts index a7cdf2fce0f..9634940799c 100644 --- a/src/hooks/plugin-hooks.ts +++ b/src/hooks/plugin-hooks.ts @@ -30,7 +30,6 @@ export function resolvePluginHookDirs(params: { workspaceDir, config: params.config, // Hook discovery should reflect freshly written bundle manifests immediately. - cache: false, includeDisabled: true, }); if (registry.plugins.length === 0) { diff --git a/src/infra/provider-usage.auth.normalizes-keys.test.ts b/src/infra/provider-usage.auth.normalizes-keys.test.ts index e339ad331c4..d13302875a5 100644 --- a/src/infra/provider-usage.auth.normalizes-keys.test.ts +++ b/src/infra/provider-usage.auth.normalizes-keys.test.ts @@ -137,7 +137,6 @@ const providerRuntimeMocks = vi.hoisted(() => ({ buildProviderAuthDoctorHintWithPlugin: vi.fn(() => undefined), buildProviderMissingAuthMessageWithPlugin: vi.fn(() => undefined), buildProviderUnknownModelHintWithPlugin: vi.fn(() => undefined), - clearProviderRuntimeHookCache: vi.fn(() => {}), createProviderEmbeddingProvider: vi.fn(() => undefined), formatProviderAuthProfileApiKeyWithPlugin: vi.fn(() => undefined), normalizeProviderResolvedModelWithPlugin: vi.fn(() => undefined), @@ -145,7 +144,6 @@ const providerRuntimeMocks = vi.hoisted(() => ({ prepareProviderExtraParams: vi.fn(() => undefined), prepareProviderRuntimeAuth: vi.fn(async () => undefined), refreshProviderOAuthCredentialWithPlugin: vi.fn(async () => undefined), - resetProviderRuntimeHookCacheForTest: vi.fn(() => {}), resolveProviderBinaryThinking: vi.fn(() => undefined), resolveProviderCacheTtlEligibility: vi.fn(() => undefined), resolveProviderCapabilitiesWithPlugin: vi.fn(() => undefined), diff --git a/src/plugin-sdk/facade-activation-check.runtime.ts b/src/plugin-sdk/facade-activation-check.runtime.ts index 34e8fbbb230..1504ac81e4c 100644 --- a/src/plugin-sdk/facade-activation-check.runtime.ts +++ b/src/plugin-sdk/facade-activation-check.runtime.ts @@ -29,32 +29,6 @@ const ALWAYS_ALLOWED_RUNTIME_DIR_NAMES = new Set([ ]); const EMPTY_FACADE_BOUNDARY_CONFIG: OpenClawConfig = {}; -let cachedBoundaryRawConfig: OpenClawConfig | undefined; -let cachedBoundaryResolvedConfigKey: string | undefined; -let cachedBoundaryConfigFileState: - | { - configPath: string; - mtimeMs: number; - size: number; - rawConfig: OpenClawConfig; - } - | undefined; -let cachedBoundaryResolvedConfig: - | { - rawConfig: OpenClawConfig; - config: OpenClawConfig; - normalizedPluginsConfig: ReturnType; - activationSource: ReturnType; - autoEnabledReasons: Record; - } - | undefined; -let cachedManifestRegistryByKey = new Map(); -const cachedFacadeManifestRecordsByKey = new Map(); -const cachedFacadePublicSurfaceAccessByKey = new Map< - string, - { allowed: boolean; pluginId?: string; reason?: string } ->(); - export type FacadePluginManifestLike = Pick< PluginManifestRecord, "id" | "origin" | "enabledByDefault" | "rootDir" | "channels" @@ -67,7 +41,6 @@ type FacadeModuleLocation = { function readFacadeBoundaryConfigSafely(): { rawConfig: OpenClawConfig; - cacheKey?: string; } { try { const sourceSnapshot = getRuntimeConfigSourceSnapshot(); @@ -80,19 +53,7 @@ function readFacadeBoundaryConfigSafely(): { } const configPath = resolveConfigPath(); if (!fs.existsSync(configPath)) { - return { rawConfig: EMPTY_FACADE_BOUNDARY_CONFIG, cacheKey: `missing:${configPath}` }; - } - const stat = fs.statSync(configPath); - if ( - cachedBoundaryConfigFileState && - cachedBoundaryConfigFileState.configPath === configPath && - cachedBoundaryConfigFileState.mtimeMs === stat.mtimeMs && - cachedBoundaryConfigFileState.size === stat.size - ) { - return { - rawConfig: cachedBoundaryConfigFileState.rawConfig, - cacheKey: `file:${configPath}:${stat.mtimeMs}:${stat.size}`, - }; + return { rawConfig: EMPTY_FACADE_BOUNDARY_CONFIG }; } const raw = fs.readFileSync(configPath, "utf8"); const parsed = JSON5.parse(raw); @@ -100,16 +61,7 @@ function readFacadeBoundaryConfigSafely(): { parsed && typeof parsed === "object" ? (parsed as OpenClawConfig) : EMPTY_FACADE_BOUNDARY_CONFIG; - cachedBoundaryConfigFileState = { - configPath, - mtimeMs: stat.mtimeMs, - size: stat.size, - rawConfig, - }; - return { - rawConfig, - cacheKey: `file:${configPath}:${stat.mtimeMs}:${stat.size}`, - }; + return { rawConfig }; } catch { return { rawConfig: EMPTY_FACADE_BOUNDARY_CONFIG }; } @@ -118,14 +70,6 @@ function readFacadeBoundaryConfigSafely(): { function getFacadeBoundaryResolvedConfig() { const readResult = readFacadeBoundaryConfigSafely(); const { rawConfig } = readResult; - if ( - cachedBoundaryResolvedConfig && - ((readResult.cacheKey && cachedBoundaryResolvedConfigKey === readResult.cacheKey) || - (!readResult.cacheKey && cachedBoundaryRawConfig === rawConfig)) - ) { - return cachedBoundaryResolvedConfig; - } - const autoEnabled = configMayNeedPluginAutoEnable(rawConfig, process.env) ? applyPluginAutoEnable({ config: rawConfig, @@ -136,34 +80,22 @@ function getFacadeBoundaryResolvedConfig() { autoEnabledReasons: {} as Record, }; const config = autoEnabled.config; - const resolved = { + return { rawConfig, config, normalizedPluginsConfig: normalizePluginsConfig(config?.plugins), activationSource: createPluginActivationSource({ config: rawConfig }), autoEnabledReasons: autoEnabled.autoEnabledReasons, }; - cachedBoundaryRawConfig = rawConfig; - cachedBoundaryResolvedConfigKey = readResult.cacheKey; - cachedBoundaryResolvedConfig = resolved; - return resolved; } function getFacadeManifestRegistry(params: { - cacheKey: string; env?: NodeJS.ProcessEnv; }): readonly PluginManifestRecord[] { - const cached = cachedManifestRegistryByKey.get(params.cacheKey); - if (cached) { - return cached; - } - const loaded = loadPluginManifestRegistry({ + return loadPluginManifestRegistry({ config: getFacadeBoundaryResolvedConfig().config, - cache: true, ...(params.env ? { env: params.env } : {}), }).plugins; - cachedManifestRegistryByKey.set(params.cacheKey, loaded); - return loaded; } export function resolveRegistryPluginModuleLocation(params: { @@ -173,7 +105,6 @@ export function resolveRegistryPluginModuleLocation(params: { env?: NodeJS.ProcessEnv; }): FacadeModuleLocation | null { const registry = getFacadeManifestRegistry({ - cacheKey: params.resolutionKey, ...(params.env ? { env: params.env } : {}), }); return resolveRegistryPluginModuleLocationFromRecords({ @@ -272,18 +203,12 @@ function resolveBundledPluginManifestRecord(params: { resolutionKey: string; env?: NodeJS.ProcessEnv; }): FacadePluginManifestLike | null { - if (cachedFacadeManifestRecordsByKey.has(params.resolutionKey)) { - return cachedFacadeManifestRecordsByKey.get(params.resolutionKey) ?? null; - } - const metadataRecord = resolveBundledMetadataManifestRecord(params); if (metadataRecord) { - cachedFacadeManifestRecordsByKey.set(params.resolutionKey, metadataRecord); return metadataRecord; } const registry = getFacadeManifestRegistry({ - cacheKey: params.resolutionKey, ...(params.env ? { env: params.env } : {}), }); const resolved = @@ -301,7 +226,6 @@ function resolveBundledPluginManifestRecord(params: { registry.find((plugin) => path.basename(plugin.rootDir) === params.dirName) ?? registry.find((plugin) => plugin.channels.includes(params.dirName)) ?? null; - cachedFacadeManifestRecordsByKey.set(params.resolutionKey, resolved); return resolved; } @@ -324,35 +248,26 @@ export function resolveBundledPluginPublicSurfaceAccess(params: { resolutionKey: string; env?: NodeJS.ProcessEnv; }): { allowed: boolean; pluginId?: string; reason?: string } { - const cached = cachedFacadePublicSurfaceAccessByKey.get(params.resolutionKey); - if (cached) { - return cached; - } - if ( params.artifactBasename === "runtime-api.js" && ALWAYS_ALLOWED_RUNTIME_DIR_NAMES.has(params.dirName) ) { - const resolved = { + return { allowed: true, pluginId: params.dirName, }; - cachedFacadePublicSurfaceAccessByKey.set(params.resolutionKey, resolved); - return resolved; } const manifestRecord = resolveBundledPluginManifestRecord(params); if (!manifestRecord) { - const resolved = { + return { allowed: false, reason: `no bundled plugin manifest found for ${params.dirName}`, }; - cachedFacadePublicSurfaceAccessByKey.set(params.resolutionKey, resolved); - return resolved; } const { config, normalizedPluginsConfig, activationSource, autoEnabledReasons } = getFacadeBoundaryResolvedConfig(); - const resolved = evaluateBundledPluginPublicSurfaceAccess({ + return evaluateBundledPluginPublicSurfaceAccess({ params, manifestRecord, config, @@ -360,8 +275,6 @@ export function resolveBundledPluginPublicSurfaceAccess(params: { activationSource, autoEnabledReasons, }); - cachedFacadePublicSurfaceAccessByKey.set(params.resolutionKey, resolved); - return resolved; } export function evaluateBundledPluginPublicSurfaceAccess(params: { @@ -423,12 +336,4 @@ export function resolveActivatedBundledPluginPublicSurfaceAccessOrThrow(params: return access; } -export function resetFacadeActivationCheckRuntimeStateForTest(): void { - cachedManifestRegistryByKey.clear(); - cachedBoundaryRawConfig = undefined; - cachedBoundaryResolvedConfigKey = undefined; - cachedBoundaryConfigFileState = undefined; - cachedBoundaryResolvedConfig = undefined; - cachedFacadeManifestRecordsByKey.clear(); - cachedFacadePublicSurfaceAccessByKey.clear(); -} +export function resetFacadeActivationCheckRuntimeStateForTest(): void {} diff --git a/src/plugin-sdk/facade-loader.ts b/src/plugin-sdk/facade-loader.ts index 2de9ee03865..d7c315ff548 100644 --- a/src/plugin-sdk/facade-loader.ts +++ b/src/plugin-sdk/facade-loader.ts @@ -11,11 +11,7 @@ import { type PluginJitiLoaderFactory, } from "../plugins/jiti-loader-cache.js"; import { resolveLoaderPackageRoot } from "../plugins/sdk-alias.js"; -import { - createFacadeResolutionKey as createFacadeResolutionKeyShared, - resolveBundledFacadeModuleLocation, - resolveCachedFacadeModuleLocation, -} from "./facade-resolution-shared.js"; +import { resolveBundledFacadeModuleLocation } from "./facade-resolution-shared.js"; const CURRENT_MODULE_PATH = fileURLToPath(import.meta.url); @@ -23,13 +19,6 @@ const nodeRequire = createRequire(import.meta.url); const jitiLoaders: PluginJitiLoaderCache = new Map(); const loadedFacadeModules = new Map(); const loadedFacadePluginIds = new Set(); -const cachedFacadeModuleLocationsByKey = new Map< - string, - { - modulePath: string; - boundaryRoot: string; - } | null ->(); let facadeLoaderJitiFactory: PluginJitiLoaderFactory | undefined; let cachedOpenClawPackageRoot: string | undefined; @@ -54,20 +43,7 @@ function getOpenClawPackageRoot() { return cachedOpenClawPackageRoot; } -function createFacadeResolutionKey(params: { - dirName: string; - artifactBasename: string; - env?: NodeJS.ProcessEnv; -}): string { - const bundledPluginsDir = resolveBundledPluginsDir(params.env ?? process.env); - return createFacadeResolutionKeyShared({ - ...params, - bundledPluginsDir, - ...(params.env ? { env: params.env } : {}), - }); -} - -function resolveFacadeModuleLocationUncached(params: { +function resolveFacadeModuleLocation(params: { dirName: string; artifactBasename: string; env?: NodeJS.ProcessEnv; @@ -81,18 +57,6 @@ function resolveFacadeModuleLocationUncached(params: { }); } -function resolveFacadeModuleLocation(params: { - dirName: string; - artifactBasename: string; - env?: NodeJS.ProcessEnv; -}): { modulePath: string; boundaryRoot: string } | null { - return resolveCachedFacadeModuleLocation({ - cache: cachedFacadeModuleLocationsByKey, - key: createFacadeResolutionKey(params), - resolve: () => resolveFacadeModuleLocationUncached(params), - }); -} - function getJiti(modulePath: string) { return getCachedPluginJitiLoader({ cache: jitiLoaders, @@ -337,7 +301,6 @@ export function resetFacadeLoaderStateForTest(): void { loadedFacadeModules.clear(); loadedFacadePluginIds.clear(); jitiLoaders.clear(); - cachedFacadeModuleLocationsByKey.clear(); facadeLoaderJitiFactory = undefined; cachedOpenClawPackageRoot = undefined; } diff --git a/src/plugin-sdk/facade-resolution-shared.ts b/src/plugin-sdk/facade-resolution-shared.ts index 0f2db13a207..bd6623ab8f1 100644 --- a/src/plugin-sdk/facade-resolution-shared.ts +++ b/src/plugin-sdk/facade-resolution-shared.ts @@ -31,19 +31,6 @@ export function createFacadeResolutionKey(params: { }::${disabledKey}`; } -export function resolveCachedFacadeModuleLocation(params: { - cache: Map; - key: string; - resolve: () => TLocation | null; -}): TLocation | null { - if (params.cache.has(params.key)) { - return params.cache.get(params.key) ?? null; - } - const resolved = params.resolve(); - params.cache.set(params.key, resolved); - return resolved; -} - export function resolveFacadeBoundaryRoot(params: { modulePath: string; bundledPluginsDir?: string | null; diff --git a/src/plugin-sdk/facade-runtime.test.ts b/src/plugin-sdk/facade-runtime.test.ts index 5a80d6f1410..5465a17e418 100644 --- a/src/plugin-sdk/facade-runtime.test.ts +++ b/src/plugin-sdk/facade-runtime.test.ts @@ -4,8 +4,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { clearRuntimeConfigSnapshot, setRuntimeConfigSnapshot } from "../config/config.js"; import { setBundledPluginsDirOverrideForTest } from "../plugins/bundled-dir.js"; import { createPluginActivationSource, normalizePluginsConfig } from "../plugins/config-state.js"; -import { clearPluginDiscoveryCache } from "../plugins/discovery.js"; -import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; import { evaluateBundledPluginPublicSurfaceAccess, resetFacadeActivationCheckRuntimeStateForTest, @@ -93,8 +91,6 @@ afterEach(() => { resetFacadeRuntimeStateForTest(); resetFacadeActivationCheckRuntimeStateForTest(); setBundledPluginsDirOverrideForTest(undefined); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); vi.doUnmock("../plugins/manifest-registry.js"); if (originalBundledPluginsDir === undefined) { delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; diff --git a/src/plugin-sdk/facade-runtime.ts b/src/plugin-sdk/facade-runtime.ts index ae30b0764cd..f759419566d 100644 --- a/src/plugin-sdk/facade-runtime.ts +++ b/src/plugin-sdk/facade-runtime.ts @@ -16,7 +16,6 @@ import { import { createFacadeResolutionKey as createFacadeResolutionKeyShared, resolveBundledFacadeModuleLocation, - resolveCachedFacadeModuleLocation, resolveRegistryPluginModuleLocationFromRecords, } from "./facade-resolution-shared.js"; export { @@ -45,13 +44,6 @@ const OPENCLAW_PACKAGE_ROOT = }) ?? fileURLToPath(new URL("../..", import.meta.url)); const CURRENT_MODULE_PATH = fileURLToPath(import.meta.url); const OPENCLAW_SOURCE_EXTENSIONS_ROOT = path.resolve(OPENCLAW_PACKAGE_ROOT, "extensions"); -const cachedFacadeModuleLocationsByKey = new Map< - string, - { - modulePath: string; - boundaryRoot: string; - } | null ->(); function createFacadeResolutionKey(params: { dirName: string; @@ -100,11 +92,7 @@ function resolveFacadeModuleLocation(params: { artifactBasename: string; env?: NodeJS.ProcessEnv; }): { modulePath: string; boundaryRoot: string } | null { - return resolveCachedFacadeModuleLocation({ - cache: cachedFacadeModuleLocationsByKey, - key: createFacadeResolutionKey(params), - resolve: () => resolveFacadeModuleLocationUncached(params), - }); + return resolveFacadeModuleLocationUncached(params); } type BundledPluginPublicSurfaceParams = { @@ -260,7 +248,6 @@ export function resetFacadeRuntimeStateForTest(): void { facadeActivationCheckRuntimeModule?.resetFacadeActivationCheckRuntimeStateForTest(); facadeActivationCheckRuntimeModule = undefined; facadeActivationCheckRuntimeJitiLoaders.clear(); - cachedFacadeModuleLocationsByKey.clear(); } export const __testing = { diff --git a/src/plugin-sdk/provider-catalog-runtime.ts b/src/plugin-sdk/provider-catalog-runtime.ts index 914fc7bc1d3..2ed10740d6f 100644 --- a/src/plugin-sdk/provider-catalog-runtime.ts +++ b/src/plugin-sdk/provider-catalog-runtime.ts @@ -1,9 +1,6 @@ // Public provider-catalog runtime seams for provider plugin contract tests. -export { - augmentModelCatalogWithProviderPlugins, - resetProviderRuntimeHookCacheForTest, -} from "../plugins/provider-runtime.js"; +export { augmentModelCatalogWithProviderPlugins } from "../plugins/provider-runtime.js"; export { resolveCatalogHookProviderPluginIds, resolveOwningPluginIdsForProvider, diff --git a/src/plugin-sdk/qa-runner-runtime.test.ts b/src/plugin-sdk/qa-runner-runtime.test.ts index d81414d3c1d..505b2eb3945 100644 --- a/src/plugin-sdk/qa-runner-runtime.test.ts +++ b/src/plugin-sdk/qa-runner-runtime.test.ts @@ -202,7 +202,6 @@ describe("plugin-sdk qa-runner-runtime", () => { }, ]); expect(loadPluginManifestRegistry).toHaveBeenCalledWith({ - cache: true, env: expect.objectContaining({ OPENCLAW_ENABLE_PRIVATE_QA_CLI: "1", OPENCLAW_BUNDLED_PLUGINS_DIR: path.join(sourceRoot, "extensions"), diff --git a/src/plugin-sdk/qa-runner-runtime.ts b/src/plugin-sdk/qa-runner-runtime.ts index 9e660156a46..8981cd809e7 100644 --- a/src/plugin-sdk/qa-runner-runtime.ts +++ b/src/plugin-sdk/qa-runner-runtime.ts @@ -91,7 +91,7 @@ function listDeclaredQaRunnerPlugins( qaRunners: NonNullable; } > { - return loadPluginManifestRegistry({ cache: true, ...(env ? { env } : {}) }) + return loadPluginManifestRegistry({ ...(env ? { env } : {}) }) .plugins.filter( ( plugin, diff --git a/src/plugin-sdk/test-helpers/provider-catalog.ts b/src/plugin-sdk/test-helpers/provider-catalog.ts index 04a96826e98..c2b670fec90 100644 --- a/src/plugin-sdk/test-helpers/provider-catalog.ts +++ b/src/plugin-sdk/test-helpers/provider-catalog.ts @@ -12,14 +12,13 @@ export { type ProviderRuntimeCatalogModule = Pick< typeof import("openclaw/plugin-sdk/provider-catalog-runtime"), - "augmentModelCatalogWithProviderPlugins" | "resetProviderRuntimeHookCacheForTest" + "augmentModelCatalogWithProviderPlugins" >; export async function importProviderRuntimeCatalogModule(): Promise { - const { augmentModelCatalogWithProviderPlugins, resetProviderRuntimeHookCacheForTest } = + const { augmentModelCatalogWithProviderPlugins } = await import("openclaw/plugin-sdk/provider-catalog-runtime"); return { augmentModelCatalogWithProviderPlugins, - resetProviderRuntimeHookCacheForTest, }; } diff --git a/src/plugins/activation-planner.ts b/src/plugins/activation-planner.ts index 82d3fcfdc4d..e659e7e80fa 100644 --- a/src/plugins/activation-planner.ts +++ b/src/plugins/activation-planner.ts @@ -54,7 +54,6 @@ type ResolveManifestActivationPlanParams = { config?: OpenClawConfig; workspaceDir?: string; env?: NodeJS.ProcessEnv; - cache?: boolean; origin?: PluginOrigin; onlyPluginIds?: readonly string[]; manifestRecords?: readonly PluginManifestRecord[]; @@ -70,7 +69,6 @@ export function resolveManifestActivationPlan( config: params.config, workspaceDir: params.workspaceDir, env: params.env, - cache: params.cache, includeDisabled: true, }); const entries = registry.plugins diff --git a/src/plugins/bundle-commands.ts b/src/plugins/bundle-commands.ts index 11eccc9cd46..02f9895cb8f 100644 --- a/src/plugins/bundle-commands.ts +++ b/src/plugins/bundle-commands.ts @@ -179,7 +179,6 @@ export function loadEnabledClaudeBundleCommands(params: { const registry = loadPluginManifestRegistryForPluginRegistry({ workspaceDir: params.workspaceDir, config: params.cfg, - cache: false, includeDisabled: true, }); const normalizedPlugins = normalizePluginsConfig(params.cfg?.plugins); diff --git a/src/plugins/bundle-mcp.test-support.ts b/src/plugins/bundle-mcp.test-support.ts index d1f3f376c92..8e5a86979c2 100644 --- a/src/plugins/bundle-mcp.test-support.ts +++ b/src/plugins/bundle-mcp.test-support.ts @@ -2,8 +2,6 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { captureEnv } from "../test-utils/env.js"; -import { clearPluginDiscoveryCache } from "./discovery.js"; -import { clearPluginManifestRegistryCache } from "./manifest-registry.js"; export function createBundleMcpTempHarness() { const tempDirs: string[] = []; @@ -15,8 +13,6 @@ export function createBundleMcpTempHarness() { return dir; }, async cleanup() { - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); await Promise.all( tempDirs.splice(0).map((dir) => fs.rm(dir, { recursive: true, force: true })), ); diff --git a/src/plugins/bundled-capability-runtime.ts b/src/plugins/bundled-capability-runtime.ts index 45e1d8b7e4d..f17f521c1a3 100644 --- a/src/plugins/bundled-capability-runtime.ts +++ b/src/plugins/bundled-capability-runtime.ts @@ -225,12 +225,10 @@ export function loadBundledCapabilityRuntimeRegistry(params: { }; const discovery = discoverOpenClawPlugins({ - cache: false, env, }); const manifestRegistry = loadPluginManifestRegistry({ config: buildBundledCapabilityRuntimeConfig(params.pluginIds, env), - cache: false, env, candidates: discovery.candidates, diagnostics: discovery.diagnostics, diff --git a/src/plugins/bundled-plugin-metadata.test.ts b/src/plugins/bundled-plugin-metadata.test.ts index 3c4af62f2a2..d9e471c3d6b 100644 --- a/src/plugins/bundled-plugin-metadata.test.ts +++ b/src/plugins/bundled-plugin-metadata.test.ts @@ -4,7 +4,6 @@ import { describe, expect, it } from "vitest"; import { collectBundledChannelConfigs } from "./bundled-channel-config-metadata.js"; import { type BundledPluginMetadata, - clearBundledPluginMetadataCache, listBundledPluginMetadata, resolveBundledPluginGeneratedPath, resolveBundledPluginRepoEntryPath, @@ -472,8 +471,6 @@ describe("bundled plugin metadata", () => { configSchema: { type: "object" }, }); fs.writeFileSync(path.join(pluginRoot, "index.ts"), "export const source = true;\n", "utf8"); - - clearBundledPluginMetadataCache(); expect( listBundledPluginMetadata({ rootDir: tempRoot, @@ -577,8 +574,6 @@ describe("bundled plugin metadata", () => { fs.mkdirSync(distPluginRoot, { recursive: true }); fs.writeFileSync(path.join(distPluginRoot, "index.js"), "export const built = true;\n", "utf8"); - - clearBundledPluginMetadataCache(); expect( resolveBundledPluginRepoEntryPath({ rootDir: tempRoot, @@ -642,8 +637,6 @@ describe("bundled plugin metadata", () => { ].join("\n"), "utf8", ); - - clearBundledPluginMetadataCache(); const entries = listBundledPluginMetadata({ rootDir: tempRoot }); const channelConfigs = entries[0]?.manifest.channelConfigs as | Record @@ -696,8 +689,6 @@ describe("bundled plugin metadata", () => { "export {};\n", "utf8", ); - - clearBundledPluginMetadataCache(); const entries = listBundledPluginMetadata({ rootDir: tempRoot }); const firstEntry = entries[0] as | { @@ -764,8 +755,6 @@ describe("bundled plugin metadata", () => { ].join("\n"), "utf8", ); - - clearBundledPluginMetadataCache(); const entries = listBundledPluginMetadata({ rootDir: distRoot }); const channelConfigs = entries[0]?.manifest.channelConfigs as | Record @@ -845,8 +834,6 @@ describe("bundled plugin metadata", () => { ].join("\n"), "utf8", ); - - clearBundledPluginMetadataCache(); const entries = listBundledPluginMetadata({ rootDir: distRoot }); const channelConfigs = entries[0]?.manifest.channelConfigs as | Record diff --git a/src/plugins/bundled-plugin-metadata.ts b/src/plugins/bundled-plugin-metadata.ts index 247bd73b158..21ba859b6c6 100644 --- a/src/plugins/bundled-plugin-metadata.ts +++ b/src/plugins/bundled-plugin-metadata.ts @@ -49,11 +49,6 @@ export type BundledPluginMetadata = { manifest: PluginManifest; }; -export function clearBundledPluginMetadataCache(): void { - // Bundled plugin metadata is read fresh. Keep the reset hook as a - // compatibility no-op for tests and older callers. -} - function readPackageManifest(pluginDir: string): PackageManifest | undefined { const packagePath = path.join(pluginDir, "package.json"); if (!fs.existsSync(packagePath)) { diff --git a/src/plugins/capability-provider-runtime.test.ts b/src/plugins/capability-provider-runtime.test.ts index 4a8923aae5f..87b5b72f2d4 100644 --- a/src/plugins/capability-provider-runtime.test.ts +++ b/src/plugins/capability-provider-runtime.test.ts @@ -67,7 +67,6 @@ vi.mock("./bundled-compat.js", () => ({ let resolvePluginCapabilityProviders: typeof import("./capability-provider-runtime.js").resolvePluginCapabilityProviders; let resolvePluginCapabilityProvider: typeof import("./capability-provider-runtime.js").resolvePluginCapabilityProvider; -let clearCapabilityProviderPluginIdCacheForTests: typeof import("./capability-provider-runtime.js").__testing.clearCapabilityProviderPluginIdCacheForTests; function expectResolvedCapabilityProviderIds(providers: Array<{ id: string }>, expected: string[]) { expect(providers.map((provider) => provider.id)).toEqual(expected); @@ -171,15 +170,11 @@ function expectCompatChainApplied(params: { describe("resolvePluginCapabilityProviders", () => { beforeAll(async () => { - ({ - resolvePluginCapabilityProvider, - resolvePluginCapabilityProviders, - __testing: { clearCapabilityProviderPluginIdCacheForTests }, - } = await import("./capability-provider-runtime.js")); + ({ resolvePluginCapabilityProvider, resolvePluginCapabilityProviders } = + await import("./capability-provider-runtime.js")); }); beforeEach(() => { - clearCapabilityProviderPluginIdCacheForTests(); mocks.resolveRuntimePluginRegistry.mockReset(); mocks.resolveRuntimePluginRegistry.mockReturnValue(undefined); mocks.resolvePluginRegistryLoadCacheKey.mockReset(); diff --git a/src/plugins/capability-provider-runtime.ts b/src/plugins/capability-provider-runtime.ts index 4950170c6d6..de4603b27af 100644 --- a/src/plugins/capability-provider-runtime.ts +++ b/src/plugins/capability-provider-runtime.ts @@ -43,15 +43,6 @@ const CAPABILITY_CONTRACT_KEY: Record !disabledChannelIds.has(channelId)); @@ -454,7 +448,6 @@ function resolveScopedChannelOwnerPluginIds(params: { channelIds: readonly string[]; workspaceDir?: string; env: NodeJS.ProcessEnv; - cache?: boolean; manifestRecords?: readonly PluginManifestRecord[]; }): string[] { const channelIds = normalizeChannelIds(params.channelIds); @@ -467,7 +460,6 @@ function resolveScopedChannelOwnerPluginIds(params: { config: params.config, workspaceDir: params.workspaceDir, env: params.env, - cache: params.cache, }); const trustConfig = params.activationSourceConfig ?? params.config; const normalizedConfig = normalizePluginsConfig(trustConfig.plugins); @@ -481,7 +473,6 @@ function resolveScopedChannelOwnerPluginIds(params: { config: params.config, workspaceDir: params.workspaceDir, env: params.env, - cache: params.cache, manifestRecords: records, }); }), @@ -512,7 +503,6 @@ export function resolveDiscoverableScopedChannelPluginIds(params: { channelIds: readonly string[]; workspaceDir?: string; env: NodeJS.ProcessEnv; - cache?: boolean; manifestRecords?: readonly PluginManifestRecord[]; }): string[] { return resolveScopedChannelOwnerPluginIds(params); diff --git a/src/plugins/cli.browser-plugin.integration.test.ts b/src/plugins/cli.browser-plugin.integration.test.ts index 5b151d0d438..9c8157b0980 100644 --- a/src/plugins/cli.browser-plugin.integration.test.ts +++ b/src/plugins/cli.browser-plugin.integration.test.ts @@ -2,15 +2,11 @@ import path from "node:path"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { createBundledBrowserPluginFixture } from "../../test/helpers/browser-bundled-plugin-fixture.js"; import type { OpenClawConfig } from "../config/config.js"; -import { clearPluginDiscoveryCache } from "./discovery.js"; import { clearPluginLoaderCache, loadOpenClawPlugins } from "./loader.js"; -import { clearPluginManifestRegistryCache } from "./manifest-registry.js"; import { resetPluginRuntimeStateForTest } from "./runtime.js"; function resetPluginState() { clearPluginLoaderCache(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); resetPluginRuntimeStateForTest(); } diff --git a/src/plugins/config-contracts.ts b/src/plugins/config-contracts.ts index 83fc03bd3fc..0e333a68ec8 100644 --- a/src/plugins/config-contracts.ts +++ b/src/plugins/config-contracts.ts @@ -101,7 +101,6 @@ export function resolvePluginConfigContractsById(params: { config?: OpenClawConfig; workspaceDir?: string; env?: NodeJS.ProcessEnv; - cache?: boolean; fallbackToBundledMetadata?: boolean; fallbackToBundledMetadataForResolvedBundled?: boolean; fallbackBundledPluginIds?: readonly string[]; @@ -123,7 +122,6 @@ export function resolvePluginConfigContractsById(params: { config: params.config, workspaceDir: params.workspaceDir, env: params.env, - cache: params.cache, includeDisabled: true, }); for (const plugin of registry.plugins) { diff --git a/src/plugins/contracts/runtime-seams.contract.test.ts b/src/plugins/contracts/runtime-seams.contract.test.ts index 41065dd9df8..ea7917df599 100644 --- a/src/plugins/contracts/runtime-seams.contract.test.ts +++ b/src/plugins/contracts/runtime-seams.contract.test.ts @@ -8,8 +8,6 @@ import { } from "../../config/runtime-snapshot.js"; import { fetchWithSsrFGuard } from "../../infra/net/fetch-guard.js"; import { TEST_UNDICI_RUNTIME_DEPS_KEY } from "../../infra/net/undici-runtime.js"; -import { clearPluginDiscoveryCache } from "../discovery.js"; -import { clearPluginManifestRegistryCache } from "../manifest-registry.js"; const originalBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; const originalStateDir = process.env.OPENCLAW_STATE_DIR; @@ -71,8 +69,6 @@ afterEach(() => { vi.restoreAllMocks(); vi.resetModules(); vi.doUnmock("../../config/plugin-auto-enable.js"); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); Reflect.deleteProperty(globalThis as object, TEST_UNDICI_RUNTIME_DEPS_KEY); if (originalBundledPluginsDir === undefined) { delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; @@ -109,8 +105,6 @@ describe("shared runtime seam contracts", () => { }, }, }); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); vi.resetModules(); vi.doMock("../../config/plugin-auto-enable.js", () => ({ applyPluginAutoEnable: ({ config }: { config?: unknown }) => ({ diff --git a/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts b/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts index 5a213ffc27f..85606fc91ec 100644 --- a/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts +++ b/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts @@ -2,7 +2,7 @@ import { relative, resolve } from "node:path"; import { loadPluginManifestRegistry } from "../../manifest-registry.js"; const bundledPluginRoots = new Map( - loadPluginManifestRegistry({ cache: true, config: {} }) + loadPluginManifestRegistry({ config: {} }) .plugins.filter((plugin) => plugin.origin === "bundled") .map((plugin) => [plugin.id, plugin.rootDir] as const), ); diff --git a/src/plugins/discovery.test.ts b/src/plugins/discovery.test.ts index 1d29440c251..3d063dea905 100644 --- a/src/plugins/discovery.test.ts +++ b/src/plugins/discovery.test.ts @@ -3,7 +3,7 @@ import os from "node:os"; import path from "node:path"; import { bundledDistPluginFile } from "openclaw/plugin-sdk/test-fixtures"; import { afterEach, describe, expect, it, vi } from "vitest"; -import { clearPluginDiscoveryCache, discoverOpenClawPlugins } from "./discovery.js"; +import { discoverOpenClawPlugins } from "./discovery.js"; import { cleanupTrackedTempDirs, makeTrackedTempDir, @@ -325,7 +325,6 @@ async function expectRejectedPackageExtensionEntry(params: { afterEach(() => { vi.restoreAllMocks(); - clearPluginDiscoveryCache(); cleanupTrackedTempDirs(tempDirs); }); @@ -716,7 +715,6 @@ describe("discoverOpenClawPlugins", () => { const realpathSync = vi.spyOn(fs, "realpathSync"); const { candidates } = discoverOpenClawPlugins({ env: buildDiscoveryEnv(stateDir), - cache: false, }); expectCandidateIds(candidates, { includes: ["pack/one", "pack/two"] }); @@ -749,7 +747,6 @@ describe("discoverOpenClawPlugins", () => { const { candidates } = discoverOpenClawPlugins({ extraPaths: [linkedPackageDir, canonicalPackageDir], env: buildDiscoveryEnv(stateDir), - cache: false, }); expectCandidateIds(candidates, { includes: ["pack"] }); diff --git a/src/plugins/discovery.ts b/src/plugins/discovery.ts index bacf1dd9988..64762e9ae19 100644 --- a/src/plugins/discovery.ts +++ b/src/plugins/discovery.ts @@ -65,11 +65,6 @@ export type PluginDiscoveryResult = { diagnostics: PluginDiagnostic[]; }; -export function clearPluginDiscoveryCache(): void { - // Discovery is intentionally uncached. Keep the public test/helper hook as a - // compatibility no-op while callers migrate away from explicit cache clears. -} - function currentUid(overrideUid?: number | null): number | null { if (overrideUid !== undefined) { return overrideUid; @@ -851,7 +846,6 @@ export function discoverOpenClawPlugins(params: { workspaceDir?: string; extraPaths?: string[]; ownershipUid?: number | null; - cache?: boolean; env?: NodeJS.ProcessEnv; }): PluginDiscoveryResult { const env = params.env ?? process.env; diff --git a/src/plugins/doctor-contract-registry.ts b/src/plugins/doctor-contract-registry.ts index afd209e4b5a..96c68b2fc8e 100644 --- a/src/plugins/doctor-contract-registry.ts +++ b/src/plugins/doctor-contract-registry.ts @@ -213,7 +213,6 @@ function resolvePluginDoctorContracts(params?: { const manifestRegistry = loadPluginManifestRegistryForPluginRegistry({ workspaceDir: params?.workspaceDir, env, - cache: true, includeDisabled: true, }); diff --git a/src/plugins/installed-plugin-index-registry.ts b/src/plugins/installed-plugin-index-registry.ts index e94e657cf4f..4a1fa832d78 100644 --- a/src/plugins/installed-plugin-index-registry.ts +++ b/src/plugins/installed-plugin-index-registry.ts @@ -13,7 +13,6 @@ export function resolveInstalledPluginIndexRegistry(params: LoadInstalledPluginI registry: loadPluginManifestRegistry({ config: params.config, workspaceDir: params.workspaceDir, - cache: false, env: params.env, candidates: params.candidates, diagnostics: params.diagnostics, @@ -26,7 +25,6 @@ export function resolveInstalledPluginIndexRegistry(params: LoadInstalledPluginI const discovery = discoverOpenClawPlugins({ workspaceDir: params.workspaceDir, extraPaths: normalized.loadPaths, - cache: params.cache, env: params.env, }); return { @@ -34,7 +32,6 @@ export function resolveInstalledPluginIndexRegistry(params: LoadInstalledPluginI registry: loadPluginManifestRegistry({ config: params.config, workspaceDir: params.workspaceDir, - cache: false, env: params.env, candidates: discovery.candidates, diagnostics: discovery.diagnostics, diff --git a/src/plugins/installed-plugin-index-types.ts b/src/plugins/installed-plugin-index-types.ts index 3c05812aa16..655797e4691 100644 --- a/src/plugins/installed-plugin-index-types.ts +++ b/src/plugins/installed-plugin-index-types.ts @@ -115,7 +115,6 @@ export type LoadInstalledPluginIndexParams = { stateDir?: string; pluginIndexFilePath?: string; installRecords?: Record; - cache?: boolean; candidates?: PluginCandidate[]; diagnostics?: PluginDiagnostic[]; now?: () => Date; diff --git a/src/plugins/installed-plugin-index.ts b/src/plugins/installed-plugin-index.ts index 44f82e52e1a..6cb0a7ad5d9 100644 --- a/src/plugins/installed-plugin-index.ts +++ b/src/plugins/installed-plugin-index.ts @@ -79,7 +79,7 @@ export function loadInstalledPluginIndex( export function refreshInstalledPluginIndex( params: RefreshInstalledPluginIndexParams, ): InstalledPluginIndex { - return buildInstalledPluginIndex({ ...params, cache: false, refreshReason: params.reason }); + return buildInstalledPluginIndex({ ...params, refreshReason: params.reason }); } export function listInstalledPluginRecords( diff --git a/src/plugins/loader.prefer-over.test.ts b/src/plugins/loader.prefer-over.test.ts index 530e382842a..8563143c922 100644 --- a/src/plugins/loader.prefer-over.test.ts +++ b/src/plugins/loader.prefer-over.test.ts @@ -3,9 +3,7 @@ import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import { applyPluginAutoEnable } from "../config/plugin-auto-enable.js"; -import { clearPluginDiscoveryCache } from "./discovery.js"; import { clearPluginLoaderCache, loadOpenClawPlugins } from "./loader.js"; -import { clearPluginManifestRegistryCache } from "./manifest-registry.js"; import { resetPluginRuntimeStateForTest } from "./runtime.js"; const tempDirs: string[] = []; @@ -89,8 +87,6 @@ function writeChannelToolPlugin(params: { afterEach(() => { clearPluginLoaderCache(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); resetPluginRuntimeStateForTest(); for (const dir of tempDirs.splice(0)) { fs.rmSync(dir, { recursive: true, force: true }); diff --git a/src/plugins/loader.test-fixtures.ts b/src/plugins/loader.test-fixtures.ts index 23edcda9e21..ab34a67f8fe 100644 --- a/src/plugins/loader.test-fixtures.ts +++ b/src/plugins/loader.test-fixtures.ts @@ -3,9 +3,7 @@ import os from "node:os"; import path from "node:path"; import { resetDiagnosticEventsForTest } from "../infra/diagnostic-events.js"; import { withEnv } from "../test-utils/env.js"; -import { clearPluginDiscoveryCache } from "./discovery.js"; import { clearPluginLoaderCache, loadOpenClawPlugins } from "./loader.js"; -import { clearPluginManifestRegistryCache } from "./manifest-registry.js"; import { resetPluginRuntimeStateForTest } from "./runtime.js"; export type TempPlugin = { dir: string; file: string; id: string }; @@ -141,8 +139,6 @@ export function loadBundleFixture(params: { export function resetPluginLoaderTestStateForTest() { clearPluginLoaderCache(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); resetPluginRuntimeStateForTest(); resetDiagnosticEventsForTest(); if (prevBundledDir === undefined) { diff --git a/src/plugins/loader.test.ts b/src/plugins/loader.test.ts index 6d71de6ba72..d82263b9456 100644 --- a/src/plugins/loader.test.ts +++ b/src/plugins/loader.test.ts @@ -922,7 +922,7 @@ describe("loadOpenClawPlugins", () => { allow: [plugin.id], }, }; - const manifestRegistry = loadPluginManifestRegistry({ config, cache: false }); + const manifestRegistry = loadPluginManifestRegistry({ config }); fs.rmSync(path.join(plugin.dir, "openclaw.plugin.json")); const registry = loadOpenClawPlugins({ diff --git a/src/plugins/loader.ts b/src/plugins/loader.ts index 9c276c794b0..f3c7db47fe5 100644 --- a/src/plugins/loader.ts +++ b/src/plugins/loader.ts @@ -2384,7 +2384,6 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi : discoverOpenClawPlugins({ workspaceDir: options.workspaceDir, extraPaths: normalized.loadPaths, - cache: options.cache, env, }); const manifestRegistry = @@ -2392,7 +2391,6 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi loadPluginManifestRegistry({ config: cfg, workspaceDir: options.workspaceDir, - cache: options.cache, env, candidates: discovery.candidates, diagnostics: discovery.diagnostics, @@ -3283,7 +3281,6 @@ export async function loadOpenClawPluginCliRegistry( } = resolvePluginLoadCacheContext({ ...options, activate: false, - cache: false, }); const logger = options.logger ?? defaultLogger(); const onlyPluginIdSet = createPluginIdScopeSet(onlyPluginIds); @@ -3301,13 +3298,11 @@ export async function loadOpenClawPluginCliRegistry( const discovery = discoverOpenClawPlugins({ workspaceDir: options.workspaceDir, extraPaths: normalized.loadPaths, - cache: false, env, }); const manifestRegistry = loadPluginManifestRegistry({ config: cfg, workspaceDir: options.workspaceDir, - cache: false, env, candidates: discovery.candidates, diagnostics: discovery.diagnostics, diff --git a/src/plugins/manifest-model-id-normalization.test.ts b/src/plugins/manifest-model-id-normalization.test.ts index 86fe448cbdf..9d84838f0ca 100644 --- a/src/plugins/manifest-model-id-normalization.test.ts +++ b/src/plugins/manifest-model-id-normalization.test.ts @@ -2,10 +2,7 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; -import { - clearManifestModelIdNormalizationCacheForTest, - normalizeProviderModelIdWithManifest, -} from "./manifest-model-id-normalization.js"; +import { normalizeProviderModelIdWithManifest } from "./manifest-model-id-normalization.js"; const ORIGINAL_ENV = { OPENCLAW_STATE_DIR: process.env.OPENCLAW_STATE_DIR, @@ -77,7 +74,6 @@ function normalizeDemoModel(modelId = "demo-model"): string | undefined { describe("manifest model id normalization", () => { afterEach(() => { - clearManifestModelIdNormalizationCacheForTest(); restoreEnv(); for (const dir of tempDirs.splice(0)) { fs.rmSync(dir, { recursive: true, force: true }); diff --git a/src/plugins/manifest-model-id-normalization.ts b/src/plugins/manifest-model-id-normalization.ts index 0dfe97a8e3f..9cfdbf30329 100644 --- a/src/plugins/manifest-model-id-normalization.ts +++ b/src/plugins/manifest-model-id-normalization.ts @@ -168,8 +168,3 @@ export function normalizeProviderModelIdWithManifest(params: { return modelId; } - -export function clearManifestModelIdNormalizationCacheForTest(): void { - // Manifest model-id normalization reads are intentionally uncached. - // Keep the test reset hook as a compatibility no-op. -} diff --git a/src/plugins/manifest-registry-installed.test.ts b/src/plugins/manifest-registry-installed.test.ts index 7adf784d9fe..41046ed402b 100644 --- a/src/plugins/manifest-registry-installed.test.ts +++ b/src/plugins/manifest-registry-installed.test.ts @@ -6,16 +6,12 @@ import { writePersistedInstalledPluginIndex, } from "./installed-plugin-index-store.js"; import type { InstalledPluginIndex } from "./installed-plugin-index.js"; -import { - clearInstalledManifestRegistryCache, - loadPluginManifestRegistryForInstalledIndex, -} from "./manifest-registry-installed.js"; +import { loadPluginManifestRegistryForInstalledIndex } from "./manifest-registry-installed.js"; import { cleanupTrackedTempDirs, makeTrackedTempDir } from "./test-helpers/fs-fixtures.js"; const tempDirs: string[] = []; afterEach(() => { - clearInstalledManifestRegistryCache(); cleanupTrackedTempDirs(tempDirs); }); diff --git a/src/plugins/manifest-registry-installed.ts b/src/plugins/manifest-registry-installed.ts index bc496f8d475..07138c127f1 100644 --- a/src/plugins/manifest-registry-installed.ts +++ b/src/plugins/manifest-registry-installed.ts @@ -86,11 +86,6 @@ export function resolveInstalledManifestRegistryIndexFingerprint( return hashJson(buildInstalledManifestRegistryIndexKey(index)); } -export function clearInstalledManifestRegistryCache(): void { - // Installed-index manifest registries are reconstructed on demand. Keep this - // reset hook as a compatibility no-op for older tests and callers. -} - function resolveInstalledPluginRootDir(record: InstalledPluginIndexRecord): string { return record.rootDir || path.dirname(record.manifestPath || process.cwd()); } @@ -191,7 +186,6 @@ export function loadPluginManifestRegistryForInstalledIndex(params: { config: params.config, workspaceDir: params.workspaceDir, env, - cache: false, candidates, diagnostics: [...diagnostics], installRecords: extractPluginInstallRecordsFromInstalledPluginIndex(params.index), diff --git a/src/plugins/manifest-registry-state.ts b/src/plugins/manifest-registry-state.ts deleted file mode 100644 index 699bf6a3b0a..00000000000 --- a/src/plugins/manifest-registry-state.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function clearPluginManifestRegistryCache(): void { - // Manifest registry loads are intentionally uncached. Keep this legacy hook - // as a compatibility no-op for tests and older reset call sites. -} diff --git a/src/plugins/manifest-registry.test.ts b/src/plugins/manifest-registry.test.ts index 50b13198fb3..217cdb3e3b6 100644 --- a/src/plugins/manifest-registry.test.ts +++ b/src/plugins/manifest-registry.test.ts @@ -4,10 +4,7 @@ import { afterEach, describe, expect, it, vi } from "vitest"; import { collectChannelSchemaMetadata } from "../config/channel-config-metadata.js"; import { collectBundledChannelConfigs } from "./bundled-channel-config-metadata.js"; import type { PluginCandidate } from "./discovery.js"; -import { - clearPluginManifestRegistryCache, - loadPluginManifestRegistry, -} from "./manifest-registry.js"; +import { loadPluginManifestRegistry } from "./manifest-registry.js"; import type { OpenClawPackageManifest } from "./manifest.js"; import { cleanupTrackedTempDirs, makeTrackedTempDir } from "./test-helpers/fs-fixtures.js"; @@ -87,7 +84,6 @@ function createPluginCandidate(params: { function loadRegistry(candidates: PluginCandidate[]) { return loadPluginManifestRegistry({ candidates, - cache: false, }); } @@ -175,7 +171,6 @@ function loadRegistryForMinHostVersionCase(params: { env?: NodeJS.ProcessEnv; }) { return loadPluginManifestRegistry({ - cache: false, ...(params.env ? { env: params.env } : {}), candidates: [ createPluginCandidate({ @@ -226,7 +221,6 @@ function createDuplicateCandidateRegistry(params: { writeManifest(duplicateDir, manifest); return loadPluginManifestRegistry({ - cache: false, candidates: [ createPluginCandidate({ idHint: params.pluginId, @@ -306,7 +300,6 @@ function expectCachedPluginRoot(params: { afterEach(() => { vi.restoreAllMocks(); - clearPluginManifestRegistryCache(); cleanupTrackedTempDirs(tempDirs); }); @@ -415,7 +408,6 @@ describe("loadPluginManifestRegistry", () => { writeManifest(globalDir, manifest); const registry = loadPluginManifestRegistry({ - cache: false, installRecords: { zalouser: { source: "npm", @@ -449,7 +441,6 @@ describe("loadPluginManifestRegistry", () => { writeManifest(globalDir, manifest); const registry = loadPluginManifestRegistry({ - cache: false, installRecords: { zalouser: { source: "npm", @@ -861,7 +852,6 @@ describe("loadPluginManifestRegistry", () => { }); const registry = loadPluginManifestRegistry({ - cache: false, bundledChannelConfigCollector: collectBundledChannelConfigs, candidates: [candidate], }); @@ -1814,7 +1804,6 @@ describe("loadPluginManifestRegistry", () => { }; const first = loadPluginManifestRegistry({ - cache: true, config, env: hermeticEnv({ HOME: homeA, @@ -1823,7 +1812,6 @@ describe("loadPluginManifestRegistry", () => { }), }); const second = loadPluginManifestRegistry({ - cache: true, config, env: hermeticEnv({ HOME: homeB, @@ -1861,14 +1849,12 @@ describe("loadPluginManifestRegistry", () => { ]; const olderHost = loadPluginManifestRegistry({ - cache: true, candidates, env: hermeticEnv({ OPENCLAW_VERSION: "2026.3.21", }), }); const newerHost = loadPluginManifestRegistry({ - cache: true, candidates, env: hermeticEnv({ OPENCLAW_VERSION: "2026.3.22", diff --git a/src/plugins/manifest-registry.ts b/src/plugins/manifest-registry.ts index c1e91c0f8f5..26ebd1f30c2 100644 --- a/src/plugins/manifest-registry.ts +++ b/src/plugins/manifest-registry.ts @@ -163,8 +163,6 @@ export type BundledChannelConfigCollector = (params: { packageManifest?: OpenClawPackageManifest; }) => Record | undefined; -export { clearPluginManifestRegistryCache } from "./manifest-registry-state.js"; - function safeStatMtimeMs(filePath: string): number | null { try { return fs.statSync(filePath).mtimeMs; @@ -532,7 +530,6 @@ export function loadPluginManifestRegistry( params: { config?: OpenClawConfig; workspaceDir?: string; - cache?: boolean; env?: NodeJS.ProcessEnv; candidates?: PluginCandidate[]; diagnostics?: PluginDiagnostic[]; @@ -552,7 +549,6 @@ export function loadPluginManifestRegistry( : discoverOpenClawPlugins({ workspaceDir: params.workspaceDir, extraPaths: normalized.loadPaths, - cache: params.cache, env, }); const diagnostics: PluginDiagnostic[] = [...discovery.diagnostics]; diff --git a/src/plugins/plugin-registry-snapshot.ts b/src/plugins/plugin-registry-snapshot.ts index d694d52237a..d1292f8ec8a 100644 --- a/src/plugins/plugin-registry-snapshot.ts +++ b/src/plugins/plugin-registry-snapshot.ts @@ -44,11 +44,6 @@ export type PluginRegistrySnapshotResult = { diagnostics: readonly PluginRegistrySnapshotDiagnostic[]; }; -export function clearPluginRegistrySnapshotCache(): void { - // Derived plugin registry snapshots are intentionally uncached. Keep the - // reset hook as a compatibility no-op for older callers. -} - export const DISABLE_PERSISTED_PLUGIN_REGISTRY_ENV = "OPENCLAW_DISABLE_PERSISTED_PLUGIN_REGISTRY"; function formatDeprecatedPersistedRegistryDisableWarning(): string { diff --git a/src/plugins/provider-hook-runtime.ts b/src/plugins/provider-hook-runtime.ts index d072c54f6c2..07140865ef9 100644 --- a/src/plugins/provider-hook-runtime.ts +++ b/src/plugins/provider-hook-runtime.ts @@ -32,17 +32,6 @@ function matchesProviderLiteralId(provider: ProviderPlugin, providerId: string): return !!normalized && normalizeLowercaseStringOrEmpty(provider.id) === normalized; } -export function clearProviderRuntimeHookCache(): void { - // Provider hook lookup is intentionally uncached. Keep the reset hook as a - // compatibility no-op for callers that still clear plugin runtime state. -} - -export function resetProviderRuntimeHookCacheForTest(): void { - clearProviderRuntimeHookCache(); -} - -export const __testing = {} as const; - export function resolveProviderPluginsForHooks(params: { config?: OpenClawConfig; workspaceDir?: string; diff --git a/src/plugins/provider-public-artifacts.ts b/src/plugins/provider-public-artifacts.ts index a3595a15b69..e33e74a2547 100644 --- a/src/plugins/provider-public-artifacts.ts +++ b/src/plugins/provider-public-artifacts.ts @@ -53,11 +53,6 @@ function tryLoadBundledProviderPolicySurface( return null; } -export function clearBundledProviderPolicySurfaceCache(): void { - // Public provider policy surfaces are resolved fresh. The underlying module - // loader owns import reuse. -} - export function resolveBundledProviderPolicySurface( providerId: string, ): BundledProviderPolicySurface | null { diff --git a/src/plugins/provider-runtime.synthetic-auth-discovery.test.ts b/src/plugins/provider-runtime.synthetic-auth-discovery.test.ts index c2cfe091c16..be20ee643eb 100644 --- a/src/plugins/provider-runtime.synthetic-auth-discovery.test.ts +++ b/src/plugins/provider-runtime.synthetic-auth-discovery.test.ts @@ -40,9 +40,7 @@ vi.mock("./provider-hook-runtime.js", async (importOriginal) => { return { ...actual, __testing: {}, - clearProviderRuntimeHookCache: vi.fn(), prepareProviderExtraParams: vi.fn(), - resetProviderRuntimeHookCacheForTest: vi.fn(), resolveProviderHookPlugin: vi.fn(), resolveProviderPluginsForHooks: vi.fn(() => []), resolveProviderRuntimePlugin, diff --git a/src/plugins/provider-runtime.test.ts b/src/plugins/provider-runtime.test.ts index 1d5589565c3..163e479a6cd 100644 --- a/src/plugins/provider-runtime.test.ts +++ b/src/plugins/provider-runtime.test.ts @@ -87,7 +87,6 @@ let inspectProviderToolSchemasWithPlugin: typeof import("./provider-runtime.js") let normalizeProviderResolvedModelWithPlugin: typeof import("./provider-runtime.js").normalizeProviderResolvedModelWithPlugin; let prepareProviderDynamicModel: typeof import("./provider-runtime.js").prepareProviderDynamicModel; let prepareProviderRuntimeAuth: typeof import("./provider-runtime.js").prepareProviderRuntimeAuth; -let resetProviderRuntimeHookCacheForTest: typeof import("./provider-runtime.js").resetProviderRuntimeHookCacheForTest; let refreshProviderOAuthCredentialWithPlugin: typeof import("./provider-runtime.js").refreshProviderOAuthCredentialWithPlugin; let resolveProviderRuntimePlugin: typeof import("./provider-runtime.js").resolveProviderRuntimePlugin; let providerRuntimeTesting: typeof import("./provider-runtime.js").__testing; @@ -309,7 +308,6 @@ describe("provider-runtime", () => { normalizeProviderResolvedModelWithPlugin, prepareProviderDynamicModel, prepareProviderRuntimeAuth, - resetProviderRuntimeHookCacheForTest, refreshProviderOAuthCredentialWithPlugin, resolveProviderRuntimePlugin, __testing: providerRuntimeTesting, @@ -320,9 +318,7 @@ describe("provider-runtime", () => { }); beforeEach(() => { - resetProviderRuntimeHookCacheForTest(); providerRuntimeTesting.resetExternalAuthFallbackWarningCacheForTest(); - providerRuntimeTesting.resetCatalogHookProvidersCacheForTest(); resolvePluginProvidersMock.mockReset(); resolvePluginProvidersMock.mockReturnValue([]); isPluginProvidersLoadInFlightMock.mockReset(); @@ -372,7 +368,7 @@ describe("provider-runtime", () => { }); }); - it("keeps provider-ref owner plugin config in provider hook cache keys", () => { + it("uses current provider-ref owner plugin config for provider hooks", () => { const provider: ProviderPlugin = { id: DEMO_PROVIDER_ID, label: "Demo", diff --git a/src/plugins/provider-runtime.ts b/src/plugins/provider-runtime.ts index 23ddfdad046..b357d36fb93 100644 --- a/src/plugins/provider-runtime.ts +++ b/src/plugins/provider-runtime.ts @@ -14,8 +14,6 @@ import { sanitizeForLog } from "../terminal/ansi.js"; import { normalizeProviderModelIdWithManifest } from "./manifest-model-id-normalization.js"; import { resolvePluginDiscoveryProvidersRuntime } from "./provider-discovery.runtime.js"; import { - __testing as providerHookRuntimeTesting, - clearProviderRuntimeHookCache as clearProviderHookRuntimeCache, prepareProviderExtraParams, resolveProviderAuthProfileId, resolveProviderExtraParamsForTransport, @@ -139,25 +137,6 @@ function resetExternalAuthFallbackWarningCacheForTest(): void { warnedExternalAuthFallbackPluginIds.clear(); } -function resetCatalogHookProvidersCacheForTest(): void { - // Catalog hook providers are intentionally resolved from current metadata on - // each call. Keep the test hook as a compatibility no-op. -} - -function clearCatalogHookProviderIdCache(): void { - // Catalog hook provider ids are intentionally uncached. -} - -export function clearProviderRuntimeHookCache(): void { - resetCatalogHookProvidersCacheForTest(); - clearCatalogHookProviderIdCache(); - clearProviderHookRuntimeCache(); -} - -export function resetProviderRuntimeHookCacheForTest(): void { - clearProviderRuntimeHookCache(); -} - export { prepareProviderExtraParams, resolveProviderAuthProfileId, @@ -168,10 +147,7 @@ export { }; export const __testing = { - ...providerHookRuntimeTesting, resetExternalAuthFallbackWarningCacheForTest, - resetCatalogHookProvidersCacheForTest, - resetProviderRuntimeHookCacheForTest, } as const; function resolveProviderPluginsForCatalogHooks(params: { diff --git a/src/plugins/providers.test.ts b/src/plugins/providers.test.ts index 0f9b2757ffa..be42f8dc5ac 100644 --- a/src/plugins/providers.test.ts +++ b/src/plugins/providers.test.ts @@ -29,7 +29,6 @@ let resolveDiscoveredProviderPluginIds: typeof import("./providers.js").resolveD let resolveDiscoverableProviderOwnerPluginIds: typeof import("./providers.js").resolveDiscoverableProviderOwnerPluginIds; let resolvePluginProviders: typeof import("./providers.runtime.js").resolvePluginProviders; let setActivePluginRegistry: SetActivePluginRegistry; -let clearPluginRegistrySnapshotCache: typeof import("./plugin-registry-snapshot.js").clearPluginRegistrySnapshotCache; function createManifestProviderPlugin(params: { id: string; @@ -310,7 +309,6 @@ describe("resolvePluginProviders", () => { } = await import("./providers.js")); ({ resolvePluginProviders } = await import("./providers.runtime.js")); ({ setActivePluginRegistry } = await import("./runtime.js")); - ({ clearPluginRegistrySnapshotCache } = await import("./plugin-registry-snapshot.js")); }); it("maps cli backend ids to owning plugin ids via manifests", () => { @@ -340,7 +338,6 @@ describe("resolvePluginProviders", () => { }); beforeEach(() => { - clearPluginRegistrySnapshotCache(); setActivePluginRegistry(createEmptyPluginRegistry()); resolveRuntimePluginRegistryMock.mockReset(); loadOpenClawPluginsMock.mockReset(); diff --git a/src/plugins/providers.ts b/src/plugins/providers.ts index a56f1c35442..aabfb1710d3 100644 --- a/src/plugins/providers.ts +++ b/src/plugins/providers.ts @@ -428,10 +428,6 @@ function dedupeSortedPluginIds(values: Iterable): string[] { return [...new Set(values)].toSorted((left, right) => left.localeCompare(right)); } -export function resetProviderOwnerPluginIdsCacheForTest(): void { - // Provider ownership is manifest-derived and intentionally read fresh. -} - function resolvePreferredManifestPluginIds( registry: PluginManifestRegistry, matchedPluginIds: readonly string[], diff --git a/src/plugins/runtime/runtime-plugin-boundary.ts b/src/plugins/runtime/runtime-plugin-boundary.ts index 56e0cbfcede..cd9d485f4ac 100644 --- a/src/plugins/runtime/runtime-plugin-boundary.ts +++ b/src/plugins/runtime/runtime-plugin-boundary.ts @@ -32,7 +32,6 @@ export function resolvePluginRuntimeRecord( ): PluginRuntimeRecord | null { const manifestRegistry = loadPluginManifestRegistry({ config: readPluginBoundaryConfigSafely(), - cache: true, }); const record = manifestRegistry.plugins.find((plugin) => plugin.id === pluginId); if (!record?.source) { @@ -54,7 +53,6 @@ export function resolvePluginRuntimeRecordByEntryBaseNames( ): PluginRuntimeRecord | null { const manifestRegistry = loadPluginManifestRegistry({ config: readPluginBoundaryConfigSafely(), - cache: true, }); const matches = manifestRegistry.plugins.filter((plugin) => { if (!plugin?.source) { diff --git a/src/plugins/setup-registry.runtime.test.ts b/src/plugins/setup-registry.runtime.test.ts index 189145db1a4..d180bd16196 100644 --- a/src/plugins/setup-registry.runtime.test.ts +++ b/src/plugins/setup-registry.runtime.test.ts @@ -61,7 +61,7 @@ describe("setup-registry runtime fallback", () => { expect(resolvePluginSetupCliBackendRuntime({ backend: "local-cli" })).toBeUndefined(); expect(resolvePluginSetupCliBackendRuntime({ backend: "disabled-cli" })).toBeUndefined(); expect(loadPluginRegistrySnapshotMock).toHaveBeenCalledTimes(3); - expect(loadPluginRegistrySnapshotMock).toHaveBeenCalledWith({ cache: true }); + expect(loadPluginRegistrySnapshotMock).toHaveBeenCalledWith({}); expect(loadPluginManifestRegistryForInstalledIndexMock).toHaveBeenCalledWith({ index: expect.objectContaining({ plugins: expect.arrayContaining([expect.objectContaining({ pluginId: "openai" })]), diff --git a/src/plugins/setup-registry.runtime.ts b/src/plugins/setup-registry.runtime.ts index 591c130064b..4846755ea75 100644 --- a/src/plugins/setup-registry.runtime.ts +++ b/src/plugins/setup-registry.runtime.ts @@ -30,7 +30,7 @@ export const __testing = { }; function resolveBundledSetupCliBackends(): SetupCliBackendRuntimeEntry[] { - const index = loadPluginRegistrySnapshot({ cache: true }); + const index = loadPluginRegistrySnapshot({}); return loadPluginManifestRegistryForInstalledIndex({ index, }).plugins.flatMap((plugin) => { diff --git a/src/plugins/stage-bundled-plugin-runtime.test.ts b/src/plugins/stage-bundled-plugin-runtime.test.ts index 0c482852fdb..32f5345eab0 100644 --- a/src/plugins/stage-bundled-plugin-runtime.test.ts +++ b/src/plugins/stage-bundled-plugin-runtime.test.ts @@ -454,11 +454,9 @@ describe("stageBundledPluginRuntime", () => { }; const discovery = discoverOpenClawPlugins({ env, - cache: false, }); const manifestRegistry = loadPluginManifestRegistry({ env, - cache: false, candidates: discovery.candidates, diagnostics: discovery.diagnostics, }); diff --git a/src/plugins/status.registry-snapshot.test.ts b/src/plugins/status.registry-snapshot.test.ts index 6cc5dd43ed0..eaddf388bb7 100644 --- a/src/plugins/status.registry-snapshot.test.ts +++ b/src/plugins/status.registry-snapshot.test.ts @@ -1,7 +1,5 @@ import fs from "node:fs"; import { afterEach, describe, expect, it } from "vitest"; -import { clearPluginDiscoveryCache } from "./discovery.js"; -import { clearPluginManifestRegistryCache } from "./manifest-registry.js"; import { refreshPluginRegistry } from "./plugin-registry.js"; import { buildPluginRegistrySnapshotReport, buildPluginSnapshotReport } from "./status.js"; import { @@ -19,8 +17,6 @@ function makeTempDir() { } afterEach(() => { - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); cleanupTrackedTempDirs(tempDirs); }); diff --git a/src/plugins/synthetic-auth.runtime.test.ts b/src/plugins/synthetic-auth.runtime.test.ts index fb215504b13..572d2c3efed 100644 --- a/src/plugins/synthetic-auth.runtime.test.ts +++ b/src/plugins/synthetic-auth.runtime.test.ts @@ -58,9 +58,7 @@ describe("synthetic auth runtime refs", () => { "local-cli", "remote-provider", ]); - expect(pluginRegistryMocks.loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledWith({ - cache: true, - }); + expect(pluginRegistryMocks.loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledWith({}); }); it("does not derive the registry just to resolve synthetic auth refs", () => { diff --git a/src/plugins/synthetic-auth.runtime.ts b/src/plugins/synthetic-auth.runtime.ts index b8d6b4b1c46..0a5b6cc3439 100644 --- a/src/plugins/synthetic-auth.runtime.ts +++ b/src/plugins/synthetic-auth.runtime.ts @@ -18,7 +18,7 @@ function uniqueProviderRefs(values: readonly string[]): string[] { } function resolveManifestSyntheticAuthProviderRefs(): string[] { - const result = loadPluginRegistrySnapshotWithMetadata({ cache: true }); + const result = loadPluginRegistrySnapshotWithMetadata({}); if (result.source !== "persisted" && result.source !== "provided") { return []; } diff --git a/src/plugins/web-fetch-providers.runtime.test.ts b/src/plugins/web-fetch-providers.runtime.test.ts index 09ce1934136..c6ec39a141b 100644 --- a/src/plugins/web-fetch-providers.runtime.test.ts +++ b/src/plugins/web-fetch-providers.runtime.test.ts @@ -13,7 +13,6 @@ let webFetchProvidersSharedModule: WebFetchProvidersSharedModule; let loadOpenClawPluginsMock: ReturnType; let setActivePluginRegistry: RuntimeModule["setActivePluginRegistry"]; let resolvePluginWebFetchProviders: WebFetchProvidersRuntimeModule["resolvePluginWebFetchProviders"]; -let resetWebFetchProviderSnapshotCacheForTests: WebFetchProvidersRuntimeModule["__testing"]["resetWebFetchProviderSnapshotCacheForTests"]; const DEFAULT_WORKSPACE = "/tmp/workspace"; @@ -100,14 +99,10 @@ describe("resolvePluginWebFetchProviders", () => { manifestRegistryModule = await import("./manifest-registry.js"); webFetchProvidersSharedModule = await import("./web-fetch-providers.shared.js"); ({ setActivePluginRegistry } = await import("./runtime.js")); - ({ - resolvePluginWebFetchProviders, - __testing: { resetWebFetchProviderSnapshotCacheForTests }, - } = await import("./web-fetch-providers.runtime.js")); + ({ resolvePluginWebFetchProviders } = await import("./web-fetch-providers.runtime.js")); }); beforeEach(() => { - resetWebFetchProviderSnapshotCacheForTests(); vi.spyOn(manifestRegistryModule, "loadPluginManifestRegistry").mockReturnValue( createManifestRegistryFixture() as ManifestRegistryModule["loadPluginManifestRegistry"] extends ( ...args: unknown[] diff --git a/src/plugins/web-fetch-providers.runtime.ts b/src/plugins/web-fetch-providers.runtime.ts index bd0e91b4ad7..32e0bd4dfda 100644 --- a/src/plugins/web-fetch-providers.runtime.ts +++ b/src/plugins/web-fetch-providers.runtime.ts @@ -16,15 +16,6 @@ import { resolveRuntimeWebProviders, } from "./web-provider-runtime-shared.js"; -function resetWebFetchProviderSnapshotCacheForTests() { - // Web provider snapshots are no longer memoized. Keep the test hook as a - // compatibility no-op for older reset paths. -} - -export const __testing = { - resetWebFetchProviderSnapshotCacheForTests, -} as const; - function resolveWebFetchCandidatePluginIds(params: { config?: PluginLoadOptions["config"]; workspaceDir?: string; diff --git a/src/plugins/web-search-providers.runtime.test.ts b/src/plugins/web-search-providers.runtime.test.ts index f579f823237..473b7cb24b7 100644 --- a/src/plugins/web-search-providers.runtime.test.ts +++ b/src/plugins/web-search-providers.runtime.test.ts @@ -25,8 +25,6 @@ let loadPluginManifestRegistryMock: ReturnType; let setActivePluginRegistry: RuntimeModule["setActivePluginRegistry"]; let resolvePluginWebSearchProviders: WebSearchProvidersRuntimeModule["resolvePluginWebSearchProviders"]; let resolveRuntimeWebSearchProviders: WebSearchProvidersRuntimeModule["resolveRuntimeWebSearchProviders"]; -let resetWebSearchProviderSnapshotCacheForTests: WebSearchProvidersRuntimeModule["__testing"]["resetWebSearchProviderSnapshotCacheForTests"]; -let clearInstalledManifestRegistryCache: InstalledManifestRegistryModule["clearInstalledManifestRegistryCache"]; let loadOpenClawPluginsMock: ReturnType; let loaderModule: typeof import("./loader.js"); let manifestRegistryModule: ManifestRegistryModule; @@ -324,18 +322,12 @@ describe("resolvePluginWebSearchProviders", () => { loaderModule = await import("./loader.js"); pluginAutoEnableModule = await import("../config/plugin-auto-enable.js"); webSearchProvidersSharedModule = await import("./web-search-providers.shared.js"); - ({ clearInstalledManifestRegistryCache } = await import("./manifest-registry-installed.js")); ({ setActivePluginRegistry } = await import("./runtime.js")); - ({ - resolvePluginWebSearchProviders, - resolveRuntimeWebSearchProviders, - __testing: { resetWebSearchProviderSnapshotCacheForTests }, - } = await import("./web-search-providers.runtime.js")); + ({ resolvePluginWebSearchProviders, resolveRuntimeWebSearchProviders } = + await import("./web-search-providers.runtime.js")); }); beforeEach(() => { - resetWebSearchProviderSnapshotCacheForTests(); - clearInstalledManifestRegistryCache(); applyPluginAutoEnableSpy?.mockRestore(); applyPluginAutoEnableSpy = vi .spyOn(pluginAutoEnableModule, "applyPluginAutoEnable") @@ -368,7 +360,6 @@ describe("resolvePluginWebSearchProviders", () => { }); afterEach(() => { - clearInstalledManifestRegistryCache(); setActivePluginRegistry(createEmptyPluginRegistry()); vi.restoreAllMocks(); }); diff --git a/src/plugins/web-search-providers.runtime.ts b/src/plugins/web-search-providers.runtime.ts index 8ad7324e55d..2f6200af360 100644 --- a/src/plugins/web-search-providers.runtime.ts +++ b/src/plugins/web-search-providers.runtime.ts @@ -16,15 +16,6 @@ import { sortWebSearchProviders, } from "./web-search-providers.shared.js"; -function resetWebSearchProviderSnapshotCacheForTests() { - // Web provider snapshots are no longer memoized. Keep the test hook as a - // compatibility no-op for older reset paths. -} - -export const __testing = { - resetWebSearchProviderSnapshotCacheForTests, -} as const; - function resolveWebSearchCandidatePluginIds(params: { config?: PluginLoadOptions["config"]; workspaceDir?: string; diff --git a/src/secrets/runtime-config-collectors-plugins.bundled.test.ts b/src/secrets/runtime-config-collectors-plugins.bundled.test.ts index 5bdd9c95499..8bced25758e 100644 --- a/src/secrets/runtime-config-collectors-plugins.bundled.test.ts +++ b/src/secrets/runtime-config-collectors-plugins.bundled.test.ts @@ -47,7 +47,6 @@ describe("collectPluginConfigAssignments bundled plugin manifests", () => { config, workspaceDir: resolveAgentWorkspaceDir(config, resolveDefaultAgentId(config)), env: {}, - cache: true, fallbackToBundledMetadata: true, fallbackToBundledMetadataForResolvedBundled: true, pluginIds: ["voice-call"], diff --git a/src/secrets/runtime-config-collectors-plugins.ts b/src/secrets/runtime-config-collectors-plugins.ts index 72a8960e1a3..2da2d46870d 100644 --- a/src/secrets/runtime-config-collectors-plugins.ts +++ b/src/secrets/runtime-config-collectors-plugins.ts @@ -49,7 +49,6 @@ export function collectPluginConfigAssignments(params: { config: params.config, workspaceDir, env: params.context.env, - cache: true, fallbackToBundledMetadata: true, fallbackToBundledMetadataForResolvedBundled: true, fallbackBundledPluginIds: bundledLoadablePluginIds, diff --git a/src/secrets/runtime.integration.test-helpers.ts b/src/secrets/runtime.integration.test-helpers.ts index a9a061c88f2..3f6bb18e7a8 100644 --- a/src/secrets/runtime.integration.test-helpers.ts +++ b/src/secrets/runtime.integration.test-helpers.ts @@ -1,10 +1,6 @@ import { vi } from "vitest"; import { clearConfigCache, clearRuntimeConfigSnapshot } from "../config/config.js"; -import { clearPluginDiscoveryCache } from "../plugins/discovery.js"; import { clearPluginLoaderCache } from "../plugins/loader.js"; -import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; -import { __testing as webFetchProvidersTesting } from "../plugins/web-fetch-providers.runtime.js"; -import { __testing as webSearchProvidersTesting } from "../plugins/web-search-providers.runtime.js"; import { captureEnv } from "../test-utils/env.js"; import type { SecretsRuntimeEnvSnapshot } from "./runtime-openai-file-fixture.test-helper.js"; export { @@ -40,8 +36,4 @@ export function endSecretsRuntimeIsolationForTest(envSnapshot: SecretsRuntimeEnv clearRuntimeConfigSnapshot(); clearConfigCache(); clearPluginLoaderCache(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); - webSearchProvidersTesting.resetWebSearchProviderSnapshotCacheForTests(); - webFetchProvidersTesting.resetWebFetchProviderSnapshotCacheForTests(); } diff --git a/src/secrets/runtime.ts b/src/secrets/runtime.ts index b59f15f30dc..3f04672502c 100644 --- a/src/secrets/runtime.ts +++ b/src/secrets/runtime.ts @@ -145,7 +145,6 @@ async function resolveLoadablePluginOrigins(params: { const index = loadPluginRegistrySnapshot({ config: params.config, workspaceDir, - cache: true, env: params.env, }); const manifestRegistry = loadPluginManifestRegistryForInstalledIndex({ diff --git a/src/security/dangerous-config-flags.ts b/src/security/dangerous-config-flags.ts index e14e46bae98..eb43e588f3e 100644 --- a/src/security/dangerous-config-flags.ts +++ b/src/security/dangerous-config-flags.ts @@ -17,7 +17,6 @@ export function collectEnabledInsecureOrDangerousFlags(cfg: OpenClawConfig): str config: cfg, workspaceDir: resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg)), env: process.env, - cache: true, pluginIds: Object.keys(pluginEntries), }); return collectEnabledInsecureOrDangerousFlagsFromContracts(cfg, { diff --git a/test/helpers/auto-reply/trigger-handling-test-harness.ts b/test/helpers/auto-reply/trigger-handling-test-harness.ts index f83f8ed6423..177ad51075a 100644 --- a/test/helpers/auto-reply/trigger-handling-test-harness.ts +++ b/test/helpers/auto-reply/trigger-handling-test-harness.ts @@ -6,7 +6,6 @@ import { afterAll, afterEach, beforeAll, expect, vi } from "vitest"; import { clearRuntimeAuthProfileStoreSnapshots } from "../../../src/agents/auth-profiles.js"; import { withFastReplyConfig } from "../../../src/auto-reply/reply/get-reply-fast-path.js"; import type { OpenClawConfig } from "../../../src/config/types.openclaw.js"; -import { resetProviderRuntimeHookCacheForTest } from "../../../src/plugins/provider-runtime.js"; // Avoid exporting vitest mock types (TS2742 under pnpm + d.ts emit). type AnyMock = any; @@ -447,7 +446,6 @@ export async function expectBareNewOrResetAcknowledged(params: { export function installTriggerHandlingE2eTestHooks() { afterEach(() => { clearRuntimeAuthProfileStoreSnapshots(); - resetProviderRuntimeHookCacheForTest(); vi.clearAllMocks(); }); } diff --git a/test/setup-openclaw-runtime.ts b/test/setup-openclaw-runtime.ts index e7c7e5e248a..5b674f967a3 100644 --- a/test/setup-openclaw-runtime.ts +++ b/test/setup-openclaw-runtime.ts @@ -23,8 +23,6 @@ type WorkerPluginRuntimeHelpers = { setActivePluginRegistry: typeof import("../src/plugins/runtime.js").setActivePluginRegistry; }; type WorkerCleanupHelpers = { - clearPluginDiscoveryCache: typeof import("../src/plugins/discovery.js").clearPluginDiscoveryCache; - clearPluginManifestRegistryCache: typeof import("../src/plugins/manifest-registry-state.js").clearPluginManifestRegistryCache; clearSessionStoreCaches: typeof import("../src/config/sessions/store-cache.js").clearSessionStoreCaches; drainFileLockStateForTest: typeof import("../src/infra/file-lock.js").drainFileLockStateForTest; drainSessionStoreLockQueuesForTest: typeof import("../src/config/sessions/store-lock-state.js").drainSessionStoreLockQueuesForTest; @@ -86,10 +84,6 @@ function loadWorkerCleanupHelpers(): Promise { "../src/config/sessions/store-lock-state.js", ), vi.importActual("../src/infra/file-lock.js"), - vi.importActual("../src/plugins/discovery.js"), - vi.importActual( - "../src/plugins/manifest-registry-state.js", - ), ]).then( ([ contextRuntimeState, @@ -98,11 +92,7 @@ function loadWorkerCleanupHelpers(): Promise { sessionStoreCache, sessionStoreLockState, fileLock, - discovery, - manifestRegistryState, ]) => ({ - clearPluginDiscoveryCache: discovery.clearPluginDiscoveryCache, - clearPluginManifestRegistryCache: manifestRegistryState.clearPluginManifestRegistryCache, clearSessionStoreCaches: sessionStoreCache.clearSessionStoreCaches, drainFileLockStateForTest: fileLock.drainFileLockStateForTest, drainSessionStoreLockQueuesForTest: sessionStoreLockState.drainSessionStoreLockQueuesForTest, @@ -401,8 +391,6 @@ beforeAll(async () => { afterEach(async () => { const { - clearPluginDiscoveryCache, - clearPluginManifestRegistryCache, clearSessionStoreCaches, drainFileLockStateForTest, drainSessionStoreLockQueuesForTest, @@ -420,22 +408,13 @@ afterEach(async () => { resetContextWindowCacheForTest(); resetModelsJsonReadyCacheForTest(); resetSessionWriteLockStateForTest(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); await installDefaultPluginRegistry(); }); afterAll(async () => { - const { - clearPluginDiscoveryCache, - clearPluginManifestRegistryCache, - clearSessionStoreCaches, - drainFileLockStateForTest, - drainSessionWriteLockStateForTest, - } = await loadWorkerCleanupHelpers(); + const { clearSessionStoreCaches, drainFileLockStateForTest, drainSessionWriteLockStateForTest } = + await loadWorkerCleanupHelpers(); clearSessionStoreCaches(); await drainFileLockStateForTest(); await drainSessionWriteLockStateForTest(); - clearPluginDiscoveryCache(); - clearPluginManifestRegistryCache(); });