@@ -125,10 +125,13 @@ describe("active-memory plugin", () => {
125125 "utf8" ,
126126 ) ;
127127 } ;
128- const makeMemoryToolAllowlistError = ( reason : string ) =>
128+ const makeMemoryToolAllowlistError = (
129+ reason : string ,
130+ sources = "runtime toolsAllow: memory_recall, memory_search, memory_get" ,
131+ ) =>
129132 new Error (
130133 `No callable tools remain after resolving explicit tool allowlist ` +
131- `(runtime toolsAllow: memory_recall, memory_search, memory_get ); ${ reason } . ` +
134+ `(${ sources } ); ${ reason } . ` +
132135 `Fix the allowlist or enable the plugin that registers the requested tool.` ,
133136 ) ;
134137 const hasDebugLine = ( needle : string ) =>
@@ -1683,6 +1686,32 @@ describe("active-memory plugin", () => {
16831686 expect ( lines . join ( "\n" ) ) . not . toContain ( "status=unavailable" ) ;
16841687 } ) ;
16851688
1689+ it ( "skips missing memory tools when the allowlist error includes inherited sources" , async ( ) => {
1690+ const sessionKey = "agent:main:missing-memory-tools-with-policy-source" ;
1691+ hoisted . sessionStore [ sessionKey ] = {
1692+ sessionId : "s-missing-memory-tools-with-policy-source" ,
1693+ updatedAt : 0 ,
1694+ } ;
1695+ const error = makeMemoryToolAllowlistError (
1696+ "no registered tools matched" ,
1697+ "tools.allow: *, lobster; runtime toolsAllow: memory_recall, memory_search, memory_get" ,
1698+ ) ;
1699+ expect ( __testing . isMissingRegisteredMemoryToolsError ( error ) ) . toBe ( true ) ;
1700+ runEmbeddedPiAgent . mockRejectedValueOnce ( error ) ;
1701+
1702+ const result = await hooks . before_prompt_build (
1703+ { prompt : "what wings should i order? missing memory tools with policy" , messages : [ ] } ,
1704+ { agentId : "main" , trigger : "user" , sessionKey, messageProvider : "webchat" } ,
1705+ ) ;
1706+
1707+ expect ( result ) . toBeUndefined ( ) ;
1708+ expect ( hasDebugLine ( "no memory tools registered" ) ) . toBe ( true ) ;
1709+ expect ( hasWarnLine ( "No callable tools remain" ) ) . toBe ( false ) ;
1710+ expect ( getActiveMemoryLines ( sessionKey ) ) . toEqual ( [
1711+ expect . stringContaining ( "🧩 Active Memory: status=empty" ) ,
1712+ ] ) ;
1713+ } ) ;
1714+
16861715 it . each ( [
16871716 [ "disabled tools" , "tools are disabled for this run" ] ,
16881717 [ "models without tool support" , "the selected model does not support tools" ] ,
0 commit comments