88 markReplyPayloadAsTtsSupplement ,
99 type ReplyPayload ,
1010} from "../reply-payload.js" ;
11- import { isSilentReplyPayloadText } from "../tokens.js" ;
1211import { isDispatchReplyOperationAbortedError } from "./dispatch-from-config.abort.js" ;
1312import type { ExecuteDispatchReadyState } from "./dispatch-from-config.execute.js" ;
1413import {
@@ -35,6 +34,7 @@ export async function finalizeDispatchAndAudit(state: ExecuteDispatchReadyState)
3534 ctx,
3635 deliveryChannel,
3736 deliverySuppressionReason,
37+ deliberateSilentTerminalReply,
3838 dispatcher,
3939 emptyFinalAllowedAsSilent,
4040 explicitCommandTurnCtx,
@@ -69,7 +69,6 @@ export async function finalizeDispatchAndAudit(state: ExecuteDispatchReadyState)
6969 waitForPendingDirectBlockReplyDelivery,
7070 } = state ;
7171 const replies = replyResult ? ( Array . isArray ( replyResult ) ? replyResult : [ replyResult ] ) : [ ] ;
72- const hasExplicitSilentReply = replies . some ( ( reply ) => isSilentReplyPayloadText ( reply . text ) ) ;
7372 const pendingFinalDelivery = {
7473 storePath : sessionStoreEntry . storePath ,
7574 sessionKey : sessionStoreEntry . sessionKey ?? sessionKey ,
@@ -293,7 +292,7 @@ export async function finalizeDispatchAndAudit(state: ExecuteDispatchReadyState)
293292 ! sendPolicyDenied &&
294293 sourceReplyDeliveryMode !== "message_tool_only" &&
295294 ! emptyFinalAllowedAsSilent &&
296- ! hasExplicitSilentReply &&
295+ ! deliberateSilentTerminalReply &&
297296 ! getObservedReplyDelivery ( ) &&
298297 ! replyAcceptedByActiveRun &&
299298 ! turnLedger . hasVisibleDelivery ( ) &&
@@ -309,8 +308,8 @@ export async function finalizeDispatchAndAudit(state: ExecuteDispatchReadyState)
309308 }
310309 let counts = dispatcher . getQueuedCounts ( ) ;
311310 let noVisibleReplyFallbackDelivered = false ;
312- // Visible agent turns with genuinely empty model completions get a core
313- // fallback final. An explicit NO_REPLY is intentional silence, not emptiness .
311+ // The agent-result classifier owns terminal silence; carry that fact here
312+ // because reply payloads are filtered projections and cannot safely rederive it .
314313 // An aborted or timed-out settle leaves delivery state unknown; admission
315314 // then keeps its legacy trust and the turn ends without a fallback.
316315 if ( queuedSettleResult === "settled" && noVisibleReplyFallbackAllowed ( ) ) {
@@ -394,7 +393,7 @@ export async function finalizeDispatchAndAudit(state: ExecuteDispatchReadyState)
394393 ! getObservedReplyDelivery ( ) &&
395394 ! replyAcceptedByActiveRun &&
396395 ! emptyFinalAllowedAsSilent &&
397- ! hasExplicitSilentReply
396+ ! deliberateSilentTerminalReply
398397 ? { noVisibleReplyFallbackEligible : true }
399398 : { } ) ,
400399 ...( noVisibleReplyFallbackDelivered ? { noVisibleReplyFallbackDelivered : true } : { } ) ,
0 commit comments