#17327: fix: LINE mixed rich reply order is reversed
channel: line
stale
size: XS
trusted-contributor
Cluster:
Model Reasoning Fixes
## Summary
When a LINE reply contains both a markdown table and `[[buttons:...]]`, the pagination/template card now appears AFTER the detail table card, instead of before. This fixes user confusion where summary/pagination appeared before details.
## Changes
- Reordered `sendPayload` function in LINE channel to send markdown table flex messages BEFORE template/button messages
- Added comment explaining the ordering rationale
## Testing
- All 7 existing tests in `channel.sendPayload.test.ts` pass
- No changes to test files required as this is a behavior fix for a bug
Fixes openclaw/openclaw#17308
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes the ordering of LINE rich reply messages so that markdown table flex cards are sent before template/button messages, ensuring users see details before pagination/buttons. The fix correctly reorders the non-batched send path.
- Moved the `templateMessage` send block after the `processed.flexMessages` loop in the `!shouldSendQuickRepliesInline` branch
- Added clarifying comments explaining the ordering rationale
- The same ordering issue exists in the `shouldSendQuickRepliesInline` batch path (lines 464-485), where `templateMessage` is still pushed into the array before `processed.flexMessages` — this should also be swapped for consistency
<h3>Confidence Score: 3/5</h3>
- The fix is correct for its targeted code path, but an analogous ordering issue remains unfixed in the quick-reply batch path.
- The reorder in the non-batched path is straightforward and low-risk. However, the same reversed ordering exists in the `shouldSendQuickRepliesInline` branch and was not addressed, meaning the bug can still surface when quick replies are present without text chunks.
- Pay attention to `extensions/line/src/channel.ts` lines 464-485 where the quick-reply batch path has the same ordering issue.
<sub>Last reviewed commit: de3799a</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
74.8%
#4249: fix(telegram): properly nest link tags inside bold/italic formatting
by pradeeppeddineni · 2026-01-29
73.7%
#23320: fix(slack): respect replyToMode when incomingThreadTs is auto-created
by dorukardahan · 2026-02-22
73.3%
#23513: fix(slack): respect replyToMode=off for inline directive reply tags
by dorukardahan · 2026-02-22
72.7%
#20406: fix(slack): respect replyToMode when computing statusThreadTs in DMs
by QuinnYates · 2026-02-18
72.7%
#21482: feat(line): support rich message directives in text
by puritysb · 2026-02-20
72.6%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
72.4%
#19083: Slack: preserve per-thread context and consistent thread replies
by jkimbo · 2026-02-17
72.4%
#4749: fix: handle string thread IDs in queue drain for Slack
by nvonpentz · 2026-01-30
72.2%
#17953: fix(telegram): prevent silent message loss and duplicate messages i...
by zuyan9 · 2026-02-16
72.1%