perf: avoid no-op plugin auto-enable scans

This commit is contained in:
Peter Steinberger
2026-05-06 06:53:51 +01:00
parent 5da9f5e57c
commit 1672d35ef5
2 changed files with 11 additions and 5 deletions

View File

@@ -18,6 +18,15 @@ export function materializePluginAutoEnableCandidates(params: {
}): PluginAutoEnableResult {
const env = params.env ?? process.env;
const config = params.config ?? {};
const entries = config.plugins?.entries;
const hasRestrictiveAllowlistWithEntries =
Array.isArray(config.plugins?.allow) &&
config.plugins.allow.length > 0 &&
entries !== undefined &&
typeof entries === "object";
if (params.candidates.length === 0 && !hasRestrictiveAllowlistWithEntries) {
return { config, changes: [], autoEnabledReasons: {} };
}
const manifestRegistry = resolvePluginAutoEnableManifestRegistry({
config,
env,

View File

@@ -1,9 +1,6 @@
import { collectConfiguredAgentHarnessRuntimes } from "../agents/harness-runtimes.js";
import { normalizeProviderId } from "../agents/provider-id.js";
import {
hasPotentialConfiguredChannels,
listPotentialConfiguredChannelPresenceSignals,
} from "../channels/config-presence.js";
import { listPotentialConfiguredChannelPresenceSignals } from "../channels/config-presence.js";
import { getChatChannelMeta, normalizeChatChannelId } from "../channels/registry.js";
import {
type PluginManifestRecord,
@@ -493,7 +490,7 @@ export function configMayNeedPluginAutoEnable(
if (hasConfiguredPluginConfigEntry(cfg)) {
return true;
}
if (hasPotentialConfiguredChannels(cfg, env, { includePersistedAuthState: false })) {
if (collectConfiguredChannelIds(cfg, env).length > 0) {
return true;
}
if (hasConfiguredProviderModelOrHarness(cfg, env)) {