feat(feishu): add FEISHU_AUTO_THREAD for automatic thread replies - #11405
feat(feishu): add FEISHU_AUTO_THREAD for automatic thread replies#11405nick2781 wants to merge 1 commit into
Conversation
When FEISHU_AUTO_THREAD=true, all Feishu replies are sent with reply_in_thread=true, causing Feishu to automatically create a thread for each new conversation. This isolates session context per thread, preventing unrelated conversations from mixing and exhausting the context window. Implementation: - Track last inbound message_id per chat_id in FeishuAdapter - When auto_thread is on and no reply_to is provided, use the tracked message_id so the reply API (which supports reply_in_thread) is used instead of the create API - Pass initial reply_to to GatewayStreamConsumer for streaming replies to also land in threads - Env var defaults to false for backward compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@teknium1 Is there somebody can do the code review? |
|
Thanks for the clear Feishu threading investigation and for covering both ordinary and streaming reply paths. This automated hermes-sweeper review is closing the PR under the standing configuration policy:
Please re-scope a follow-up around Feishu YAML configuration through the plugin bridge, preserving Automated hermes-sweeper review. Closed as not-planned per standing maintainer policy ( |
Summary
FEISHU_AUTO_THREADenv var (default:false) that, when enabled, makes all Feishu replies land inside threads automaticallyHow it works
Feishu's
replyAPI supports areply_in_threadflag, but thecreateAPI does not. Many code paths (streaming, agent tool calls) usecreatebecause they don't have areply_tomessage ID.This PR:
message_idperchat_idinFeishuAdapter_send_raw_message, whenFEISHU_AUTO_THREAD=trueand noreply_tois provided, automatically uses the tracked message ID — routing through thereplyAPI withreply_in_thread=truereply_totoGatewayStreamConsumerso streaming replies also land in threadsConfiguration
# In ~/.hermes/.env FEISHU_AUTO_THREAD=trueDefaults to
false— no behavior change for existing users.Test plan
reply_in_thread=trueis set in the reply API callFEISHU_AUTO_THREAD, behavior is unchanged🤖 Generated with Claude Code