Skip to content

Commit 88c76ac

Browse files
committed
fix(slack): stop sniffing the NO_REPLY product token in the transport
sendMessageSlack special-cased core's silent-reply token before any API call, returning a fabricated 'suppressed' messageId. Silent-reply stripping is owned by core auto-reply normalization before payloads reach outbound — no sibling channel transport has this check, so a literal NO_REPLY sent through the message tool delivered everywhere except Slack. The check predates the extension extraction (it moved verbatim in 8746362) and is duplicate policy. Delete the check, its sentinel mint (the only one in the repo), and the receipt filter for it; tests now pin sibling-parity delivery instead of the suppression.
1 parent 96cacfd commit 88c76ac

3 files changed

Lines changed: 9 additions & 52 deletions

File tree

‎extensions/slack/src/send.blocks.test.ts‎

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -95,52 +95,18 @@ function slackDnsRequestError(): Error {
9595
});
9696
}
9797

98-
describe("sendMessageSlack NO_REPLY guard", () => {
99-
it("suppresses NO_REPLY text before any Slack API call", async () => {
98+
describe("sendMessageSlack NO_REPLY literal", () => {
99+
// Silent-reply stripping is owned by core auto-reply normalization before
100+
// payloads reach outbound; a literal NO_REPLY sent through the message tool
101+
// must deliver on Slack exactly like every sibling channel.
102+
it("delivers a literal NO_REPLY text like sibling channels", async () => {
100103
const client = createSlackSendTestClient();
101104
const result = await sendMessageSlack("channel:C123", "NO_REPLY", {
102105
token: "xoxb-test",
103106
cfg: SLACK_TEST_CFG,
104107
client,
105108
});
106109

107-
expect(client.chat.postMessage).not.toHaveBeenCalled();
108-
expect(result.messageId).toBe("suppressed");
109-
expect(result.receipt.platformMessageIds).toStrictEqual([]);
110-
});
111-
112-
it("suppresses NO_REPLY with surrounding whitespace", async () => {
113-
const client = createSlackSendTestClient();
114-
const result = await sendMessageSlack("channel:C123", " NO_REPLY ", {
115-
token: "xoxb-test",
116-
cfg: SLACK_TEST_CFG,
117-
client,
118-
});
119-
120-
expect(client.chat.postMessage).not.toHaveBeenCalled();
121-
expect(result.messageId).toBe("suppressed");
122-
});
123-
124-
it("does not suppress substantive text containing NO_REPLY", async () => {
125-
const client = createSlackSendTestClient();
126-
await sendMessageSlack("channel:C123", "This is not a NO_REPLY situation", {
127-
token: "xoxb-test",
128-
cfg: SLACK_TEST_CFG,
129-
client,
130-
});
131-
132-
expect(client.chat.postMessage).toHaveBeenCalled();
133-
});
134-
135-
it("does not suppress NO_REPLY when blocks are attached", async () => {
136-
const client = createSlackSendTestClient();
137-
const result = await sendMessageSlack("channel:C123", "NO_REPLY", {
138-
token: "xoxb-test",
139-
cfg: SLACK_TEST_CFG,
140-
client,
141-
blocks: [{ type: "section", text: { type: "mrkdwn", text: "content" } }],
142-
});
143-
144110
expect(client.chat.postMessage).toHaveBeenCalled();
145111
expect(result.messageId).toBe("171234.567");
146112
});

‎extensions/slack/src/send.ts‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-run
1616
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
1717
import {
1818
chunkMarkdownTextWithMode,
19-
isSilentReplyText,
2019
resolveChunkMode,
2120
resolveTextChunkLimit,
2221
} from "openclaw/plugin-sdk/reply-chunking";
@@ -325,7 +324,7 @@ function createSlackSendReceipt(params: {
325324
}): MessageReceipt {
326325
const platformMessageIds = params.platformMessageIds
327326
.map((messageId) => messageId.trim())
328-
.filter((messageId) => messageId && messageId !== "unknown" && messageId !== "suppressed");
327+
.filter((messageId) => messageId && messageId !== "unknown");
329328
return createMessageReceiptFromOutboundResults({
330329
results: platformMessageIds.map((messageId) => {
331330
const result: MessageReceiptSourceResult = {
@@ -1078,14 +1077,6 @@ export async function sendMessageSlack(
10781077
if (!eventScope) {
10791078
assertSlackDetachedTargetAllowed(account.accountId, recipient.teamId);
10801079
}
1081-
if (isSilentReplyText(normalizedMessage) && !opts.mediaUrl && !opts.blocks) {
1082-
logVerbose("slack send: suppressed NO_REPLY token before API call");
1083-
return {
1084-
messageId: "suppressed",
1085-
channelId: "",
1086-
receipt: createSlackSendReceipt({ platformMessageIds: [], kind: "unknown" }),
1087-
};
1088-
}
10891080
const blocks = opts.blocks == null ? undefined : validateSlackBlocksArray(opts.blocks);
10901081
if (!normalizedMessage && !opts.mediaUrl && !blocks) {
10911082
throw new Error("Slack send requires text, blocks, or media");

‎src/infra/outbound/outbound-audit.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ function resolveConversationKind(
287287
function firstIdentifier(...values: Array<string | undefined>): string | undefined {
288288
for (const value of values) {
289289
const normalized = value?.trim();
290-
// "unknown"/"suppressed" are adapter sentinel messageIds (telegram/slack
291-
// outbound adapters), not platform identifiers; treating them as real ids
292-
// would pseudonymize a constant and corrupt correlation refs.
290+
// "unknown"/"suppressed" are adapter sentinel messageIds, not platform
291+
// identifiers; treating them as real ids would pseudonymize a constant
292+
// and corrupt correlation refs.
293293
if (normalized && normalized !== "unknown" && normalized !== "suppressed") {
294294
return normalized;
295295
}

0 commit comments

Comments
 (0)