fix(discord): suppress reasoning/thinking block payloads from delivery (#24969)

Block payloads (info.kind === "block") contain reasoning/thinking content
that should only be visible in the internal web UI. When streamMode is
"partial", these blocks were being delivered to Discord as visible
messages, leaking chain-of-thought to end users.

Add an early return for block payloads in the deliver callback,
consistent with the WhatsApp fix and Telegram's existing behavior.

Fixes #24532

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sid
2026-02-24 11:33:40 +08:00
committed by GitHub
parent c1fe688d40
commit 38da3f40cb

View File

@@ -557,6 +557,11 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
deliver: async (payload: ReplyPayload, info) => {
const isFinal = info.kind === "final";
if (info.kind === "block") {
// Block payloads carry reasoning/thinking content that should not be
// delivered to external channels. Skip them regardless of streamMode.
return;
}
if (draftStream && isFinal) {
await flushDraft();
const hasMedia = Boolean(payload.mediaUrl) || (payload.mediaUrls?.length ?? 0) > 0;