diff --git a/src/config/plugin-auto-enable.shared.ts b/src/config/plugin-auto-enable.shared.ts index 41dd7ea5910..cb9d2a2e18e 100644 --- a/src/config/plugin-auto-enable.shared.ts +++ b/src/config/plugin-auto-enable.shared.ts @@ -2,6 +2,7 @@ import { collectConfiguredAgentHarnessRuntimes } from "../agents/harness-runtime import { normalizeProviderId } from "../agents/provider-id.js"; import { listPotentialConfiguredChannelPresenceSignals } from "../channels/config-presence.js"; import { getChatChannelMeta, normalizeChatChannelId } from "../channels/registry.js"; +import { getCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js"; import { type PluginManifestRecord, type PluginManifestRegistry, @@ -886,14 +887,23 @@ export function resolvePluginAutoEnableManifestRegistry(params: { env: NodeJS.ProcessEnv; manifestRegistry?: PluginManifestRegistry; }): PluginManifestRegistry { + if (params.manifestRegistry) { + return params.manifestRegistry; + } + if (!configMayNeedPluginManifestRegistry(params.config, params.env)) { + return EMPTY_PLUGIN_MANIFEST_REGISTRY; + } + const currentSnapshot = getCurrentPluginMetadataSnapshot({ + config: params.config, + env: params.env, + allowWorkspaceScopedSnapshot: true, + }); return ( - params.manifestRegistry ?? - (configMayNeedPluginManifestRegistry(params.config, params.env) - ? loadPluginMetadataSnapshot({ - config: params.config, - env: params.env, - }).manifestRegistry - : EMPTY_PLUGIN_MANIFEST_REGISTRY) + currentSnapshot?.manifestRegistry ?? + loadPluginMetadataSnapshot({ + config: params.config, + env: params.env, + }).manifestRegistry ); }