Repository navigation
fix(reply-target): chat-scope 卡片「压缩」不再把 chat_id 冻结为回复根 - #2005
Merged
deepcoldy merged 1 commit intoOct 19, 2026
Merged
Conversation
chat-scope 会话的卡片按钮里 root_id 就是 chat_id。compact_session 把它当
replyRootId 传给 deliverPassthroughCommand,经 beginReplyTargetTurn /
resolveInboundReplyTarget 冻结成 { mode: 'thread', rootMessageId: oc_… },
同时写进 replyTargets、replyThreadAliases 与 currentReplyTarget 并落库。
此后没有新 IM 轮次覆盖前,worker 冷启动的起始卡、静态兜底卡等无 turn
的投递都会对 chat_id 发 reply,飞书返回 230001 invalid message_id。
- card-handler:chat-scope 下 compact_session 不再传 replyRootId;
thread-scope 保持原值。
- reply-target:oc_ 开头的 id 一律不当回复根(写入侧 resolveInboundReplyTarget
与 beginReplyTargetTurn),防止其他卡片按钮路径重复踩坑。
- 读取侧对已落库的坏值做兜底(frozenReplyContextForTurn、
resolveSessionReplyTarget 两处),升级后已中招的会话无需等新消息即可恢复。
测试:新增 6 个用例(含 2 个确认原有行为不变的对照),其中 4 个在上游 master 上为红;6 处改动逐一回退,每处都有对应
用例变红。
Co-Authored-By: Claude Opus 5.5 <[email protected]>
xu4wang
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 18, 2026 04:49
Owner
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
This was referenced Oct 19, 2026
|
🚀 Released in v3.47.0 |
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.
Fixes 问题 A of #2004.
问题
chat-scope 会话的卡片按钮里,
root_id实际上就是 chat_id。compact_session把它当作replyRootId传给了deliverPassthroughCommand,导致这一轮的回复目标被冻结成{ mode: 'thread', rootMessageId: 'oc_…' }。同样的 chat_id 还会被写进replyTargets、replyThreadAliases和currentReplyTarget,并且落库。之后只要没有新的 IM 轮次把它覆盖掉,所有不带 turn 的投递(worker 冷启动时的起始卡、静态兜底卡等)都会经
fallbackTurnId找到这一轮,然后对 chat_id 发起 reply,飞书返回230001 invalid message_id。重启 daemon 也恢复不了。修改
card-handler.ts:chat-scope 下,compact_session不再传replyRootId(与普通群里平铺消息的语义一致);thread-scope 仍传原值。reply-target.ts:新增isLarkChatId,oc_开头的 id 一律不作为回复根。resolveInboundReplyTarget和beginReplyTargetTurn入口各加一道。后者让replyTargets、replyThreadAliases、currentReplyTarget也不再记录 chat_id。这样以后别的卡片按钮路径再犯同样的错,也不会把坏值写进去。frozenReplyContextForTurn和resolveSessionReplyTarget遇到已经落库的oc_根时,退回成plain。已经中招的会话升级后就能恢复,不需要等用户再发一条新消息。一个取舍:chat-scope 会话如果当前处在某个话题里,压缩后的起始卡会平铺发到群里,而不是进那个话题,因为卡片上带的只有 chat_id,拿不到话题根。这和该会话其他平铺消息的行为一致。
测试
reply-target-fallback.test.ts4 个,card-handler-stop-compact.test.ts2 个。其中 2 个是对照,确认原有行为不变:真实的话题根仍走 thread,thread-scope 仍传 ROOT。另外 4 个在当前 master 上为红。bun test下也通过(60/60、29/29)。tsc --noEmit通过。vitest --project unit全量:失败的都是满载下的 flaky(两轮分别是 26 和 30 个文件,且清单不同),均与本改动无关。把这 30 个文件在当前 master 和本分支上用相同参数各跑一遍:本分支的失败集合是 master 失败集合的子集,没有新增失败。🤖 Generated with Claude Code