Skip to content

The open-source app everyone uses to manage agents at work

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

Dotta89ef37d7e0ca
diff --git a/maps/agent-access-map/chat-channels.md b/maps/agent-access-map/chat-channels.md
index df9e94958e..d6c50529ea 100644
--- a/maps/agent-access-map/chat-channels.md
+++ b/maps/agent-access-map/chat-channels.md
@@ -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.
diff --git a/maps/feature-map/chat-channels.md b/maps/feature-map/chat-channels.md
index 1a5854af39..c304e62905 100644
--- a/maps/feature-map/chat-channels.md
+++ b/maps/feature-map/chat-channels.md
@@ -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.
diff --git a/server/src/services/chat-slack-receipts.test.ts b/server/src/services/chat-slack-receipts.test.ts
index 312ad02c5f..213f61b0a5 100644
--- a/server/src/services/chat-slack-receipts.test.ts
+++ b/server/src/services/chat-slack-receipts.test.ts
@@ -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" },
diff --git a/server/src/services/chat-slack-receipts.ts b/server/src/services/chat-slack-receipts.ts
index 4bf6bbaa30..4a8e25e50c 100644
--- a/server/src/services/chat-slack-receipts.ts
+++ b/server/src/services/chat-slack-receipts.ts
@@ -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" ||