@@ -23,6 +23,7 @@ import {
2323 clearPluginInteractiveHandlers ,
2424 resolvePluginInteractiveNamespaceMatch ,
2525} from "./interactive-registry.js" ;
26+ import { resolvePluginRegistryLoadCacheKey } from "./loader-cache.js" ;
2627import { loadOpenClawPlugins , resolveRuntimePluginRegistry } from "./loader.js" ;
2728import {
2829 EMPTY_PLUGIN_SCHEMA ,
@@ -1384,9 +1385,10 @@ describe("loadOpenClawPlugins", () => {
13841385 } ,
13851386 } ,
13861387 {
1387- label : "fails loudly when a plugin reenters the same snapshot load during register " ,
1388+ label : "does not expose plugin config in cache keys or reentry diagnostics " ,
13881389 run : ( ) => {
13891390 useNoBundledPlugins ( ) ;
1391+ const pluginConfigSentinel = "hunter2-sentinel" ;
13901392 const marker = "__openclaw_loader_reentry_error" ;
13911393 const reenterFnMarker = "__openclaw_loader_reentry_fn" ;
13921394 Reflect . deleteProperty ( globalThis , marker ) ;
@@ -1405,13 +1407,21 @@ describe("loadOpenClawPlugins", () => {
14051407 plugins : {
14061408 load : { paths : [ pluginFile ] } ,
14071409 allow : [ "reentrant-snapshot" ] ,
1410+ entries : {
1411+ "reentrant-snapshot" : { config : { token : pluginConfigSentinel } } ,
1412+ } ,
14081413 } ,
14091414 } ,
14101415 } satisfies Parameters < typeof loadOpenClawPlugins > [ 0 ] ;
14111416 writePlugin ( {
14121417 id : "reentrant-snapshot" ,
14131418 dir : pluginDir ,
14141419 filename : "reentrant-snapshot.cjs" ,
1420+ configSchema : {
1421+ type : "object" ,
1422+ additionalProperties : false ,
1423+ properties : { token : { type : "string" } } ,
1424+ } ,
14151425 body : `module.exports = {
14161426 id: "reentrant-snapshot",
14171427 register() {
@@ -1428,17 +1438,24 @@ describe("loadOpenClawPlugins", () => {
14281438 };` ,
14291439 } ) ;
14301440
1441+ const cacheKey = resolvePluginRegistryLoadCacheKey ( nestedOptions ) ;
1442+ expect ( cacheKey ) . toMatch ( / ^ [ a - f 0 - 9 ] { 64 } $ / ) ;
1443+ expect ( cacheKey ) . not . toContain ( pluginConfigSentinel ) ;
14311444 const registry = loadOpenClawPlugins ( nestedOptions ) ;
14321445
14331446 try {
14341447 const reentryError = Reflect . get ( globalThis , marker ) as
14351448 | { name ?: unknown ; message ?: unknown }
14361449 | undefined ;
14371450 expect ( reentryError ?. name ) . toBe ( "PluginLoadReentryError" ) ;
1438- expect ( String ( reentryError ?. message ) ) . toContain ( "plugin load reentry detected" ) ;
1451+ expect ( reentryError ?. message ) . toBe (
1452+ `plugin load reentry detected for cache key: ${ cacheKey } ` ,
1453+ ) ;
1454+ expect ( String ( reentryError ?. message ) ) . not . toContain ( pluginConfigSentinel ) ;
14391455 const record = registry . plugins . find ( ( entry ) => entry . id === "reentrant-snapshot" ) ;
14401456 expect ( record ?. status ) . toBe ( "error" ) ;
1441- expect ( record ?. error ) . toContain ( "plugin load reentry detected" ) ;
1457+ expect ( record ?. error ) . toContain ( cacheKey ) ;
1458+ expect ( record ?. error ) . not . toContain ( pluginConfigSentinel ) ;
14421459 expect ( record ?. failurePhase ) . toBe ( "register" ) ;
14431460 } finally {
14441461 Reflect . deleteProperty ( globalThis , marker ) ;
0 commit comments