fix(gateway): resolve Feishu thread reply failures (error 99992402) - #37322
Open
sunguangran wants to merge 1 commit into
Open
fix(gateway): resolve Feishu thread reply failures (error 99992402)#37322sunguangran wants to merge 1 commit into
sunguangran wants to merge 1 commit into
Conversation
Contributor
|
Thanks for tracing the Feishu thread-delivery failure. The underlying bug remains on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When the Hermes gateway replies to a message inside a Feishu topic/thread, two issues cause delivery failures:
Error 99992402 — Feishu rejects
post-type messages sent via the reply endpoint in certain thread contexts. The existing code only caught_POST_CONTENT_INVALID_REpatterns but not this specific error code, so the fallback totexttype was never triggered.Missing thread root resolution — Feishu does not support
receive_id_type=thread_idon theim.v1.message.createendpoint. When a thread message arrives with athread_idbut no explicitreply_to_message_id, the gateway has no way to route the reply into the thread. The original code attempted to usethread_idasreceive_iddirectly, which silently fails or posts to the wrong location.This PR adds:
99992402detection alongside the existing post-content-invalid regex, triggering the samepost→textfallback path._resolve_thread_root()helper that callsim.v1.message.listwithcontainer_id_type=threadto find the root message of a thread, then uses thereplyAPI to post into the correct thread context.Related Issue
N/A — discovered in production with Feishu topic-based group chats.
Type of Change
Changes Made
gateway/platforms/feishu.py:99992402to the error detection in the post-send try/except block, so thepost→textfallback triggers on this error code too.99992402to the response-level fallback detection (when the API returns an error in the response body rather than raising).99992402to the retry-loop error detection in_feishu_send_with_retry._resolve_thread_root(thread_id)method that queriesim.v1.message.listto find the root message of a Feishu thread (the message with noparent_id)._send_message_to_chat(), whenthread_idis present but noreply_to_message_idis available, calls_resolve_thread_root()to resolve the thread root and uses the reply API.thread_idasreceive_idwithreceive_id_type=thread_id(unsupported by Feishu API).How to Test
Tested on macOS 15 with Feishu Open Platform API v1.
Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
cli-config.yaml.example— N/ACONTRIBUTING.mdorAGENTS.md— N/AScreenshots / Logs
Before fix — error 99992402 in logs:
After fix — thread root resolved and reply succeeds: