Commit 1bd3555
fix(feishu): reply inside thread for P2P direct messages
When a user sends a message inside a Feishu thread (话题) in a P2P
chat, the bot's reply was incorrectly sent outside the thread as a
standalone message. This was caused by PR #33789 which fixed group
reply targeting (#32980) but inadvertently broke P2P thread replies
by gating all thread-aware logic behind isGroup checks.
The fix distinguishes between two P2P scenarios based on the Feishu
API contract (thread_id present = thread message, root_id only =
quote reply):
- P2P thread messages (thread_id present): reply to root_id with
reply_in_thread=true so the response stays in the thread.
- P2P plain replies (root_id only, no thread_id): reply to the
triggering message as before.
Group chat behavior is completely unchanged — the new condition
(directThreadMessage) requires isDirect=true, which is always false
for groups.
Changes:
- replyInThread: true for P2P thread messages (enables reply_in_thread API flag)
- replyTargetMessageId: use root_id for P2P thread messages
- threadReply: true for P2P thread messages (drives effectiveReplyInThread in dispatcher)
- skipReplyToInMessages: false for P2P thread messages (so send layer
uses im.message.reply instead of im.message.create)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 84f5d7d commit 1bd3555
2 files changed
Lines changed: 97 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1706 | 1706 | | |
1707 | 1707 | | |
1708 | 1708 | | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
1709 | 1782 | | |
1710 | 1783 | | |
1711 | 1784 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1156 | 1156 | | |
1157 | 1157 | | |
1158 | 1158 | | |
1159 | | - | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
1160 | 1164 | | |
1161 | 1165 | | |
1162 | 1166 | | |
| |||
1338 | 1342 | | |
1339 | 1343 | | |
1340 | 1344 | | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
1346 | 1358 | | |
1347 | 1359 | | |
1348 | 1360 | | |
| |||
1354 | 1366 | | |
1355 | 1367 | | |
1356 | 1368 | | |
1357 | | - | |
1358 | | - | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
1359 | 1373 | | |
1360 | 1374 | | |
1361 | 1375 | | |
| |||
1406 | 1420 | | |
1407 | 1421 | | |
1408 | 1422 | | |
1409 | | - | |
| 1423 | + | |
1410 | 1424 | | |
1411 | 1425 | | |
1412 | 1426 | | |
| |||
1504 | 1518 | | |
1505 | 1519 | | |
1506 | 1520 | | |
1507 | | - | |
| 1521 | + | |
1508 | 1522 | | |
1509 | 1523 | | |
1510 | 1524 | | |
| |||
0 commit comments