@@ -11,7 +11,11 @@ import {
1111 shouldIncludeSupplementalContext ,
1212} from "openclaw/plugin-sdk/context-visibility-runtime" ;
1313import { evaluateSenderGroupAccessForPolicy } from "openclaw/plugin-sdk/group-access" ;
14- import { dispatchReplyFromConfigWithSettledDispatcher } from "openclaw/plugin-sdk/inbound-reply-dispatch" ;
14+ import {
15+ dispatchReplyFromConfigWithSettledDispatcher ,
16+ hasFinalInboundReplyDispatch ,
17+ resolveInboundReplyDispatchCounts ,
18+ } from "openclaw/plugin-sdk/inbound-reply-dispatch" ;
1519import {
1620 buildPendingHistoryContextFromMap ,
1721 clearHistoryEntriesIfEnabled ,
@@ -864,11 +868,12 @@ export function createMSTeamsMessageHandler(deps: MSTeamsMessageHandlerDeps) {
864868 } ) ,
865869 } ) ;
866870 const queuedFinal = dispatchResult ?. queuedFinal ?? false ;
867- const counts = dispatchResult ?. counts ?? { tool : 0 , block : 0 , final : 0 } ;
871+ const counts = resolveInboundReplyDispatchCounts ( dispatchResult ) ;
872+ const hasFinalResponse = hasFinalInboundReplyDispatch ( dispatchResult ) ;
868873
869874 log . info ( "dispatch complete" , { queuedFinal, counts } ) ;
870875
871- if ( ! queuedFinal ) {
876+ if ( ! hasFinalResponse ) {
872877 if ( isRoomish && historyKey ) {
873878 clearHistoryEntriesIfEnabled ( {
874879 historyMap : conversationHistories ,
0 commit comments