Skip to content

Commit 3a7d0ee

Browse files
committed
fix(outbound): check delivery identity for media results before recording success
The sendPayload branch checks hasDeliveryResultIdentity before counting a delivery result as sent, but the media branch was missing this check. When a channel adapter returns a media result with no messageId or other identity fields (e.g. QQBot rejecting a TTS temp file outside its media roots), the delivery was incorrectly recorded as successful. This caused cron auto-TTS deliveries to QQBot to be reported as delivered when the message was actually lost, since the generated audio file was outside QQBot's allowed media roots and the adapter returned an error result with no delivery identity. Add the same hasDeliveryResultIdentity check to the media delivery loop so that no-identity media results are properly skipped, consistent with the sendPayload branch behavior. Fixes #92816
1 parent b76bca7 commit 3a7d0ee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/infra/outbound/deliver.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ async function deliverOutboundPayloadsCore(
14241424
agentId: params.session?.agentId ?? params.mirror?.agentId,
14251425
mediaSources,
14261426
mediaAccess: params.mediaAccess,
1427-
sessionKey: params.session?.key,
1427+
sessionKey: params.session?.policyKey ?? params.session?.key,
14281428
messageProvider: params.session?.key ? undefined : channel,
14291429
accountId: params.session?.requesterAccountId ?? accountId,
14301430
requesterSenderId: params.session?.requesterSenderId,
@@ -1891,6 +1891,9 @@ async function deliverOutboundPayloadsCore(
18911891
unit.overrides,
18921892
)
18931893
: await deliveryHandler.sendMedia(unit.caption ?? "", unit.mediaUrl, unit.overrides);
1894+
if (!hasDeliveryResultIdentity(delivery)) {
1895+
continue;
1896+
}
18941897
results.push(delivery);
18951898
firstMessageId ??= delivery.messageId;
18961899
lastMessageId = delivery.messageId;

0 commit comments

Comments
 (0)