Skip to content

fix: auto-detect Feishu receive_id_type from ID prefix#10040

Open
nightq wants to merge 2 commits into
NousResearch:mainfrom
nightq:fix/issue-9980-feishu-receive-id
Open

fix: auto-detect Feishu receive_id_type from ID prefix#10040
nightq wants to merge 2 commits into
NousResearch:mainfrom
nightq:fix/issue-9980-feishu-receive-id

Conversation

@nightq

@nightq nightq commented Apr 15, 2026

Copy link
Copy Markdown

Summary

Fixes Feishu message delivery failing with [230001] invalid receive_id when sending to user open_ids (ou_) or union_ids (on_).

Root Cause

_send_raw_message() hardcoded receive_id_type='chat_id' for all messages. Feishu's API requires different receive_id_type values based on the ID format:

  • User ID (ou_) → open_id
  • Group ID (oc_) → chat_id
  • Union ID (on_) → union_id

Fix

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

  • 5 new unit tests for all ID prefix variants
  • Existing Feishu tests still pass

Closes #9980

nightq 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.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter comp/gateway Gateway runner, session dispatch, delivery labels Apr 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #7769 — same fix: auto-detect Feishu receive_id_type from ID prefix. Also related to #13725 which bundles the same fix.

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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu: send to user open_id fails with [230001] invalid receive_id

2 participants