Skip to content

bug: NO_REPLY suppression bypassed for thread-based and structured-content delivery #45909

Closed

Description

@kiki830621

Summary

SILENT_REPLY_TOKEN (NO_REPLY) suppression only works in the finalizeTextDelivery path. When useDirectDelivery = true (thread-based delivery or structured content), the check is skipped and the literal string NO_REPLY is delivered to the channel.

Root cause

delivery-dispatch.ts:

const useDirectDelivery =
  params.deliveryPayloadHasStructuredContent || params.resolvedDelivery.threadId != null;
if (useDirectDelivery) {
  // deliverViaDirect — no SILENT_REPLY_TOKEN check
} else {
  // finalizeTextDelivery — has the check at line 494
}

The NO_REPLY check at line 494 is inside finalizeTextDelivery, which is only called when useDirectDelivery is false.

Expected behavior

NO_REPLY should suppress delivery regardless of delivery path. A cron job using --thread or returning structured content should not leak NO_REPLY as a literal message.

Suggested fix

Move the SILENT_REPLY_TOKEN check before the useDirectDelivery branch so it applies to both paths.

Found while working on #45903.

Activity

  1. jackjin1997 commented on Mar 14, 2026

    @jackjin1997
    Contributor

    Confirmed the root cause. In src/cron/isolated-agent/delivery-dispatch.ts, the SILENT_REPLY_TOKEN check at line 494 only runs inside finalizeTextDelivery. When useDirectDelivery = true (because threadId != null or structured content), deliverViaDirect is called instead — and it has no NO_REPLY gate, so the literal string gets sent to the channel.

    Fix is straightforward: move the suppression check before the useDirectDelivery branch so both delivery paths are covered. Also guards against deliveryPayloads containing only NO_REPLY text items.

    PR incoming.

  2. added a commit that references this issue on Mar 18, 2026
    a0e1109
  3. steipete commented on Apr 25, 2026

    @steipete
    Contributor

    Closing this as implemented after Codex review.

    Current main already suppresses NO_REPLY on the direct-delivery path used for structured-content and threaded cron delivery, and the latest release tag contains the same implementation and regression test coverage.

    What I checked:

    • Direct-delivery path filters silent replies before outbound send: normalizeSilentReplyText strips exact/leading/trailing silent tokens, and deliverViaDirect maps every direct-delivery payload through that helper before calling the outbound adapter. Silent-only payload sets short-circuit to finishSilentReplyDelivery() instead of sending. (src/cron/isolated-agent/delivery-dispatch.ts:44, f03252aaf9cc)
    • Issue path still goes through the filtered direct-delivery branch: The structured-content/threaded branch sets useDirectDelivery and calls deliverViaDirectAndCleanup, so the silent-token filtering now applies to exactly the path described in the issue. (src/cron/isolated-agent/delivery-dispatch.ts:825, f03252aaf9cc)
    • Regression tests cover the reported direct-delivery leak: The test suite includes a structured-content direct-delivery case asserting NO_REPLY does not reach deliverOutboundPayloads, plus direct-delivery whitespace and trailing-token variants. (src/cron/isolated-agent/delivery-dispatch.double-announce.test.ts:821, f03252aaf9cc)
    • Latest shipped release already contains the same code and test: Diffing v2026.4.22 (00bd2cf7a376f1fba26291c6c4766f1f15cbdfa5) against current main for the affected implementation and regression-test files returns no diff, so the fix is already shipped in the latest release. (00bd2cf7a376)

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review notes: reviewed against f03252aaf9cc; fix evidence: release v2026.4.22, commit 00bd2cf7a376.

  4. locked as resolved and limited conversation to collaborators on Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions