fix(slack-bot): prevent posting to main channel when thread message is deleted#1034
Merged
sriaradhyula merged 2 commits intomainfrom Mar 24, 2026
Merged
fix(slack-bot): prevent posting to main channel when thread message is deleted#1034sriaradhyula merged 2 commits intomainfrom
sriaradhyula merged 2 commits intomainfrom
Conversation
…s deleted Signed-off-by: Kevin Kantesaria <kkantesaria@splunk.com>
Contributor
|
✅ No proprietary content detected. This PR is clear for review! |
Contributor
📊 Test Coverage ReportMain Tests Coverage
📁 Coverage Artifacts
|
…nts.txt Signed-off-by: Kevin Kantesaria <kkantesaria@splunk.com>
Contributor
|
✅ No proprietary content detected. This PR is clear for review! |
Contributor
📊 Test Coverage ReportMain Tests Coverage
📁 Coverage Artifacts
|
sriaradhyula
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a user posts a message and deletes it before the Slack bot processes the event, the bot would post its response to the main channel instead of a thread. This happened because Slack's
chat_postMessagesilently ignores an invalidthread_tsand falls back to posting in the channel.This PR adds a multi-layer guard:
Pre-processing check (
verify_thread_existsinutils.py): Before processing any event, callsconversations_repliesto confirm the parent message still exists. If deleted, the event is dropped. Applied to all 4 entry points:handle_mention,handle_qanda_message,handle_dm_message, andhandle_ai_alert_processing.Mid-stream abort (
thread_deletedflag inai.py): If the message is deleted during A2A streaming (race condition),startStreamfails withinvalid_thread_ts. Instead of logging 30+ warnings and falling through tochat_postMessage, we set athread_deletedflag, break out of the stream loop, and drop the response.Additionally migrates the slack bot from
requirements.txt+piptopyproject.toml+uv, matching the rest of the project's dependency management:pyproject.tomlwith explicit PyPI index andunittestdependency groupDockerfile.slack-botto useuv sync --lockedcommandoverride indocker-compose.dev.yamlto handle volume-mount dev moderequirements.txtType of Change
Checklist