hermes - 💡(How to fix) Fix Slack gateway should provide nearby/parent context for top-level references like 'this bug report'

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

The Slack adapter only passes content that is present on the current Slack event after extraction. Existing code does extract current-message rich text blocks, block payloads, and current-message link unfurls, and it fetches thread context only when the inbound event is a thread reply with no active session. But a top-level message that references nearby/channel-visible context (“this bug report”) has no automatic context fetch, and the agent has no Slack API tool to retrieve the referenced message afterward.

Relevant code paths:

  • gateway/platforms/slack.py::_extract_text_from_slack_blocks
  • gateway/platforms/slack.py::_serialize_slack_blocks_for_agent
  • gateway/platforms/slack.py::_handle_message_event around current-message block/attachment extraction and thread-context guard
  • gateway/platforms/slack.py::_fetch_thread_context

Code Example

[Baxter Black] please identify the root cause of this bug report. I saw several fire off today. Once you identify the root cause, please open up an issue to track its solution.

---

2026-05-24 17:47:16,652 INFO gateway.run: inbound message: platform=slack user=Baxter Black chat=C0B2G926UD6 msg='please identify the root cause of this bug report. I saw several fire off today.'
RAW_BUFFERClick to expand / collapse

Problem

A Slack user can ask Hermes to act on “this bug report” / “the report above” from a new top-level message or otherwise non-inlined Slack context, but the agent receives only the literal user text and cannot see the referenced report. The result is that Hermes cannot perform root-cause analysis or file a follow-up issue without asking the user to paste the report again.

Evidence from a real Slack turn

  • Platform/session: Slack group C0B2G926UD6, thread/session key 1779667204.507899
  • User message delivered to the agent:
    [Baxter Black] please identify the root cause of this bug report. I saw several fire off today. Once you identify the root cause, please open up an issue to track its solution.
  • The persisted session (~/.hermes/sessions/session_20260524_174716_df712e34.json) contains no Slack blocks, attachments, quoted text, parent/thread context, link unfurl content, or prior message body for the referenced bug report.
  • Gateway logs only show the same lossy inbound text:
    2026-05-24 17:47:16,652 INFO gateway.run: inbound message: platform=slack user=Baxter Black chat=C0B2G926UD6 msg='please identify the root cause of this bug report. I saw several fire off today.'

Root cause

The Slack adapter only passes content that is present on the current Slack event after extraction. Existing code does extract current-message rich text blocks, block payloads, and current-message link unfurls, and it fetches thread context only when the inbound event is a thread reply with no active session. But a top-level message that references nearby/channel-visible context (“this bug report”) has no automatic context fetch, and the agent has no Slack API tool to retrieve the referenced message afterward.

Relevant code paths:

  • gateway/platforms/slack.py::_extract_text_from_slack_blocks
  • gateway/platforms/slack.py::_serialize_slack_blocks_for_agent
  • gateway/platforms/slack.py::_handle_message_event around current-message block/attachment extraction and thread-context guard
  • gateway/platforms/slack.py::_fetch_thread_context

Proposed solution

Make Slack contextual references recoverable for the agent, at least on first turn:

  1. When a Slack message is top-level but contains deictic/reference phrases such as this, above, previous, bug report, report above, or when it has Slack permalink/quote metadata, fetch a small, bounded channel context window before the current message and prepend it similarly to thread context.
  2. Include parent/quoted/forwarded Slack message content whenever Slack sends metadata for a share, permalink, quote, or is_msg_unfurl instead of dropping it unconditionally.
  3. Add a user-facing diagnostic marker when context retrieval fails, e.g. [Slack context fetch failed: missing channels:history permission], so the agent knows whether to ask for a paste vs. investigate.
  4. Add tests covering:
    • top-level message that references a prior bug-report message in the channel;
    • thread reply context fetch remains unchanged;
    • quoted/forwarded message blocks are still extracted;
    • message-unfurl attachments are included safely without echo loops.

Acceptance criteria

  • In Slack, if a user starts a new top-level Hermes request like “identify the root cause of this bug report” immediately after a bug-report post, the agent receives enough nearby context to identify which report is referenced.
  • If Slack permissions prevent context retrieval, the agent receives an explicit diagnostic in the prompt instead of silently seeing only the ambiguous text.
  • Existing thread-context behavior and self-bot echo protections remain intact.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING