perf(config): skip bootstrap for false env channel probes

This commit is contained in:
Peter Steinberger
2026-05-06 19:05:58 +01:00
parent 11a0b1248d
commit 2d97dcebb5

View File

@@ -1,6 +1,13 @@
import { collectConfiguredAgentHarnessRuntimes } from "../agents/harness-runtimes.js";
import { normalizeProviderId } from "../agents/provider-id.js";
import { listPotentialConfiguredChannelPresenceSignals } from "../channels/config-presence.js";
import {
listPotentialConfiguredChannelPresenceSignals,
type ChannelPresenceSignalSource,
} from "../channels/config-presence.js";
import {
hasBundledChannelConfiguredState,
listBundledChannelIdsWithConfiguredState,
} from "../channels/plugins/configured-state.js";
import { getChatChannelMeta, normalizeChatChannelId } from "../channels/registry.js";
import { getCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js";
import {
@@ -253,11 +260,45 @@ function collectPluginIdsForConfiguredChannel(
}
function collectConfiguredChannelIds(cfg: OpenClawConfig, env: NodeJS.ProcessEnv): string[] {
const configuredStateChannelIds = new Set(listBundledChannelIdsWithConfiguredState());
return listPotentialConfiguredChannelPresenceSignals(cfg, env, {
includePersistedAuthState: false,
})
.map((signal) => normalizeChatChannelId(signal.channelId) ?? signal.channelId)
.filter((channelId) => isChannelConfigured(cfg, channelId, env));
.map((signal) => ({
source: signal.source,
channelId: normalizeChatChannelId(signal.channelId) ?? signal.channelId,
}))
.filter(({ channelId, source }) =>
isAutoEnableConfiguredChannelSignal({
cfg,
env,
channelId,
source,
configuredStateChannelIds,
}),
)
.map(({ channelId }) => channelId);
}
function isAutoEnableConfiguredChannelSignal(params: {
cfg: OpenClawConfig;
env: NodeJS.ProcessEnv;
channelId: string;
source: ChannelPresenceSignalSource;
configuredStateChannelIds: ReadonlySet<string>;
}): boolean {
if (
params.source === "env" &&
params.configuredStateChannelIds.has(params.channelId) &&
!hasBundledChannelConfiguredState({
channelId: params.channelId,
cfg: params.cfg,
env: params.env,
})
) {
return false;
}
return isChannelConfigured(params.cfg, params.channelId, params.env);
}
function hasConfiguredWebSearchPluginEntry(cfg: OpenClawConfig): boolean {