fix(cron): avoid delivered status for empty outbound receipts#79811
fix(cron): avoid delivered status for empty outbound receipts#79811indulgeback wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81868a92b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...filterIdentifiedDeliveryResults( | ||
| await handler.sendFormattedText( | ||
| payloadSummary.text, | ||
| applySendReplyToConsumption(sendOverrides), | ||
| ), | ||
| ), | ||
| ); |
There was a problem hiding this comment.
Avoid emitting stale messageId after filtering no-identity sends
After this change filters identity-less results, a payload can now produce zero new results entries even though earlier payloads already populated results. In that case, the later emitMessageSent still takes messageId from results.at(-1), which points to a previous payload’s message ID. This misattributes a failed/suppressed send to the wrong platform message whenever multiple payloads are delivered in one call and a later text send returns only identity-less results.
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. Reviewed June 2, 2026, 1:09 AM ET / 05:09 UTC. Summary PR surface: Source +20, Tests +97. Total +117 across 3 files. Reproducibility: yes. Source inspection shows current main appends empty text/media results and durable send treats non-empty results as sent; the PR body also supplies terminal proof that the patched runtime suppresses the empty-result case. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this patch if maintainers accept the stricter empty-identity receipt contract, and leave the broader durable fallback semantics work tracked in #87561. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main appends empty text/media results and durable send treats non-empty results as sent; the PR body also supplies terminal proof that the patched runtime suppresses the empty-result case. Is this the best way to solve the issue? Yes, with maintainer acceptance. The shared outbound delivery layer is the right fix boundary because cron consumes durable send results, and a channel-specific workaround would leave other direct delivery paths inconsistent. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against ebf20241bd17. Label changesLabel justifications:
Evidence reviewedPR surface: Source +20, Tests +97. Total +117 across 3 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
This pull request has been automatically marked as stale due to inactivity. |
423e5ee to
e046c28
Compare
Summary
Fixes #79753.
Cron announce/direct delivery could still treat an outbound adapter result with no platform delivery identity as a successful send on text/media paths. That lets a run show
delivered: trueeven though the channel adapter produced no usable message receipt.This tightens the shared outbound delivery result handling so only results with a real delivery identity (
messageId,chatId,channelId,roomId,conversationId,toJid, orpollId) are counted as sent. Empty/identity-less results now flow through the existing suppressed/no-visible-result path, so cron recordsdelivered: falseinstead of a false positive.Real behavior proof
codex/cron-announce-not-delivered-regression, Nodev25.7.0, using the patched shared outbound delivery runtime throughsendDurableMessageBatch.{ channel: "telegram", messageId: "" }, then callssendDurableMessageBatchwithskipQueue: true.status: "suppressed",results: [],reason: "adapter_returned_no_identity") instead of returning a sent result. The cron regression test on the same branch verifies this maps todelivered: falsewithdeliveryAttempted: true.Tests
pnpm test src/cron/isolated-agent.direct-delivery-core-channels.test.tspnpm test src/channels/message/send.test.ts src/infra/outbound/deliver.test.tspnpm test src/cron/isolated-agent.direct-delivery-core-channels.test.ts src/cron/isolated-agent/delivery-dispatch.double-announce.test.ts src/channels/message/send.test.ts src/infra/outbound/deliver.test.tspnpm test src/cron/isolated-agent.direct-delivery-core-channels.test.ts src/cron/isolated-agent/delivery-dispatch.double-announce.test.ts src/channels/message/send.test.ts src/infra/outbound/deliver.test.ts extensions/telegram/src/outbound-adapter.test.ts extensions/feishu/src/outbound.test.ts extensions/slack/src/outbound-delivery.test.tspnpm exec oxfmt --check --threads=1 src/infra/outbound/deliver.ts src/cron/isolated-agent.direct-delivery-core-channels.test.tsgit diff --check