Repository navigation
fix(feishu): keep group_topic message-tool replies inside the topic - #77151
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main is source-reproducible: the group prompt leads agents to Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the Feishu-owned runtime fix after normal maintainer CI and mergeability checks, keeping topic threading in channel/outbound delivery code rather than relying on prompt guidance. Do we have a high-confidence way to reproduce the issue? Yes. Current main is source-reproducible: the group prompt leads agents to Is this the best way to solve the issue? Yes. Runtime auto-threading from Feishu session scope is narrower and more reliable than asking the model to choose What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a99729fd2148. |
fc8e757 to
0a5a902
Compare
0a5a902 to
be3c4c8
Compare
be3c4c8 to
7ba4254
Compare
7ba4254 to
af2c21d
Compare
af2c21d to
0edd614
Compare
0edd614 to
b44a2f1
Compare
b44a2f1 to
5e2b68f
Compare
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
c6bc044 to
55575ee
Compare
55575ee to
91d480b
Compare
When a Feishu group_topic-scoped session triggers `message(action="send")`, the channel handler previously left replyToMessageId/replyInThread unset for non-thread-reply actions, so the visible reply fell out of the topic and posted at the group root. Auto-thread `send` against the inbound trigger when the active session scope is `group_topic` or `group_topic_sender`, and propagate the topic-thread decision uniformly through text, card, and media sends. Plain group sessions remain unthreaded. Fixes openclaw#74903.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
91d480b to
3a47a09
Compare
|
Merged via squash.
Thanks @ai-hpc! |
…penclaw#77151) Merged via squash. Prepared head SHA: 3a47a09 Co-authored-by: ai-hpc <[email protected]> Co-authored-by: hxy91819 <[email protected]> Reviewed-by: @hxy91819
…outing)
Consolidated fork module §4 from iteration/fork-features:
- Streaming card: panel/history support, accepts upstream nested streaming
config schema (streaming: { mode, chunkMode, preview, progress, block }).
- Reply dispatcher: onBlockNotify wiring for history panel narration,
onItemEvent subscription for upstream's parallel item lifecycle, panel
gate loosened to include item-only flows.
- Outbound: replyInThread forced for omt_* topic scopes (upstream PR openclaw#77151
regression).
- Bot inbound: topicScope (rootId ?? threadId ?? messageId) for thread id,
effectiveThreadId hydration for topic-creating messages.
- Channel resolveAutoThreadId: fallback to toolContext.currentMessageId
when threadId is omt_*.
- config-schema: historyPanel, historyPanelScope, account-level streaming
overrides.
- bundled-channel-config-metadata.generated.ts regenerated.
Summary
Fixes #74903.
When a Feishu group chat message lands in a
group_topic-scoped session, the assistant'smessage(action="send")reply was posting at the group root instead of inside the topic (话题). Auto-threadsendagainst the inbound trigger when the active session scope isgroup_topicorgroup_topic_sender, and propagate the topic-thread decision uniformly through text, card, and media sends. Plain group sessions stay unthreaded.Root cause
extensions/feishu/src/channel.tsonly setreplyToMessageId/replyInThreadfor explicitaction: "thread-reply"; a topic-scopedsendleft both unset, so Feishu posted to the chat root. The runtimesendMediaadapter inextensions/feishu/src/outbound.tslikewise forwarded onlyreplyToMessageIdtosendMediaFeishu, dropping the thread-mode flag for media sends.Changes
extensions/feishu/src/channel.ts— addisFeishuGroupTopicSessionKey()plus typed helpers (resolveFeishuTopicAutoThreadAnchor,buildFeishuSendReplyAnchor) so the action handler derives{ replyToMessageId, replyInThread }once and forwards it uniformly to text, card, and media sends.extensions/feishu/src/outbound.ts— extendsendOutboundTextto accept and forwardreplyInThread; the runtimesendMediaadapter resolves{ replyToMessageId, replyInThread }via a newresolveFeishuMediaReplyMode()helper and propagatesreplyInThreadto everysendMediaFeishu/sendOutboundTextsub-call (mainline, post-voice fallback, catch fallback, no-media branch).extensions/feishu/src/channel.test.ts— six new cases: text/card/media auto-thread ingroup_topic,group_topic_sendervariant, no auto-thread for plain group, no auto-thread whencurrentMessageIdis missing.extensions/feishu/src/outbound.test.ts—threadId→replyInThread=true, andreplyToIdprecedence overthreadId.Real behavior proof
Behavior or issue addressed: Feishu group_topic sessions where the assistant uses
message(action="send")were posting visible replies at the group root instead of inside the topic thread (话题), as described in #74903. After the fix, topic-scopedsendactions auto-thread against the inbound trigger and the visible reply lands inside the topic. Plain groupsendactions remain unthreaded so they continue to post at the chat root.Real environment tested: Local macOS Mac mini gateway (
launchctl gui/$(id -u)/ai.openclaw.gateway) running the patch on top of upstream main (ba675d8964 test: clarify secrets warning assertion), bundledextensions/feishuchannel in WebSocket mode, real Lark tenant botcli_a972e47287b8de17joined to a Lark group withgroupSessionScope: "group_topic". Agent runtime:openai-codex/gpt-5.5via@openai/[email protected]. Live HTTPS calls toopen.larksuite.com/open.feishu.cnreturned realmessageIdvalues (om_x100b50…).Exact steps or command run after this patch:
cd /Users/a1111/openclaw && pnpm install && pnpm build(rebuildsdist/index.jswith the patched feishu sources)launchctl kickstart -k gui/$(id -u)/ai.openclaw.gateway(restart gateway)@speedy_lark_bot thread test again@speedy_lark_bot root test againtail -F /Users/a1111/.openclaw/logs/gateway.log /tmp/openclaw/openclaw-2026-05-08.logand inspect/Users/a1111/.openclaw/agents/main/agent/codex-home/sessions/2026/05/08/rollout-*.jsonlEvidence after fix:
Topic send — runtime log excerpt and Codex rollout terminal output captured live from the running gateway:
Codex rollout (
rollout-2026-05-08T17-01-30-…jsonl, captured directly from disk after the live turn ran on the patched build):Root send — runtime log excerpt and rollout terminal output from the same live setup:
Observed result after fix:
isFeishuGroupTopicSessionKey()returned true on the:topic:session key, the action handler setreplyInThread=trueandreplyToMessageId=<inbound message id>, the Lark Open API send returnedok:truewithmessageId=om_x100b50ecebef50a8ee8209cfac962bd, and the bot reply was visible inside the topic thread in the Lark client. (Pre-fix on the same setup: same Codex tool call landed at the group root.):topic:segment, the handler leftreplyInThread=falseandreplyToMessageId=undefined, the send returnedok:truewithmessageId=om_x100b50edbffa34b0ee762157221c95d, and the bot reply was visible at the top of the group (no regression)./Users/a1111/.openclaw/logs/gateway.err.logduring either turn.What was not tested: Card and media auto-thread paths were not exercised on the live Lark group during this run because the bundled Codex agent on this gateway only emits text replies; their behavior is covered by the new unit tests in
channel.test.ts(auto-threads send cards…andauto-threads send media…).group_topic_senderscope was likewise covered by unit test only.Test plan
pnpm vitest run extensions/feishu/src/channel.test.ts extensions/feishu/src/outbound.test.ts(90/90 passing)groupSessionScope: "group_topic": topic reply lands inside the topicgroupSessionScope: "group_topic": root message reply lands at top of group (no regression)