Skip to content

fix(feishu): reply inside P2P direct-message threads#73972

Open
openclaw-clownfish[bot] wants to merge 1 commit intomainfrom
clownfish/ghcrawl-156976-autonomous-smoke
Open

fix(feishu): reply inside P2P direct-message threads#73972
openclaw-clownfish[bot] wants to merge 1 commit intomainfrom
clownfish/ghcrawl-156976-autonomous-smoke

Conversation

@openclaw-clownfish
Copy link
Copy Markdown
Contributor

Repair #38808 against main 79159f1. Preserve the contributor branch and credit @LiaoyuanNing. Keep the fix scoped to Feishu P2P direct-message thread routing: detect direct messages with thread_id, reply to the thread root with replyInThread/threadReply enabled, preserve the non-thread path for root_id-only P2P quote replies, and leave group behavior unchanged. Keep or add focused regression coverage for P2P thread replies and P2P plain quote replies. Run pnpm check:changed and a clean Codex /review before merge. After the PR lands, close #38806 as implemented. #66631 is intentionally out of scope because it concerns Feishu topic-group thread_id-only root resolution.

ProjectClownfish replacement details:

@openclaw-clownfish openclaw-clownfish Bot added the clawsweeper Tracked by ClawSweeper automation label Apr 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S r: too-many-prs Auto-close: author has more than twenty active PRs. labels Apr 29, 2026
@openclaw-barnacle
Copy link
Copy Markdown

Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 29, 2026

Greptile Summary

This PR fixes Feishu P2P direct-message thread replies by detecting thread_id on incoming P2P messages and routing the bot's response to the thread root with replyInThread/threadReply enabled, while preserving existing behavior for plain P2P quote replies and group chats. Two focused regression tests cover both new cases.

Confidence Score: 5/5

This PR is safe to merge — the change is narrowly scoped to P2P thread detection and leaves group and non-thread DM paths unchanged.

The directThreadReply flag is derived from a reliable combination of chatType === 'p2p' and a non-null thread_id, skipReplyToInMessages and replyInThread are updated consistently across both the broadcast and non-broadcast dispatcher call sites, the ACP error path is also updated, and both happy-path test cases match the assertions. No logic gaps found.

No files require special attention.

Reviews (2): Last reviewed commit: "fix(feishu): reply inside P2P direct-mes..." | Re-trigger Greptile

@vincentkoc vincentkoc reopened this Apr 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added r: too-many-prs Auto-close: author has more than twenty active PRs. and removed r: too-many-prs Auto-close: author has more than twenty active PRs. labels Apr 29, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 29, 2026

Codex review: needs maintainer review before merge.

Summary
This PR changes Feishu P2P direct-message routing so events with thread_id reply to the thread root with thread-reply flags, and adds focused regression tests plus a changelog entry.

Reproducibility: yes. A source-level reproduction is a Feishu event with chat_type: "p2p", root_id, and thread_id: current main parses those fields, then routes the message with P2P replyInThread false and reply metadata skipped.

Next step before merge
The remaining blocker is merge-gate handling for a dirty, non-rebaseable, non-maintainer-modifiable branch rather than a new source-level review finding.

Security
Cleared: The diff only touches Feishu routing logic, focused Feishu tests, and the changelog; it does not change workflows, dependencies, package metadata, secrets, permissions, install scripts, or artifact execution paths.

Review details

Best possible solution:

Refresh this patch onto current main or open an equivalent mergeable replacement, keep the Feishu regression coverage and changelog entry, run pnpm check:changed, then land it and close #38806 while leaving #66631 and #70512 tracked separately.

Do we have a high-confidence way to reproduce the issue?

Yes. A source-level reproduction is a Feishu event with chat_type: "p2p", root_id, and thread_id: current main parses those fields, then routes the message with P2P replyInThread false and reply metadata skipped.

Is this the best way to solve the issue?

Yes, after branch refresh. The PR’s approach is the narrow maintainable fix because it uses P2P thread_id as the thread-reply opt-in while preserving root-id-only quote replies and existing group behavior.

What I checked:

  • current-main-parses-thread-fields: Current main parses root_id and thread_id into the Feishu message context, so the reported P2P thread signal is available to routing code. (extensions/feishu/src/bot.ts:250, bd6035d97707)
  • current-main-disables-p2p-thread-replies: Current main still forces replyInThread to false for non-group Feishu messages. (extensions/feishu/src/bot.ts:717, bd6035d97707)
  • current-main-strips-p2p-reply-targets: Current main passes skipReplyToInMessages: !isGroup, which makes P2P dispatch drop replyToMessageId before the send layer can call the Feishu reply API. (extensions/feishu/src/bot.ts:1315, bd6035d97707)
  • send-layer-supports-thread-reply: The Feishu send helper already calls client.im.message.reply and sends reply_in_thread: true when replyInThread is provided, so the missing behavior is routing P2P thread events into that existing path. (extensions/feishu/src/send.ts:167, bd6035d97707)
  • pr-patch-routes-p2p-thread-events: The PR derives directThreadReply from P2P thread_id, targets the direct thread root, preserves reply metadata for those events, and sets thread-reply behavior. (extensions/feishu/src/bot.ts:714, 2f9535c226ca)
  • pr-patch-adds-regression-tests: The PR adds regression coverage for P2P thread_id messages and for root-id-only P2P quote replies preserving the non-thread path. (extensions/feishu/src/bot.test.ts:2573, 2f9535c226ca)

Likely related people:

  • guoqunabc: Merged PR fix(feishu): comprehensive reply mechanism — outbound replyToId forwarding + topic-aware reply targeting #33789 changed Feishu reply targeting around root/thread handling, which is the regression boundary identified by the linked bug and this PR. (role: introduced relevant reply-targeting behavior; confidence: high; commits: 63ce7c74bdc0; files: extensions/feishu/src/bot.ts, extensions/feishu/src/send.ts, extensions/feishu/src/outbound.ts)
  • steipete: Recent current-main Feishu and shared channel refactors touched the affected bot, test, send, and reply-dispatcher surfaces. (role: recent maintainer; confidence: high; commits: 9a9cd0c0abdf, ffe67e9cdc9e, b388209eaf72; files: extensions/feishu/src/bot.ts, extensions/feishu/src/bot.test.ts, extensions/feishu/src/send.ts)
  • vincentkoc: Recent Feishu work touched send/reply-dispatcher-adjacent code, and this PR discussion includes a maintainer automerge signal from this account. (role: recent adjacent maintainer; confidence: medium; commits: 2b96f53f9782, c6cf37068cae, 84a22a64bef0; files: extensions/feishu/src/bot.ts, extensions/feishu/src/send.ts, extensions/feishu/src/reply-dispatcher.ts)

Remaining risk / open question:

  • The PR branch is dirty, non-rebaseable, and 1568 commits behind current main, so it cannot land as-is.
  • pnpm check:changed was not run during this read-only review; pnpm is unavailable in this shell and validation should run after the branch is refreshed.

Codex review notes: model gpt-5.5, reasoning high; reviewed against bd6035d97707.

@vincentkoc
Copy link
Copy Markdown
Member

/clownfish automerge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu clawsweeper Tracked by ClawSweeper automation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: bot replies outside thread in P2P direct message thread

1 participant