Skip to content

[Feature]: Add opt-out config for thread participation auto-reply (#29165) #31728

@carrotRakko

Description

@carrotRakko

Summary

Add a config option to disable the thread participation auto-reply behavior introduced in #29165, so operators can opt out of the bot auto-responding in threads it has previously participated in.

Problem to solve

PR #29165 added always-on thread participation tracking: once the bot replies in a Slack thread, it auto-responds to all subsequent messages in that thread without requiring @mention. This bypasses the existing requireMention gating, with no way to opt out.

Two issues with the current implementation:

  1. No opt-out: Operators who set requireMention (explicitly or via the default true) expect mention gating to apply consistently. The thread participation cache silently bypasses this contract — the bot responds to non-mentioned messages in threads where it has previously replied, even though requireMention is true.

  2. Non-deterministic behavior from volatile cache: The participation cache is in-memory only (24h TTL, 5000-entry soft cap, no persistence). This means:

    • Process restart clears all participation data → bot stops auto-replying in previously active threads
    • Cache eviction under load → same effect for oldest entries
    • TTL expiry → threads older than 24h lose auto-reply silently

    From the user's perspective: the bot replies without mention for a while, then suddenly stops, then starts again after a new mention. The behavior is correct from the code's perspective but unpredictable from the user's.

Proposed solution

Add a config option under channels.slack.thread:

channels:
  slack:
    thread:
      autoReplyOnParticipation: true  # default: true (preserves current behavior)

When false, the hasSlackThreadParticipation() check in prepareSlackMessage() is skipped, and implicitMention only fires for parent_user_id === botUserId (the pre-#29165 behavior).

This is a minimal, backward-compatible change — one boolean config check wrapping the existing hasSlackThreadParticipation call.

Alternatives considered

Impact

  • Affected: Operators using requireMention (default true) in Slack channels with threaded conversations
  • Severity: Medium — bot responds to messages it shouldn't, creating noise in busy channels
  • Frequency: Every thread where the bot participates
  • Consequence: Unwanted bot responses in threads, undermining the requireMention contract. Non-deterministic behavior after restarts/eviction confuses users.

Evidence/examples

Additional information

The proposed config key autoReplyOnParticipation aligns with the existing SlackThreadConfig pattern (historyScope, inheritParent, initialHistoryLimit).

✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions