@@ -475,77 +475,6 @@ describe("slackPlugin status", () => {
475475 } ) ;
476476 } ) ;
477477
478- it ( "prefers the current Slack thread session when reply is inherited (replyToIsExplicit=false)" , async ( ) => {
479- const resolveRoute = slackPlugin . messaging ?. resolveOutboundSessionRoute ;
480- if ( ! resolveRoute ) {
481- throw new Error ( "slack messaging.resolveOutboundSessionRoute unavailable" ) ;
482- }
483-
484- const route = await resolveRoute ( {
485- cfg : { } as OpenClawConfig ,
486- agentId : "main" ,
487- target : "channel:C1" ,
488- currentSessionKey : "agent:main:slack:channel:C1:thread:1712345678.123456" ,
489- replyToId : "1712345688.654321" ,
490- replyToIsExplicit : false ,
491- } ) ;
492-
493- // Inherited child reply timestamp should not create a new session;
494- // it should route into the existing thread session.
495- expectRecordFields ( route , "Slack route (inherited reply)" , {
496- sessionKey : "agent:main:slack:channel:c1:thread:1712345678.123456" ,
497- baseSessionKey : "agent:main:slack:channel:c1" ,
498- threadId : "1712345678.123456" ,
499- } ) ;
500- } ) ;
501-
502- it ( "keeps explicit reply-to precedence when replyToIsExplicit=true" , async ( ) => {
503- const resolveRoute = slackPlugin . messaging ?. resolveOutboundSessionRoute ;
504- if ( ! resolveRoute ) {
505- throw new Error ( "slack messaging.resolveOutboundSessionRoute unavailable" ) ;
506- }
507-
508- const route = await resolveRoute ( {
509- cfg : { } as OpenClawConfig ,
510- agentId : "main" ,
511- target : "channel:C1" ,
512- currentSessionKey : "agent:main:slack:channel:C1:thread:1712345678.123456" ,
513- replyToId : "1712345688.654321" ,
514- replyToIsExplicit : true ,
515- } ) ;
516-
517- // Explicit reply targets should keep the current reply-first behavior.
518- expectRecordFields ( route , "Slack route (explicit reply)" , {
519- sessionKey : "agent:main:slack:channel:c1:thread:1712345688.654321" ,
520- baseSessionKey : "agent:main:slack:channel:c1" ,
521- threadId : "1712345688.654321" ,
522- } ) ;
523- } ) ;
524-
525- it ( "preserves reply-first routing when replyToIsExplicit is omitted (backward compat)" , async ( ) => {
526- const resolveRoute = slackPlugin . messaging ?. resolveOutboundSessionRoute ;
527- if ( ! resolveRoute ) {
528- throw new Error ( "slack messaging.resolveOutboundSessionRoute unavailable" ) ;
529- }
530-
531- const route = await resolveRoute ( {
532- cfg : { } as OpenClawConfig ,
533- agentId : "main" ,
534- target : "channel:C1" ,
535- currentSessionKey : "agent:main:slack:channel:C1:thread:1712345678.123456" ,
536- replyToId : "1712345688.654321" ,
537- // replyToIsExplicit intentionally omitted
538- } ) ;
539-
540- // Callers that haven't opted into the tri-state signal (e.g. gateway
541- // send with an explicit replyToId) must keep reply-first routing.
542- expectRecordFields ( route , "Slack route (omitted explicitness)" , {
543- sessionKey : "agent:main:slack:channel:c1:thread:1712345688.654321" ,
544- baseSessionKey : "agent:main:slack:channel:c1" ,
545- threadId : "1712345688.654321" ,
546- } ) ;
547- } ) ;
548-
549478 it ( "canonicalizes bare Slack IM channel targets to direct user session routes" , async ( ) => {
550479 const resolveRoute = slackPlugin . messaging ?. resolveOutboundSessionRoute ;
551480 if ( ! resolveRoute ) {
@@ -945,6 +874,33 @@ describe("slackPlugin outbound", () => {
945874 } ) ;
946875 } ) ;
947876
877+ it . each ( [
878+ {
879+ name : "inherited" ,
880+ replyToIsExplicit : false ,
881+ expectedReplyToId : "1712345678.123456" ,
882+ } ,
883+ { name : "explicit" , replyToIsExplicit : true , expectedReplyToId : "1712345688.654321" } ,
884+ { name : "unknown" , replyToIsExplicit : undefined , expectedReplyToId : "1712345688.654321" } ,
885+ ] ) (
886+ "routes $name child replies to $expectedReplyToId" ,
887+ ( { replyToIsExplicit, expectedReplyToId } ) => {
888+ const resolveReplyTransport = slackPlugin . threading ?. resolveReplyTransport ;
889+ if ( ! resolveReplyTransport ) {
890+ throw new Error ( "slack threading.resolveReplyTransport unavailable" ) ;
891+ }
892+
893+ expect (
894+ resolveReplyTransport ( {
895+ cfg,
896+ replyToId : "1712345688.654321" ,
897+ threadId : "1712345678.123456" ,
898+ replyToIsExplicit,
899+ } ) ,
900+ ) . toEqual ( { replyToId : expectedReplyToId , threadId : null } ) ;
901+ } ,
902+ ) ;
903+
948904 it ( "ignores explicit reply targets for off-mode final delivery" , ( ) => {
949905 const resolveReplyTransport = slackPlugin . threading ?. resolveReplyTransport ;
950906 if ( ! resolveReplyTransport ) {
0 commit comments