fix(feishu): keep msg_type=post consistent across chunks of long markdown replies - #68122
Merged
Conversation
…ng markdown reply (#26841) Transplant of PR #26848 onto the plugin adapter path (plugins/platforms/feishu/adapter.py — the original PR targeted the since-removed gateway/platforms/feishu.py). ``send`` classifies each chunk independently, so chunk 1 of a long markdown reply (often plain prose) went out as msg_type=text while later chunks rendered as post — literal **bold**/## heading markers in the Feishu client. Lock the decision at the whole-message level: compute prefer_post once from the full formatted message and pass it to _build_outbound_payload per chunk. The original PR's per-chunk table exemption is intentionally dropped: tables now route through post/md (issue #52786 cluster fix), so the exemption would reintroduce the raw-table downgrade. Co-authored-by: Hermes Agent <hermes@nousresearch.com>
teknium1
force-pushed
the
fix/feishu-chunk-msgtype
branch
from
July 20, 2026 16:19
dcd0260 to
52bcf33
Compare
This was referenced Jul 20, 2026
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
Every chunk of a long Feishu markdown reply now goes out with a consistent
msg_type— the markdown/post decision is made once for the whole message instead of per chunk.Root cause (#26841, #29471):
send()splits replies atMAX_MESSAGE_LENGTH(8000 chars) and classified each chunk independently. Chunk 1 of a long markdown reply is often plain prose, so it went out asmsg_type=text(raw**bold**/## headingmarkers) while later chunks rendered aspost.Salvage of PR #26848 (@xxxigm) — transplanted onto the current plugin adapter path (
plugins/platforms/feishu/adapter.py; the original targeted the since-removedgateway/platforms/feishu.py), exactly as the sweeper review on that PR recommended.Stacked on #68121 (table→post fix). One deliberate divergence from the original PR: its per-chunk table exemption (tables stay
texteven underprefer_post) is dropped, because with #68121 tables route throughpostand the exemption would reintroduce the raw-table downgrade.Changes
plugins/platforms/feishu/adapter.py:send()computesprefer_post = bool(_MARKDOWN_HINT_RE.search(formatted))once before chunking;_build_outbound_payload()gains a keyword-onlyprefer_postflagtests/gateway/test_feishu.py: 2 regression tests — multi-chunk markdown sends every chunk aspost(was["text", "post"]); plain-text messages are not upgraded byprefer_postValidation
text, chunk 2postposttexttext(unchanged)scripts/run_tests.sh tests/gateway/test_feishu.py tests/gateway/test_feishu_table_markdown.py→ 217 passed, 0 failedResolves #26841 and #29471.
Infographic