Skip to content

OutboundSender.sendMarkdown/sendText drop replyTo on chunked pages (pages 2+ land in the main chat instead of the thread) #205

Description

@tkwkeven

Summary

OutboundSender.sendMarkdown and sendText chunk long content and send each chunk as a separate message. Only the first chunk carries opts.replyTo; chunks 2+ are sent as plain new messages, so a long reply that should live inside a thread (e.g. reply_in_thread: true) leaks into the main chat.

Location

channel/outbound/sender.ts:

// sendMarkdown — chunk loop
replyTo: i === 0 ? opts.replyTo : undefined,

// sendText — chunk loop
replyTo: i === 0 ? opts.replyTo : undefined,

Still present in @larksuiteoapi/node-sdk@1.73.0 (latest; lib/index.js lines ~104701 / ~104721).

Expected behavior

Every chunked page should carry replyTo (and replyInThread), so all pages stay in the same thread. Mentions are already correctly limited to the first page via convertMarkdown(chunks[i], i === 0 ? opts.mentions : undefined) — that behavior should be preserved.

Suggested fix

-            replyTo: i === 0 ? opts.replyTo : undefined,
+            replyTo: opts.replyTo,

(two occurrences: sendMarkdown and sendText)

Verification

We applied this exact two-line patch in production (patching the bundled copy in a downstream consumer) and confirmed: all chunked pages now arrive inside the thread, first page keeps mentions, no other regressions.

Repro sketch

  1. createLarkChannel({ outbound: { textChunkLimit: <small> } })
  2. Send a markdown message longer than the chunk limit with { replyTo: <msgId>, replyInThread: true }
  3. Observe: chunk 1 replies to <msgId>; chunks 2+ are created as top-level messages in the chat.

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