@@ -474,6 +474,79 @@ describe("active-memory plugin", () => {
474474 messageChannel : "webchat" ,
475475 messageProvider : "webchat" ,
476476 sessionKey : expect . stringMatching ( / ^ a g e n t : m a i n : m a i n : a c t i v e - m e m o r y : [ a - f 0 - 9 ] { 12 } $ / ) ,
477+ config : {
478+ plugins : {
479+ entries : {
480+ "active-memory" : {
481+ config : {
482+ qmd : {
483+ searchMode : "search" ,
484+ } ,
485+ } ,
486+ } ,
487+ } ,
488+ } ,
489+ } ,
490+ } ) ;
491+ } ) ;
492+
493+ it ( "lets active memory inherit the main QMD search mode when configured" , async ( ) => {
494+ api . config = {
495+ agents : {
496+ defaults : {
497+ model : {
498+ primary : "github-copilot/gpt-5.4-mini" ,
499+ } ,
500+ } ,
501+ } ,
502+ memory : {
503+ backend : "qmd" ,
504+ qmd : {
505+ searchMode : "query" ,
506+ } ,
507+ } ,
508+ } ;
509+ api . pluginConfig = {
510+ agents : [ "main" ] ,
511+ qmd : {
512+ searchMode : "inherit" ,
513+ } ,
514+ } ;
515+ await plugin . register ( api as unknown as OpenClawPluginApi ) ;
516+
517+ await hooks . before_prompt_build (
518+ {
519+ prompt : "what wings should i order? inherit-qmd-mode-check" ,
520+ messages : [ ] ,
521+ } ,
522+ {
523+ agentId : "main" ,
524+ trigger : "user" ,
525+ sessionKey : "agent:main:main" ,
526+ messageProvider : "webchat" ,
527+ } ,
528+ ) ;
529+
530+ expect ( runEmbeddedPiAgent . mock . calls . at ( - 1 ) ?. [ 0 ] ) . toMatchObject ( {
531+ config : {
532+ memory : {
533+ backend : "qmd" ,
534+ qmd : {
535+ searchMode : "query" ,
536+ } ,
537+ } ,
538+ plugins : {
539+ entries : {
540+ "active-memory" : {
541+ config : {
542+ qmd : {
543+ searchMode : "inherit" ,
544+ } ,
545+ } ,
546+ } ,
547+ } ,
548+ } ,
549+ } ,
477550 } ) ;
478551 } ) ;
479552
@@ -827,13 +900,25 @@ describe("active-memory plugin", () => {
827900 sessionId : "s-main" ,
828901 updatedAt : 0 ,
829902 } ;
830- runEmbeddedPiAgent . mockResolvedValueOnce ( {
831- payloads : [ { text : "User prefers lemon pepper wings, and blue cheese still wins." } ] ,
903+ runEmbeddedPiAgent . mockImplementationOnce ( async ( ) => {
904+ return {
905+ meta : {
906+ activeMemorySearchDebug : {
907+ backend : "qmd" ,
908+ configuredMode : "search" ,
909+ effectiveMode : "query" ,
910+ fallback : "unsupported-search-flags" ,
911+ searchMs : 2590 ,
912+ hits : 3 ,
913+ } ,
914+ } ,
915+ payloads : [ { text : "User prefers lemon pepper wings, and blue cheese still wins." } ] ,
916+ } ;
832917 } ) ;
833918
834919 await hooks . before_prompt_build (
835920 {
836- prompt : "what wings should i order?" ,
921+ prompt : "what wings should i order? debug telemetry " ,
837922 messages : [ ] ,
838923 } ,
839924 { agentId : "main" , trigger : "user" , sessionKey, messageProvider : "webchat" } ,
@@ -856,7 +941,7 @@ describe("active-memory plugin", () => {
856941 lines : expect . arrayContaining ( [
857942 expect . stringContaining ( "🧩 Active Memory: ok" ) ,
858943 expect . stringContaining (
859- "🔎 Active Memory Debug: User prefers lemon pepper wings, and blue cheese still wins." ,
944+ "🔎 Active Memory Debug: backend=qmd configuredMode=search effectiveMode=query fallback=unsupported-search-flags searchMs=2590 hits=3 | User prefers lemon pepper wings, and blue cheese still wins." ,
860945 ) ,
861946 ] ) ,
862947 } ,
0 commit comments