fix(slack): fall back to attachment text in thread context for bot messages - #33493
fix(slack): fall back to attachment text in thread context for bot messages#33493liuhao1024 wants to merge 1 commit into
Conversation
…ssages Bot messages from monitoring tools (Datadog, PagerDuty, Grafana) often have empty top-level text with all content in attachments[].text or attachments[].fallback. _fetch_thread_context silently dropped these, leaving Hermes unaware of the thread origin. Fall back to attachments[].text then attachments[].fallback when the top-level text is empty, so alert context is preserved in thread replies. Fixes NousResearch#33469
|
Please approve this, my team needs this change ASAP |
|
Thanks for the focused regression coverage. The reported defect is still present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
Heads up: this PR edits |
|
Closing as superseded by #69316 (merged): targeted the pre-plugin-migration gateway/platforms/slack.py which no longer exists; functionality covered on the plugin path. Thanks for digging into this — the consolidated fix stands on the cluster's collective analysis, and your work is credited in #69316's summary. |
What does this PR do?
Bot messages from monitoring tools (Datadog, PagerDuty, Grafana, etc.) often use the legacy Slack "attachments" format instead of top-level text. When Hermes is @mentioned in a thread whose parent was posted by such a bot, the parent message is silently dropped from thread context because its top-level
textfield is empty — the actual content lives inattachments[].textorattachments[].fallback.This fix adds a fallback: when
msg_textis empty, the code now checksattachments[].textthenattachments[].fallbackbefore skipping the message.Related Issue
Fixes #33469
Type of Change
Changes Made
How to Test
pytest tests/ -q— all tests should passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture and workflows — or N/ACode Intelligence
gateway/platforms/slack.py_fetch_thread_context(callers: 1 — message handler)_fetch_thread_parent_textuses the same cache; no changes needed there since it has its own fallback logicFixes #33469