@@ -1099,18 +1099,20 @@ describe("followup queue collect routing", () => {
10991099const emptyCfg = { } as OpenClawConfig ;
11001100
11011101describe ( "createReplyDispatcher" , ( ) => {
1102- it ( "drops empty payloads and silent tokens without media" , async ( ) => {
1102+ it ( "drops empty payloads and exact silent tokens without media" , async ( ) => {
11031103 const deliver = vi . fn ( ) . mockResolvedValue ( undefined ) ;
11041104 const dispatcher = createReplyDispatcher ( { deliver } ) ;
11051105
11061106 expect ( dispatcher . sendFinalReply ( { } ) ) . toBe ( false ) ;
11071107 expect ( dispatcher . sendFinalReply ( { text : " " } ) ) . toBe ( false ) ;
11081108 expect ( dispatcher . sendFinalReply ( { text : SILENT_REPLY_TOKEN } ) ) . toBe ( false ) ;
1109- expect ( dispatcher . sendFinalReply ( { text : `${ SILENT_REPLY_TOKEN } -- nope` } ) ) . toBe ( false ) ;
1110- expect ( dispatcher . sendFinalReply ( { text : `interject.${ SILENT_REPLY_TOKEN } ` } ) ) . toBe ( false ) ;
1109+ expect ( dispatcher . sendFinalReply ( { text : `${ SILENT_REPLY_TOKEN } -- nope` } ) ) . toBe ( true ) ;
1110+ expect ( dispatcher . sendFinalReply ( { text : `interject.${ SILENT_REPLY_TOKEN } ` } ) ) . toBe ( true ) ;
11111111
11121112 await dispatcher . waitForIdle ( ) ;
1113- expect ( deliver ) . not . toHaveBeenCalled ( ) ;
1113+ expect ( deliver ) . toHaveBeenCalledTimes ( 2 ) ;
1114+ expect ( deliver . mock . calls [ 0 ] ?. [ 0 ] ?. text ) . toBe ( `${ SILENT_REPLY_TOKEN } -- nope` ) ;
1115+ expect ( deliver . mock . calls [ 1 ] ?. [ 0 ] ?. text ) . toBe ( `interject.${ SILENT_REPLY_TOKEN } ` ) ;
11141116 } ) ;
11151117
11161118 it ( "strips heartbeat tokens and applies responsePrefix" , async ( ) => {
@@ -1162,7 +1164,7 @@ describe("createReplyDispatcher", () => {
11621164 expect ( deliver ) . toHaveBeenCalledTimes ( 3 ) ;
11631165 expect ( deliver . mock . calls [ 0 ] [ 0 ] . text ) . toBe ( "PFX already" ) ;
11641166 expect ( deliver . mock . calls [ 1 ] [ 0 ] . text ) . toBe ( "" ) ;
1165- expect ( deliver . mock . calls [ 2 ] [ 0 ] . text ) . toBe ( "" ) ;
1167+ expect ( deliver . mock . calls [ 2 ] [ 0 ] . text ) . toBe ( `PFX ${ SILENT_REPLY_TOKEN } -- explanation` ) ;
11661168 } ) ;
11671169
11681170 it ( "preserves ordering across tool, block, and final replies" , async ( ) => {
0 commit comments