fix(slack): preserve third-party bot parents in thread context#12527
Closed
ching-kaching wants to merge 1 commit into
Closed
fix(slack): preserve third-party bot parents in thread context#12527ching-kaching wants to merge 1 commit into
ching-kaching wants to merge 1 commit into
Conversation
a94f2cf to
94ac524
Compare
The thread context fetcher filtered every message with a bot_id or bot_message subtype, which also dropped third-party bot parents (Intercom escalations, GitHub/Sentry alerts, webhook posts). When a user @-mentions the agent in such a thread, the parent message — the actual reason for the ping — never reached the model, leaving the agent to ask for clarification. Now we only skip our own bot's messages (matched against the resolved bot_uid). Other bots' messages flow through as normal context.
94ac524 to
f8811e8
Compare
Contributor
|
have the same problems, very annoying. |
Contributor
|
Closing as superseded by #16200 (via @Satoshi-agi's #12561, which included the same "keep third-party bot parents in context" fix you proposed here plus additional layers — |
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.
Problem
When an agent is @-mentioned in a Slack thread whose parent is a third-party bot (Intercom escalations, GitHub/Sentry alerts, webhook posts), the parent message — often the entire reason for the ping — never reaches the model. The agent then has to ask the user for clarification or manually fetch the thread via the Slack API.
Root cause
_fetch_thread_context()ingateway/platforms/slack.pyfiltered every message carrying abot_idorsubtype: bot_message:The comment says "our own bot messages" but the predicate matches all bots.
Fix
Match the filter against the resolved
bot_uid(already computed a few lines above). Our own replies stay excluded (no circular context); every other bot's messages flow through as normal thread context.If
bot_uidis unresolved, fall back to the old behavior (drop all bot messages) so we can't accidentally feed our own output back in.Testing
Locally reproduced with an Intercom-style bot-authored thread parent:
[investigate]ping, no parent.[Thread context —]block includes the bot parent verbatim.