Skip to content

fix(feishu): use consistent msg_type across all message chunks - #29472

Closed
nasymonk wants to merge 1 commit into
NousResearch:mainfrom
nasymonk:fix/feishu-chunk-msg-type-consistency
Closed

fix(feishu): use consistent msg_type across all message chunks#29472
nasymonk wants to merge 1 commit into
NousResearch:mainfrom
nasymonk:fix/feishu-chunk-msg-type-consistency

Conversation

@nasymonk

Copy link
Copy Markdown

Summary

  • Determine msg_type once from the full (pre-chunk) content instead of per-chunk
  • Extract _resolve_outbound_msg_type() and _build_chunk_payload() as clean helpers
  • _build_outbound_payload() delegates to the new helpers (backward compatible — still used by edit_message)

Problem

When a long message is split by truncate_message, each chunk independently calls _build_outbound_payload. The first chunk may lack markdown hints (e.g. **bold**, ## heading) if the split point falls before the markdown-heavy section. This causes:

  • Chunk 1 → msg_type=text → raw **bold** displayed literally
  • Chunk 2+ → msg_type=post → renders correctly

Fix

Resolve msg_type once from the full formatted text before chunking, then build each chunk's payload using that consistent type.

Fixes #29471

Determine msg_type once from the full (pre-chunk) content instead of
per-chunk.  When a long message is split, the first chunk may lack
markdown hints while later chunks contain them, causing the first chunk
to be sent as msg_type=text (raw markdown) while the rest are
msg_type=post (rendered).

Fixes #26841
@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 May 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #26848 — same fix (resolve msg_type from full content before chunking). See also #16474, #18371 for alternative approaches.

@nasymonk nasymonk closed this by deleting the head repository Jul 10, 2026
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.

bug(feishu): first chunk of long messages sent as msg_type=text, breaking Markdown rendering

2 participants