Skip to content

[Bug]: Feishu batch sends ignore the outbound thread ID #4327

Closed

Description

@pengmoubuaixuexi

Describe the bug

When a caller supplies an OutboundAddress with a nonblank threadId, Feishu's ordinary send path posts each message to the chat-level create-message endpoint. The receipt-based path for the same address uses the thread-reply endpoint. A caller using FeishuChannel.deliver(address, messages) can therefore send replies to the parent chat instead of the selected thread.

To Reproduce

  1. Use the loopback server in FeishuOutboundClientTest. Return its normal token response and a successful send response ({"code":0,"data":{"message_id":"om-1"}}). Record the request URIs for the message endpoint.
  2. Call client.send(new OutboundAddress("feishu", null, "feishu:GROUP:chat-1", "om-root"), List.of(text("one"), text("two"))).block().
  3. Compare both outgoing request URIs with the expected thread reply. No Feishu account or network service is needed.

Expected behavior

Both requests should use POST /open-apis/im/v1/messages/om-root/reply, matching the supplied address and the existing receipt-based routing. Sending to an address without a thread should still create a chat message.

Error messages

No transport error is emitted. Both actual URIs were /open-apis/im/v1/messages?receive_id_type=chat_id. A regression assertion on the two URIs failed on main; the other two tests in the class passed.

Environment

  • AgentScope Java 2.1.0-SNAPSHOT, main b5159827fe5835489e6fb8a69dc582d26da53c65
  • Java 17, Windows, Maven
  • mvn -B -T1C -pl :agentscope-extensions-channel-feishu -am -Dtest=FeishuOutboundClientTest -Dsurefire.failIfNoSpecifiedTests=false test

Additional context

OutboundAddress.threadId is documented as the context for threaded replies. In FeishuOutboundClient, ordinary sends call sendOneReceipt with a null thread, whereas sendWithReceipt passes address.threadId(). The smaller fix can reuse the existing reply builder. This reproduction supplies a threaded address explicitly and does not rely on inbound Feishu event mapping.

I am working on the fix and a loopback regression test and will submit the linked PR. Please assign this issue to me if assignment is required. AI assistance was used for investigation and testing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions