fix(gateway/slack): inject thread parent message into conversation context - #2952
Closed
jneeee wants to merge 1 commit into
Closed
fix(gateway/slack): inject thread parent message into conversation context#2952jneeee wants to merge 1 commit into
jneeee wants to merge 1 commit into
Conversation
…ntext When Hermes receives a message inside a Slack thread, the parent (root) message that started the thread was absent from the conversation context. Only thread reply messages were visible to the agent. Fix: call conversations.replies with limit=1 when processing a thread reply (thread_ts present and different from the message's own ts) to fetch the root message. Prepend it to the message text as '[Thread started with]: ...'. - Skip injection if the root message was posted by the bot itself - Silently ignore API errors (debug log only) to avoid crashing the handler - No injection for top-level messages or plain DMs (ts == thread_ts or no thread_ts) Fixes NousResearch#2950 Related to NousResearch#1953
Contributor
Author
|
Merged in #2956 Closed |
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.
Summary
When Hermes receives a message inside a Slack thread, the parent (root) message that started the thread was absent from the conversation context. Only thread reply messages were visible to the agent.
Root Cause
_handle_slack_messageonly processes the current event payload. There was no code to fetch the thread root message via the Slack API.Fix
Call
conversations.replieswithlimit=1when processing a thread reply (thread_tspresent and != the message's ownts), fetch the root message, and prepend it to the agent's context as[Thread started with]: ....Edge cases handled:
ts == thread_ts) or plain DMs with nothread_tsChanges
gateway/platforms/slack.py: new_fetch_thread_parent()method + injection logic in_handle_slack_messagetests/gateway/test_slack.py: newTestThreadParentInjectionclass with 5 testsTests
test_parent_message_prepended_to_texttest_parent_fetch_failure_does_not_crashtest_bot_parent_message_not_injectedtest_top_level_message_not_fetching_parentts == thread_ts→ no API calltest_no_thread_ts_skips_fetchFixes #2950
Related to #1953