#9181: feat(slack): add per-channel thread config override
channel: slack
stale
Cluster:
Slack Thread Management Improvements
## Summary
Allow per-channel thread configuration overrides for Slack channels:
```json
{
"channels": {
"slack": {
"channels": {
"C0ACCNGH6DV": {
"thread": {
"inheritParent": true,
"historyScope": "thread"
}
}
}
}
}
}
```
## Problem
Currently, `thread.inheritParent` and `thread.historyScope` are global settings that apply to all Slack threads. Some channels (like Sentry alert channels) benefit from threads inheriting parent context, while other busy channels would have bloated context if enabled globally.
## Solution
Add optional `thread` config to `SlackChannelConfig`, allowing per-channel overrides for:
- `inheritParent`: Whether thread sessions inherit the parent channel transcript
- `historyScope`: Whether thread history is isolated per-thread or shared
Per-channel settings take precedence over global settings.
## Changes
- `src/config/types.slack.ts`: Added `thread?: SlackThreadConfig` to `SlackChannelConfig`
- `src/config/zod-schema.providers-core.ts`: Added thread schema to channel config validation
- `src/slack/monitor/channel-config.ts`: Added thread to resolved channel config
- `src/slack/monitor/message-handler/prepare.ts`: Check per-channel thread config before falling back to global
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds per-channel Slack thread behavior overrides by extending `SlackChannelConfig` with an optional `thread` block, validating it in the providers-core Zod schema, carrying it through Slack channel config resolution, and using the resolved overrides in message preparation when computing session/history keys.
This fits into the existing Slack monitor flow where `resolveSlackChannelConfig` produces a per-channel effective config (with wildcard fallback), and `prepareSlackMessage` uses that to decide routing/mentions/history/session scoping; the PR makes thread inheritance/history-scope configurable at the same per-channel layer as other channel settings.
<h3>Confidence Score: 3/5</h3>
- This PR is close to mergeable but has a couple concrete issues to address first.
- Core logic for per-channel thread overrides is consistent end-to-end (types → schema → resolution → usage), but the Slack monitor context typing wasn’t updated to include the new `thread` field, and a new root `package-lock.json` was added despite the repo using pnpm lockfiles, which will create lockfile/tooling drift.
- src/slack/monitor/context.ts, package-lock.json
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#10686: fix(slack): use thread-level sessions for channels to prevent conte...
by pablohrcarvalho · 2026-02-06
83.1%
#19083: Slack: preserve per-thread context and consistent thread replies
by jkimbo · 2026-02-17
82.3%
#2917: Slack: fix thread context + prevent reply spillover
by SocialNerd42069 · 2026-01-27
80.8%
#19403: feat(slack): add dm.threadSession option for per-message thread ses...
by Vasiliy-Bondarenko · 2026-02-17
79.7%
#5935: fix(slack): persist thread starter body across thread messages
by thisischappy · 2026-02-01
79.1%
#16223: feat(slack): sticky thread routing — bypass @mention in active threads
by iamfuntime · 2026-02-14
78.9%
#12199: fix(message): add threadId parameter to fetch schema for Slack thre...
by dbg-vanie · 2026-02-09
78.9%
#20389: fix(slack): inject thread history on first thread turn, not only on...
by lafawnduh1966 · 2026-02-18
78.8%
#22433: Slack: fix thread context loss after session reset
by stgarrity · 2026-02-21
78.8%
#22485: fix(slack): use threadId from delivery context as threadTs fallback...
by dorukardahan · 2026-02-21
78.6%