fix(slack): accept linear DM receipt destinations (#16494)

Accept the pinned Slack SDK linear DM address for receipt add/remove while preserving channel, source message, credential and timeout checks.

SDK regressions, 106 affected tests, repository typecheck/build, full CI/E2E, Superagent, legacy Snyk and exact-head Apex 5/5 passed.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-10-15 16:28:19 -05:00
1 parent 8843887c24
commit 89ef37d7e0
4 files changed
+38 -1

No files matched your search

+7
View File
@@ -115,6 +115,13 @@ apply. Top-level DM replies retain their linear conversation destination. Source
[queued run policy](../../server/src/services/durable-chat-wakeup.ts). Live Slack
verification of this exemption remains separate from provider-fixture coverage.
Controller-owned receipt reactions accept the SDK's empty thread timestamp for
linear DMs. Channel IDs and source message timestamps remain validated. This
does not add an agent tool or change sender, task, or credential authorization.
The pinned SDK transport regression is covered in
[receipt tests](../../server/src/services/chat-slack-receipts.test.ts); live
acknowledgement speed needs a separate provider test.
New conversations resolve typed project/workspace defaults from their endpoint
and destination under the task-creation transaction. Defaults do not authorize
private sources: admission checks the linked user's authority and assigned agent.
+5
View File
@@ -48,6 +48,11 @@ top-level replies to top-level DMs. Channel messages and thread replies still
require a mention when that setting is enabled. Disable direct messages and
confirm a plain DM is rejected. Use a private channel for threaded conversations.
During a top-level DM run, verify that the bot adds eyes to the source message
and removes them when the final reply arrives. The pinned Slack SDK encodes a
linear DM with an empty thread timestamp; receipt transport accepts that address
while still validating the channel and the source message timestamp.
### `endpoint-management`
Automated: [channel integration](../../server/src/__tests__/chat-channels.integration.test.ts) covers shared endpoint/delivery behavior; live credential repair and provider ownership remain manual checks.
@@ -1,4 +1,5 @@
import { createServer } from "node:http";
import { createSlackAdapter } from "@chat-adapter/slack";
import { describe, expect, it, vi } from "vitest";
import { classifyChatPublicationError } from "./chat-publication-errors.js";
import {
@@ -16,6 +17,27 @@ const mutation: SlackReceiptMutation = {
const token = "xoxb-synthetic-never-live";
describe("bounded Slack receipt transport", () => {
it.each(["add", "remove"] as const)(
"accepts the pinned SDK's top-level DM address for %s",
async (operation) => {
const adapter = createSlackAdapter({ botToken: token, signingSecret: "synthetic" });
const threadId = adapter.encodeThreadId({ channel: "D123", threadTs: "" });
expect(threadId).toBe("slack:D123:");
const fetch = vi.fn(async () => Response.json({ ok: true }));
await applySlackReceiptReaction(
{ ...mutation, operation, threadId, botToken: token },
fetch,
);
expect(fetch).toHaveBeenCalledOnce();
const [, init] = fetch.mock.calls[0] as unknown as [string, RequestInit];
expect(JSON.parse(String(init.body))).toEqual({
channel: "D123",
timestamp: mutation.messageId,
name: "eyes",
});
},
);
it.each(["add", "remove"] as const)(
"sends only the exact %s receipt and validates API success",
async (operation) => {
@@ -109,6 +131,9 @@ describe("bounded Slack receipt transport", () => {
it.each([
{ threadId: "slack:C123:1740000001.1:extra" },
{ threadId: "slack:evil.example:1740000001.1" },
{ threadId: "slack:D123::" },
{ threadId: "slack:D123:undefined" },
{ threadId: "slack:D123:not-a-timestamp" },
{ messageId: "1740000002.2&token=secret" },
{ reaction: "not-eyes" },
{ operation: "delete" },
+1 -1
View File
@@ -59,7 +59,7 @@ export async function applySlackReceiptReaction(
!/^[CDG][A-Z0-9]+$/.test(parts[1] ?? "") ||
parts.length < 2 ||
parts.length > 3 ||
(parts[2] !== undefined && !/^\d{1,12}\.\d{1,6}$/.test(parts[2])) ||
(parts[2] !== undefined && parts[2] !== "" && !/^\d{1,12}\.\d{1,6}$/.test(parts[2])) ||
!/^\d{1,12}\.\d{1,6}$/.test(input.messageId) ||
!["add", "remove"].includes(input.operation) ||
input.reaction !== "eyes" ||