@@ -32,6 +32,7 @@ import {
3232 resolveHeartbeatToolResponseFromReplyResult ,
3333 type HeartbeatToolResponse ,
3434} from "../auto-reply/heartbeat-tool-response.js" ;
35+ import { getReplyPayloadMetadata } from "../auto-reply/reply-payload.js" ;
3536import {
3637 DEFAULT_HEARTBEAT_ACK_MAX_CHARS ,
3738 isHeartbeatContentEffectivelyEmpty ,
@@ -1829,6 +1830,9 @@ export async function runHeartbeatOnce(opts: {
18291830 const replyResult = await getReplyFromConfig ( ctx , replyOpts , cfg ) ;
18301831 const heartbeatToolResponse = resolveHeartbeatToolResponseFromReplyResult ( replyResult ) ;
18311832 const replyPayload = resolveHeartbeatReplyPayload ( replyResult ) ;
1833+ const replyPayloadDeliverableDespiteSuppression =
1834+ replyPayload != null &&
1835+ getReplyPayloadMetadata ( replyPayload ) ?. deliverDespiteSourceReplySuppression === true ;
18321836 if (
18331837 ! heartbeatToolResponse &&
18341838 ( ! replyPayload || ! hasOutboundReplyContent ( replyPayload ) ) &&
@@ -1934,8 +1938,14 @@ export async function runHeartbeatOnce(opts: {
19341938 normalized . text = replacement . text ;
19351939 normalized . shouldSkip = false ;
19361940 }
1941+ const suppressMainBecauseToolNotUsed =
1942+ usesHeartbeatResponseTool &&
1943+ ! heartbeatToolResponse &&
1944+ ! replyPayloadDeliverableDespiteSuppression ;
19371945 const shouldSkipMain =
1938- normalized . shouldSkip && ! normalized . hasMedia && ! hasRelayableExecCompletion ;
1946+ ( normalized . shouldSkip || suppressMainBecauseToolNotUsed ) &&
1947+ ! normalized . hasMedia &&
1948+ ! hasRelayableExecCompletion ;
19391949 if ( shouldSkipMain && reasoningPayloads . length === 0 ) {
19401950 await restoreHeartbeatUpdatedAt ( {
19411951 storePath,
0 commit comments