Skip to content

Commit d48c3e1

Browse files
committed
feat: gate legacy startup sidecar fallback
1 parent 583b419 commit d48c3e1

5 files changed

Lines changed: 49 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Docs: https://docs.openclaw.ai
3232
- Channels/Yuanbao: register the Tencent Yuanbao external channel plugin (`openclaw-plugin-yuanbao`) in the official channel catalog, contract suites, and community plugin docs, with a new `docs/channels/yuanbao.md` quick-start guide for WebSocket bot DMs and group chats. (#72756) Thanks @loongfay.
3333
- Channels/QQBot: add full group chat support (history tracking, @-mention gating, activation modes, per-group config, FIFO message queue with deliver debounce), C2C `stream_messages` streaming with a `StreamingController` lifecycle manager, unified `sendMedia` with chunked upload for large files, and refactor the engine into pipeline stages, focused outbound submodules, builtin slash-command modules, and explicit DI ports via `createEngineAdapters()`. (#70624) Thanks @cxyhhhhh.
3434
- Plugins/startup: migrate bundled plugin manifests to explicit `activation.onStartup` declarations so Gateway startup imports only the bundled plugins that intentionally register startup-time runtime surfaces. Thanks @shakkernerd.
35+
- Plugins/startup: add an opt-in future-mode gate for disabling deprecated implicit startup sidecar loading while preserving explicit startup and narrower activation triggers. Thanks @shakkernerd.
3536
- Plugins/startup: add plugin compatibility warnings for deprecated implicit startup loading so authors can migrate to explicit `activation.onStartup` metadata. Thanks @shakkernerd.
3637
- Plugins/runtime: load bundled agent tool-result middleware from manifest contracts on demand so tokenjuice stays startup-lazy without losing Pi/Codex tool-output compaction. Thanks @shakkernerd.
3738
- Plugins/startup: add explicit `activation.onStartup` metadata so plugins can declare Gateway startup import behavior while the deprecated implicit sidecar fallback remains for legacy plugins. Thanks @shakkernerd.

‎docs/plugins/compatibility.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ Current compatibility records include:
136136
move to `openclaw/plugin-sdk/channel-route`
137137
- activation hints that are being replaced by manifest contribution ownership
138138
- deprecated implicit startup sidecar loading for plugins that have not declared
139-
`activation.onStartup`
139+
`activation.onStartup`; maintainers can test the future stricter behavior with
140+
`OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS=1`
140141
- `setup-api` runtime fallback while setup descriptors move to cold
141142
`setup.requiresRuntime: false` metadata
142143
- provider `discovery` hooks while provider catalog hooks move to

‎docs/plugins/manifest.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ plugins unless they declare `activation.onStartup: true`. Plugin status and
268268
compatibility reports warn with `legacy-implicit-startup-sidecar` when a plugin
269269
still relies on that fallback.
270270

271+
For migration testing, set
272+
`OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS=1` to disable only that
273+
deprecated fallback. This opt-in mode does not block explicit
274+
`activation.onStartup: true` plugins or plugins loaded by channel, config,
275+
agent-harness, memory, or other narrower activation triggers.
276+
271277
```json
272278
{
273279
"activation": {

‎src/plugins/channel-plugin-ids.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,22 @@ describe("resolveGatewayStartupPluginIds", () => {
662662
});
663663
});
664664

665+
it("can disable deprecated implicit startup sidecar fallback for future-mode testing", () => {
666+
expectStartupPluginIdsCase({
667+
config: createStartupConfig({
668+
enabledPluginIds: ["demo-global-sidecar"],
669+
allowPluginIds: ["demo-global-sidecar"],
670+
noConfiguredChannels: true,
671+
memorySlot: "none",
672+
}),
673+
env: {
674+
...process.env,
675+
OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS: "1",
676+
},
677+
expected: [],
678+
});
679+
});
680+
665681
it("skips deprecated implicit startup sidecar fallback when activation.onStartup is false", () => {
666682
expectStartupPluginIdsCase({
667683
config: createStartupConfig({
@@ -682,6 +698,10 @@ describe("resolveGatewayStartupPluginIds", () => {
682698
noConfiguredChannels: true,
683699
memorySlot: "none",
684700
}),
701+
env: {
702+
...process.env,
703+
OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS: "1",
704+
},
685705
expected: ["demo-global-explicit-startup"],
686706
});
687707
});

‎src/plugins/gateway-startup-plugin-ids.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ import {
2020
} from "./plugin-registry-contributions.js";
2121
import { loadPluginRegistrySnapshot } from "./plugin-registry-snapshot.js";
2222

23+
const DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS_ENV =
24+
"OPENCLAW_DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS";
25+
26+
function isTruthyEnvValue(value: string | undefined): boolean {
27+
const normalized = value?.trim().toLowerCase();
28+
return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
29+
}
30+
31+
function shouldDisableLegacyImplicitStartupSidecars(env: NodeJS.ProcessEnv): boolean {
32+
return isTruthyEnvValue(env[DISABLE_LEGACY_IMPLICIT_STARTUP_SIDECARS_ENV]);
33+
}
34+
2335
function listDisabledChannelIds(config: OpenClawConfig): Set<string> {
2436
const channels = config.channels;
2537
if (!channels || typeof channels !== "object" || Array.isArray(channels)) {
@@ -117,6 +129,7 @@ function resolveMemorySlotStartupPluginId(params: {
117129
function shouldConsiderForGatewayStartup(params: {
118130
plugin: InstalledPluginIndexRecord;
119131
manifest: PluginManifestRecord | undefined;
132+
disableLegacyImplicitStartupSidecars: boolean;
120133
startupDreamingPluginIds: ReadonlySet<string>;
121134
memorySlotStartupPluginId?: string;
122135
}): boolean {
@@ -127,6 +140,9 @@ function shouldConsiderForGatewayStartup(params: {
127140
if (params.manifest?.activation?.onStartup === false) {
128141
return false;
129142
}
143+
if (params.disableLegacyImplicitStartupSidecars) {
144+
return false;
145+
}
130146
// Deprecated compatibility fallback: plugins without explicit startup
131147
// activation metadata may still need startup import to register hooks or
132148
// services. All plugins should declare activation.onStartup explicitly as
@@ -383,6 +399,9 @@ export function resolveGatewayStartupPluginIdsFromRegistry(params: {
383399
collectConfiguredAgentHarnessRuntimes(activationSourceConfig, params.env),
384400
);
385401
const startupDreamingPluginIds = resolveGatewayStartupDreamingPluginIds(params.config);
402+
const disableLegacyImplicitStartupSidecars = shouldDisableLegacyImplicitStartupSidecars(
403+
params.env,
404+
);
386405
const memorySlotStartupPluginId = resolveMemorySlotStartupPluginId({
387406
activationSourceConfig,
388407
activationSourcePlugins,
@@ -436,6 +455,7 @@ export function resolveGatewayStartupPluginIdsFromRegistry(params: {
436455
!shouldConsiderForGatewayStartup({
437456
plugin,
438457
manifest,
458+
disableLegacyImplicitStartupSidecars,
439459
startupDreamingPluginIds,
440460
memorySlotStartupPluginId,
441461
})

0 commit comments

Comments
 (0)