From facf5c09a01ea1924ade91f454b85cc71aa903b4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 9 Jan 2026 15:38:43 +0000 Subject: [PATCH] fix: honor slack reply threading (#574, thanks @bolismauro) --- CHANGELOG.md | 1 + src/auto-reply/reply/followup-runner.ts | 1 + src/slack/monitor.tool-result.test.ts | 2 +- src/slack/monitor.ts | 10 +++------- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a626c42d..ff4095aed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Node bridge: harden keepalive + heartbeat handling (TCP keepalive, better disconnects, and keepalive config tests). (#577) — thanks @steipete - CLI: add `sandbox list` and `sandbox recreate` commands for managing Docker sandbox containers after image/config updates. (#563) — thanks @pasogott - Providers: add Microsoft Teams provider with polling, attachments, and CLI send support. (#404) — thanks @onutc +- Slack: honor reply tags + replyToMode while keeping threaded replies in-thread. (#574) — thanks @bolismauro - Commands: accept /models as an alias for /model. - Models/Auth: show per-agent auth candidates in `/model status`, and add `clawdbot models auth order {get,set,clear}` (per-agent auth rotation overrides). — thanks @steipete - Debugging: add raw model stream logging flags and document gateway watch mode. diff --git a/src/auto-reply/reply/followup-runner.ts b/src/auto-reply/reply/followup-runner.ts index 895269adf..ea88f45d3 100644 --- a/src/auto-reply/reply/followup-runner.ts +++ b/src/auto-reply/reply/followup-runner.ts @@ -196,6 +196,7 @@ export function createFollowupRunner(params: { | undefined); const applyReplyToMode = createReplyToModeFilter( resolveReplyToMode(queued.run.config, replyToChannel), + { allowTagsWhenOff: replyToChannel === "slack" }, ); const replyTaggedPayloads: ReplyPayload[] = applyReplyThreading({ diff --git a/src/slack/monitor.tool-result.test.ts b/src/slack/monitor.tool-result.test.ts index bd21f2701..49298bd20 100644 --- a/src/slack/monitor.tool-result.test.ts +++ b/src/slack/monitor.tool-result.test.ts @@ -291,7 +291,7 @@ describe("monitorSlackProvider tool results", () => { }, slack: { dm: { enabled: true, policy: "open", allowFrom: ["*"] }, - replyToMode: "first", + replyToMode: "off", }, }; diff --git a/src/slack/monitor.ts b/src/slack/monitor.ts index ffcbd105c..7a33e17a7 100644 --- a/src/slack/monitor.ts +++ b/src/slack/monitor.ts @@ -1101,14 +1101,10 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) { const incomingThreadTs = message.thread_ts; const eventTs = message.event_ts; + const messageTs = message.ts ?? eventTs; const replyThreadTs = - replyToMode === "all" - ? (incomingThreadTs ?? message.ts ?? eventTs) - : replyToMode === "first" - ? incomingThreadTs - : undefined; - const statusThreadTs = - replyThreadTs ?? incomingThreadTs ?? message.ts ?? eventTs; + incomingThreadTs ?? (replyToMode === "all" ? messageTs : undefined); + const statusThreadTs = replyThreadTs ?? messageTs; let didSetStatus = false; const onReplyStart = async () => { didSetStatus = true;