mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 12:40:44 +00:00
feat: gate legacy startup sidecar fallback
This commit is contained in:
@@ -662,6 +662,22 @@ describe("resolveGatewayStartupPluginIds", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("can disable deprecated implicit startup sidecar fallback for future-mode testing", () => {
|
||||
expectStartupPluginIdsCase({
|
||||
config: createStartupConfig({
|
||||
enabledPluginIds: ["demo-global-sidecar"],
|
||||
allowPluginIds: ["demo-global-sidecar"],
|
||||
noConfiguredChannels: true,
|
||||
memorySlot: "none",
|
||||
}),
|
||||
env: {
|
||||
...process.env,
|
||||
OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS: "1",
|
||||
},
|
||||
expected: [],
|
||||
});
|
||||
});
|
||||
|
||||
it("skips deprecated implicit startup sidecar fallback when activation.onStartup is false", () => {
|
||||
expectStartupPluginIdsCase({
|
||||
config: createStartupConfig({
|
||||
@@ -682,6 +698,10 @@ describe("resolveGatewayStartupPluginIds", () => {
|
||||
noConfiguredChannels: true,
|
||||
memorySlot: "none",
|
||||
}),
|
||||
env: {
|
||||
...process.env,
|
||||
OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS: "1",
|
||||
},
|
||||
expected: ["demo-global-explicit-startup"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,6 +20,18 @@ import {
|
||||
} from "./plugin-registry-contributions.js";
|
||||
import { loadPluginRegistrySnapshot } from "./plugin-registry-snapshot.js";
|
||||
|
||||
const DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS_ENV =
|
||||
"OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS";
|
||||
|
||||
function isTruthyEnvValue(value: string | undefined): boolean {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
|
||||
}
|
||||
|
||||
function shouldDisableLegacyImplicitStartupSidecars(env: NodeJS.ProcessEnv): boolean {
|
||||
return isTruthyEnvValue(env[DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS_ENV]);
|
||||
}
|
||||
|
||||
function listDisabledChannelIds(config: OpenClawConfig): Set<string> {
|
||||
const channels = config.channels;
|
||||
if (!channels || typeof channels !== "object" || Array.isArray(channels)) {
|
||||
@@ -117,6 +129,7 @@ function resolveMemorySlotStartupPluginId(params: {
|
||||
function shouldConsiderForGatewayStartup(params: {
|
||||
plugin: InstalledPluginIndexRecord;
|
||||
manifest: PluginManifestRecord | undefined;
|
||||
disableLegacyImplicitStartupSidecars: boolean;
|
||||
startupDreamingPluginIds: ReadonlySet<string>;
|
||||
memorySlotStartupPluginId?: string;
|
||||
}): boolean {
|
||||
@@ -127,6 +140,9 @@ function shouldConsiderForGatewayStartup(params: {
|
||||
if (params.manifest?.activation?.onStartup === false) {
|
||||
return false;
|
||||
}
|
||||
if (params.disableLegacyImplicitStartupSidecars) {
|
||||
return false;
|
||||
}
|
||||
// Deprecated compatibility fallback: plugins without explicit startup
|
||||
// activation metadata may still need startup import to register hooks or
|
||||
// services. All plugins should declare activation.onStartup explicitly as
|
||||
@@ -383,6 +399,9 @@ export function resolveGatewayStartupPluginIdsFromRegistry(params: {
|
||||
collectConfiguredAgentHarnessRuntimes(activationSourceConfig, params.env),
|
||||
);
|
||||
const startupDreamingPluginIds = resolveGatewayStartupDreamingPluginIds(params.config);
|
||||
const disableLegacyImplicitStartupSidecars = shouldDisableLegacyImplicitStartupSidecars(
|
||||
params.env,
|
||||
);
|
||||
const memorySlotStartupPluginId = resolveMemorySlotStartupPluginId({
|
||||
activationSourceConfig,
|
||||
activationSourcePlugins,
|
||||
@@ -436,6 +455,7 @@ export function resolveGatewayStartupPluginIdsFromRegistry(params: {
|
||||
!shouldConsiderForGatewayStartup({
|
||||
plugin,
|
||||
manifest,
|
||||
disableLegacyImplicitStartupSidecars,
|
||||
startupDreamingPluginIds,
|
||||
memorySlotStartupPluginId,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user