#23513: fix(slack): respect replyToMode=off for inline directive reply tags
docs
channel: slack
size: XS
Cluster:
Slack Thread Management Fixes
## Summary
This ports the fix from #16113 onto current `main` and resolves the Slack reply-threading edge case where inline reply directive tags (e.g. `[[reply_to_current]]`) can still force threading even when `replyToMode: "off"`.
## Why a new PR?
`#16113` is currently marked `CONFLICTING / DIRTY`, but the root problem appears to be older branch history divergence (`unrelated histories` against current `main`), not a small line-level merge conflict. This PR re-applies the same intent on top of current `main` with updated file paths/tests.
## Behavior
- `replyToMode: "off"`: ignore inline directive `replyToId` so top-level replies stay in the channel root
- `replyToMode: "all"`: preserve existing behavior and allow directive-driven threading
- incoming thread replies remain threaded (unchanged)
## Changes
- pass `replyToMode` through `dispatchPreparedSlackMessage(...)` into `deliverReplies(...)`
- make `deliverReplies(...)` ignore directive `replyToId` when `replyToMode === "off"`
- update Slack tool-result tests to cover both `off` and `all`
- add changelog entry (ported intent from #16113)
## Tests
Ran locally:
- `pnpm exec vitest run --config vitest.unit.config.ts src/slack/monitor.tool-result.test.ts` ✅
- `pnpm exec oxfmt --check src/slack/monitor/replies.ts src/slack/monitor/message-handler/dispatch.ts src/slack/monitor.tool-result.test.ts CHANGELOG.md` ✅
## Credit
Original fix intent and test coverage direction from @zerone0x in #16113. This PR is a current-main port to get it mergeable.
## AI-assisted
- [x] AI-assisted PR (Codex)
- [x] Lightly tested (targeted unit test + formatting)
- [x] I understand what the code does
- [ ] Included prompts/session logs
Supersedes #16113
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Ports the fix from #16113 to respect `replyToMode: "off"` for inline directive reply tags like `[[reply_to_current]]`. The implementation correctly ignores `payload.replyToId` when `replyToMode === "off"` in `deliverReplies()`, and the test coverage properly validates both the `off` and `all` modes.
**Changes:**
- Modified `deliverReplies()` in `src/slack/monitor/replies.ts` to check `replyToMode` before using directive-based `replyToId`
- Passed `replyToMode` through `dispatchPreparedSlackMessage()` call chain
- Split the existing test into two cases: one for `replyToMode: "off"` (ignores directive) and one for `replyToMode: "all"` (respects directive)
- Added changelog entry
**Issues found:**
- Documentation at `docs/channels/slack.md:244` contradicts the new behavior and needs updating
<h3>Confidence Score: 4/5</h3>
- Safe to merge with one documentation fix needed
- The code changes are clean and correct, test coverage is appropriate, and the fix addresses a real bug. Score is 4 (not 5) because the documentation contradicts the new behavior and must be updated before merge to avoid user confusion.
- docs/channels/slack.md requires a documentation update to match the new behavior
<sub>Last reviewed commit: 590d75b</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23799: fix(slack): finalize replyToMode off threading behavior
by vincentkoc · 2026-02-22
89.5%
#23320: fix(slack): respect replyToMode when incomingThreadTs is auto-created
by dorukardahan · 2026-02-22
87.0%
#20406: fix(slack): respect replyToMode when computing statusThreadTs in DMs
by QuinnYates · 2026-02-18
83.7%
#23804: fix(slack): preserve string thread context in queue + DM route
by vincentkoc · 2026-02-22
81.7%
#19083: Slack: preserve per-thread context and consistent thread replies
by jkimbo · 2026-02-17
81.1%
#14720: fix(slack): pass threadId in plugin read action (#14706)
by lailoo · 2026-02-12
80.1%
#12244: fix(slack): preserve thread context for DM thread replies
by junhoyeo · 2026-02-09
79.9%
#22485: fix(slack): use threadId from delivery context as threadTs fallback...
by dorukardahan · 2026-02-21
78.8%
#20389: fix(slack): inject thread history on first thread turn, not only on...
by lafawnduh1966 · 2026-02-18
78.5%
#5098: fix(slack): forward threadId for message.read
by galligan · 2026-01-31
78.3%