





















@@ -104,6 +104,23 @@ function formatDiscordReplyDeliveryFailure(params: {
104104return `discord ${params.kind} reply failed (${context}): ${String(params.err)}`;
105105}
106106107+type DiscordReplySkipReason = "aborted before delivery" | "reasoning payload";
108+109+export function formatDiscordReplySkip(params: {
110+kind: "tool" | "block" | "final";
111+reason: DiscordReplySkipReason;
112+target: string;
113+sessionKey?: string;
114+}) {
115+const context = [
116+`target=${params.target}`,
117+params.sessionKey ? `session=${params.sessionKey}` : undefined,
118+]
119+.filter(Boolean)
120+.join(" ");
121+return `discord ${params.kind} reply skipped (${params.reason}): ${context}`;
122+}
123+107124type DiscordMessageProcessObserver = {
108125onFinalReplyStart?: () => void;
109126onFinalReplyDelivered?: () => void;
@@ -528,11 +545,29 @@ export async function processDiscordMessage(
528545humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
529546deliver: async (payload: ReplyPayload, info) => {
530547if (isProcessAborted(abortSignal)) {
548+// Surface so operators don't chase missing replies when an abort
549+// drops a model-produced text payload (see PR for the incident).
550+logVerbose(
551+formatDiscordReplySkip({
552+kind: info.kind,
553+reason: "aborted before delivery",
554+target: deliverTarget,
555+sessionKey: ctxPayload.SessionKey,
556+}),
557+);
531558return;
532559}
533560const isFinal = info.kind === "final";
534561if (payload.isReasoning) {
535562// Reasoning/thinking payloads should not be delivered to Discord.
563+logVerbose(
564+formatDiscordReplySkip({
565+kind: info.kind,
566+reason: "reasoning payload",
567+target: deliverTarget,
568+sessionKey: ctxPayload.SessionKey,
569+}),
570+);
536571return;
537572}
538573if (isFinal) {
@@ -699,6 +734,16 @@ export async function processDiscordMessage(
699734}
700735}
701736if (isProcessAborted(abortSignal)) {
737+// Mirror the entry-point abort log so a mid-deliver abort (after
738+// the preview path bowed out) does not silently drop the reply.
739+logVerbose(
740+formatDiscordReplySkip({
741+kind: info.kind,
742+reason: "aborted before delivery",
743+target: deliverTarget,
744+sessionKey: ctxPayload.SessionKey,
745+}),
746+);
702747return;
703748}
704749@@ -732,7 +777,7 @@ export async function processDiscordMessage(
732777}
733778},
734779onError: (err, info) => {
735-runtime.error?.(
780+runtime.error(
736781danger(
737782formatDiscordReplyDeliveryFailure({
738783kind: info.kind,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。