fix: auto-detect Feishu receive_id_type from ID prefix#10040
Open
nightq wants to merge 2 commits into
Open
Conversation
added 2 commits
April 15, 2026 11:41
Fixes NousResearch#9999 Root cause: _sanitize_api_messages compared raw tool_call_id strings without stripping whitespace, causing valid tool results to be treated as orphaned when IDs had leading/trailing spaces. Fix: strip whitespace in _get_tool_call_id_static and when collecting result_call_ids from tool messages.
Fixes NousResearch#9980 Root cause: _send_raw_message hardcoded 'chat_id' as receive_id_type, causing [230001] invalid receive_id errors when sending to user open_ids (prefix 'ou_') or union_ids (prefix 'on_'). Fix: Add _detect_receive_id_type() that checks ID prefix (oc_→chat_id, ou_→open_id, on_→union_id) and use it in _send_raw_message.
Collaborator
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.
Summary
Fixes Feishu message delivery failing with
[230001] invalid receive_idwhen sending to user open_ids (ou_) or union_ids (on_).Root Cause
_send_raw_message()hardcodedreceive_id_type='chat_id'for all messages. Feishu's API requires different receive_id_type values based on the ID format:ou_) →open_idoc_) →chat_idon_) →union_idFix
Added
_detect_receive_id_type()static method that auto-detects the correct type from the ID prefix, and integrated it into_send_raw_message().Test Plan
Closes #9980