hermes - ✅(Solved) Fix Slack streamed replies can duplicate after transient final edit failure [1 pull requests, 1 participants]

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…
GitHub stats
NousResearch/hermes-agent#25256Fetched 2026-05-14 03:47:47
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×1

Root Cause

Root cause hypothesis

GatewayStreamConsumer can display the complete final answer via an earlier streaming edit that still includes the cursor. If the later finalize=True edit fails transiently (Slack chat.update / rate-limit style failure), final_response_sent remains false. The outer gateway then assumes the final answer was not delivered and posts the full response again as a new message.

Fix Action

Fixed

PR fix notes

PR #25258: Fix duplicate Slack final replies after stream finalize failure

Description (problem / solution / changelog)

Summary

  • Prevent duplicate final Slack replies when a streamed message already shows the complete answer but the final chat.update/finalize edit fails transiently.
  • Add _visible_matches_final() to confirm the visible streamed body equals the cleaned final response before suppressing the normal gateway fallback send.
  • Add regression coverage for the finalize-failure path.

Fixes #25256

Test plan

  • python -m pytest tests/gateway/test_stream_consumer.py::TestFinalizeDuplicateSuppression -q
  • python -m pytest tests/gateway/test_stream_consumer.py tests/gateway/test_stream_consumer_draft.py -q

Changed files

  • gateway/stream_consumer.py (modified, +26/-0)
  • tests/gateway/test_stream_consumer.py (modified, +47/-0)
RAW_BUFFERClick to expand / collapse

Problem

Slack users can see the same final Hermes reply posted twice in a thread after a long streamed response.

Observed in a Slack thread on 2026-05-13: the gateway log showed the normal final send after a streamed/edited answer path, and the user reported the answer appeared twice.

Root cause hypothesis

GatewayStreamConsumer can display the complete final answer via an earlier streaming edit that still includes the cursor. If the later finalize=True edit fails transiently (Slack chat.update / rate-limit style failure), final_response_sent remains false. The outer gateway then assumes the final answer was not delivered and posts the full response again as a new message.

That fallback is correct when the visible preview is partial, but wrong when the visible streamed text already matches the final cleaned response.

Expected behavior

If the visible streamed message already equals the final cleaned response, a transient finalize edit failure should be treated as delivered. The gateway may best-effort strip the cursor, but it must not post the identical final body as a fresh message.

Acceptance criteria

  • Add regression coverage for a streamed Slack-like response where the final edit fails after the previous visible message already contains the complete final content.
  • Mark stream delivery as confirmed in that exact case so the normal gateway final-send path is suppressed.
  • Preserve fallback behavior when only partial text is visible.

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…

FAQ

Expected behavior

If the visible streamed message already equals the final cleaned response, a transient finalize edit failure should be treated as delivered. The gateway may best-effort strip the cursor, but it must not post the identical final body as a fresh message.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Slack streamed replies can duplicate after transient final edit failure [1 pull requests, 1 participants]