Skip to content

fix(feishu): keep progress messages in topic threads - #17877

Closed
jlcbk wants to merge 1 commit into
NousResearch:mainfrom
jlcbk:fix/feishu-progress-thread-context
Closed

fix(feishu): keep progress messages in topic threads#17877
jlcbk wants to merge 1 commit into
NousResearch:mainfrom
jlcbk:fix/feishu-progress-thread-context

Conversation

@jlcbk

@jlcbk jlcbk commented Apr 30, 2026

Copy link
Copy Markdown

Summary

Fixes #17875.

This keeps Hermes streaming/progress messages inside the original Feishu/Lark topic thread instead of letting the first/intermediate message create a new topic.

Changes:

  • pass the inbound Feishu message id to GatewayStreamConsumer for Feishu topic-thread requests, so the first streamed/progress send can use message.reply;
  • when Feishu has no reply_to but does have metadata["thread_id"], create the message with receive_id_type="thread_id" instead of chat_id;
  • add regression coverage for both the Feishu adapter path and the stream consumer first-send path.

Test Plan

python -m pytest tests/gateway/test_feishu.py tests/gateway/test_stream_consumer.py -q

Result: 274 passed, 4 warnings in 8.25s.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/feishu Feishu / Lark adapter labels Apr 30, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Automated hermes-sweeper review: this PR's requested Feishu topic-thread behavior is already implemented on current main.

Evidence:

  • gateway/stream_consumer.py:122 and gateway/stream_consumer.py:496 add and use initial_reply_to_id, so the first streamed send can reply to the inbound message instead of going out unthreaded.
  • gateway/run.py:12650 and gateway/run.py:13703 pass event_message_id into GatewayStreamConsumer as initial_reply_to_id.
  • gateway/run.py:13159 routes Feishu progress sends with reply_to=event_message_id when a topic/thread id is present.
  • gateway/run.py:13535 carries Feishu reply_to_message_id in status/interim metadata.
  • gateway/platforms/feishu.py:4461 uses metadata reply_to_message_id as a reply fallback, and gateway/platforms/feishu.py:4478 sends thread fallbacks with receive_id_type="thread_id".
  • Regression coverage exists in tests/gateway/test_stream_consumer_thread_routing.py:35 and tests/gateway/test_stream_consumer_thread_routing.py:143.
  • The core implementation landed via cf1f392d1 with follow-ups e164a9c1e, 441ef75d1, and 28299afc2 for overflow/progress/status coverage.

Thanks for the useful focused fix; the current main implementation covers the same behavior, so this stale conflicting PR can be closed as implemented on main.

@teknium1 teknium1 closed this Jun 10, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu topic progress messages can still create new topics

3 participants