@@ -2043,6 +2043,9 @@ module.exports = {
20432043 openclaw : {
20442044 extensions : [ "./index.cjs" ] ,
20452045 setupEntry : "./setup-entry.cjs" ,
2046+ startup : {
2047+ deferConfiguredChannelFullLoadUntilAfterListen : true ,
2048+ } ,
20462049 } ,
20472050 } ,
20482051 null ,
@@ -2137,6 +2140,113 @@ module.exports = {
21372140 expect ( registry . channels ) . toHaveLength ( 1 ) ;
21382141 } ) ;
21392142
2143+ it ( "does not prefer setupEntry for configured channel loads without startup opt-in" , ( ) => {
2144+ useNoBundledPlugins ( ) ;
2145+ const pluginDir = makeTempDir ( ) ;
2146+ const fullMarker = path . join ( makeTempDir ( ) , "full-loaded.txt" ) ;
2147+ const setupMarker = path . join ( makeTempDir ( ) , "setup-loaded.txt" ) ;
2148+ fs . writeFileSync (
2149+ path . join ( pluginDir , "package.json" ) ,
2150+ JSON . stringify (
2151+ {
2152+ name : "@openclaw/setup-runtime-not-preferred-test" ,
2153+ openclaw : {
2154+ extensions : [ "./index.cjs" ] ,
2155+ setupEntry : "./setup-entry.cjs" ,
2156+ } ,
2157+ } ,
2158+ null ,
2159+ 2 ,
2160+ ) ,
2161+ "utf-8" ,
2162+ ) ;
2163+ fs . writeFileSync (
2164+ path . join ( pluginDir , "openclaw.plugin.json" ) ,
2165+ JSON . stringify (
2166+ {
2167+ id : "setup-runtime-not-preferred-test" ,
2168+ configSchema : EMPTY_PLUGIN_SCHEMA ,
2169+ channels : [ "setup-runtime-not-preferred-test" ] ,
2170+ } ,
2171+ null ,
2172+ 2 ,
2173+ ) ,
2174+ "utf-8" ,
2175+ ) ;
2176+ fs . writeFileSync (
2177+ path . join ( pluginDir , "index.cjs" ) ,
2178+ `require("node:fs").writeFileSync(${ JSON . stringify ( fullMarker ) } , "loaded", "utf-8");
2179+ module.exports = {
2180+ id: "setup-runtime-not-preferred-test",
2181+ register(api) {
2182+ api.registerChannel({
2183+ plugin: {
2184+ id: "setup-runtime-not-preferred-test",
2185+ meta: {
2186+ id: "setup-runtime-not-preferred-test",
2187+ label: "Setup Runtime Not Preferred Test",
2188+ selectionLabel: "Setup Runtime Not Preferred Test",
2189+ docsPath: "/channels/setup-runtime-not-preferred-test",
2190+ blurb: "full entry should still load without explicit startup opt-in",
2191+ },
2192+ capabilities: { chatTypes: ["direct"] },
2193+ config: {
2194+ listAccountIds: () => ["default"],
2195+ resolveAccount: () => ({ accountId: "default", token: "configured" }),
2196+ },
2197+ outbound: { deliveryMode: "direct" },
2198+ },
2199+ });
2200+ },
2201+ };` ,
2202+ "utf-8" ,
2203+ ) ;
2204+ fs . writeFileSync (
2205+ path . join ( pluginDir , "setup-entry.cjs" ) ,
2206+ `require("node:fs").writeFileSync(${ JSON . stringify ( setupMarker ) } , "loaded", "utf-8");
2207+ module.exports = {
2208+ plugin: {
2209+ id: "setup-runtime-not-preferred-test",
2210+ meta: {
2211+ id: "setup-runtime-not-preferred-test",
2212+ label: "Setup Runtime Not Preferred Test",
2213+ selectionLabel: "Setup Runtime Not Preferred Test",
2214+ docsPath: "/channels/setup-runtime-not-preferred-test",
2215+ blurb: "setup runtime not preferred",
2216+ },
2217+ capabilities: { chatTypes: ["direct"] },
2218+ config: {
2219+ listAccountIds: () => ["default"],
2220+ resolveAccount: () => ({ accountId: "default", token: "configured" }),
2221+ },
2222+ outbound: { deliveryMode: "direct" },
2223+ },
2224+ };` ,
2225+ "utf-8" ,
2226+ ) ;
2227+
2228+ const registry = loadOpenClawPlugins ( {
2229+ cache : false ,
2230+ preferSetupRuntimeForChannelPlugins : true ,
2231+ config : {
2232+ channels : {
2233+ "setup-runtime-not-preferred-test" : {
2234+ enabled : true ,
2235+ } ,
2236+ } ,
2237+ plugins : {
2238+ load : { paths : [ pluginDir ] } ,
2239+ allow : [ "setup-runtime-not-preferred-test" ] ,
2240+ } ,
2241+ } ,
2242+ } ) ;
2243+
2244+ expect ( fs . existsSync ( fullMarker ) ) . toBe ( true ) ;
2245+ expect ( fs . existsSync ( setupMarker ) ) . toBe ( false ) ;
2246+ expect ( registry . channelSetups ) . toHaveLength ( 1 ) ;
2247+ expect ( registry . channels ) . toHaveLength ( 1 ) ;
2248+ } ) ;
2249+
21402250 it ( "blocks before_prompt_build but preserves legacy model overrides when prompt injection is disabled" , async ( ) => {
21412251 useNoBundledPlugins ( ) ;
21422252 const plugin = writePlugin ( {
0 commit comments