Repository navigation
fix(doc-comment): 按评论线程隔离文档会话 - #1366
Merged
deepcoldy merged 1 commit intoSep 12, 2026
Merged
Conversation
Owner
|
你好!这是 Botmux 自动评审流程:PR #1366 的评审群已创建,欢迎进群围观/讨论 👉 https://applink.feishu.cn/client/chat/open?openChatId=oc_014e8771fa91ca240e31b8a7644c1e19 不过你目前还不在自动拉群名单里,暂时没能直接把你拉进群。麻烦把 GitHub 账号和飞书信息补录到这份名单文档(已开编辑权限,可自行认领):https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe ,补好之后后续复审会自动把你拉进群。感谢贡献 PR! |
|
🚀 Released in v3.22.0 |
deepcoldy
added a commit
that referenced
this pull request
Oct 6, 2026
把飞书文档评论监听(/watch-comment)补一个 dashboard 页面 #/doc-watches:列表、 切触发范围、退订、贴链接登记,并暴露「最近一次评论为什么没被回复」的运行态,以及 「这条订阅是不是陌生人 @ 出来的」溯源。基于 PR #1366 之后的文档会话模型重做 (watch 用 doc:<token>:watch 内部 anchor、逐评论线程独立会话、WS 投递持久重试)。 store(doc-subs-store) - 新增 8 个 optional 字段:运行态 lastActivityAt/lastOutcome/lastError/ lastDispatchAt/dispatchCount,溯源 autoCreated/autoCreatedBy/autoCreatedAt; 旧记录读 undefined 是正常态。DocWatchOutcome 枚举 + asDocWatchOutcome 收窄。 - recordDocWatchActivity:读后写、绝不抛,dispatched 累加计数并推进 lastDispatchAt, 成功/正常丢弃清旧 lastError;行已删(退订/auto-sub 回滚)时不复活。 - setDocTitle:标题快照 best-effort,未变不写盘。 - putDocSubscription 新增显式 { inheritRuntime }:重新登记时只延续运行态五项 (描述文档投递历史,换绑定不该清零);默认仍整行覆盖,未决 WS 投递照旧保留。 溯源三字段刻意不继承——owner 主动 /watch-comment 接管后这条不再是 auto-sub, 盲目继承会让界面挂着已不成立的「自动创建」结论(比丢字段更糟)。 接线 - event-dispatcher:auto-sub 占位带溯源;六个丢弃出口(no-comment/trigger-missing/ self-authored/not-mentioned/empty-text/audit-rejected)各记结局;dispatch 仅在 daemon 真接纳(accepted,WS settle 之后)记 dispatched;标题 fire-and-forget 补齐。 - daemon poller:pending 重试接纳、--all 轮询接纳两处记 dispatched;读文档失败记 poll-failed(功能「配着」却静默失效,是最需要可见的故障)。 - command-handler /watch-comment:登记时 best-effort 抓标题,put 走 inheritRuntime。 - dashboard-ipc 四端点 GET/PUT/POST/DELETE /api/doc-watches:复用 daemon 单写者 (dashboard 进程不直接写盘);token 形状闸、workingDir 校验(不静默 mkdir)、 切到 all 先清游标重建基线(mention-only 游标极旧,不重置会重放全部历史)。 - F3:POST 已绑真实飞书话题/群(isDocNativeWatchSubscription 取反)时沿用原 anchor/sessionId/scope/chatId/ownerOpenId,只改可配置部分,避免「改个目录」就把 评论落点从群话题搬到独立文档会话;响应 keptBinding 让界面如实提示。 - dashboard.ts 代理四条路由(不在 PUBLIC_READ_PATHS,写操作另过 canManageHost)。 UI - 新页面 doc-watches-page + 数据层 doc-watches.ts;app.tsx NAV_ITEMS/MANAGE_ROUTES/ NAV_GROUPS、dashboard-routes、中英 i18n、style.css 的 dw- 样式;桌面外壳 renderer/index.html + app.ts 同步导航项(desktop-dashboard-webview 全等比较)。 验证 - tsc --noEmit / bun run build 均 rc=0 - 相关 27 文件 1049 passed / 1 skipped:新增 store 11 例(含运行态/溯源策略相反)、 IPC 20 例(真实 IPC server + 真实 store,含基线重置、F2 保留、F3 不改绑、legacy anchor 迁移、503/400/404)、drop-signal 5 条源码形状断言;desktop webview 29/29 - doc-comment.ts fetchDocTitle 只认 metas[0].title,拿不到返回 undefined 绝不抛 待验证:新页面渲染 / 切模式 / 退订 / 基线重置的实际效果仍需真机确认。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
added a commit
that referenced
this pull request
Oct 6, 2026
把飞书文档评论监听(/watch-comment)补一个 dashboard 页面 #/doc-watches:列表、 切触发范围、退订、贴链接登记,并暴露「最近一次评论为什么没被回复」的运行态,以及 「这条订阅是不是陌生人 @ 出来的」溯源。基于 PR #1366 之后的文档会话模型重做 (watch 用 doc:<token>:watch 内部 anchor、逐评论线程独立会话、WS 投递持久重试)。 store(doc-subs-store) - 新增 8 个 optional 字段:运行态 lastActivityAt/lastOutcome/lastError/ lastDispatchAt/dispatchCount,溯源 autoCreated/autoCreatedBy/autoCreatedAt; 旧记录读 undefined 是正常态。DocWatchOutcome 枚举 + asDocWatchOutcome 收窄。 - recordDocWatchActivity:读后写、绝不抛,dispatched 累加计数并推进 lastDispatchAt, 成功/正常丢弃清旧 lastError;行已删(退订/auto-sub 回滚)时不复活。 - setDocTitle:标题快照 best-effort,未变不写盘。 - putDocSubscription 新增显式 { inheritRuntime }:重新登记时只延续运行态五项 (描述文档投递历史,换绑定不该清零);默认仍整行覆盖,未决 WS 投递照旧保留。 溯源三字段刻意不继承——owner 主动 /watch-comment 接管后这条不再是 auto-sub, 盲目继承会让界面挂着已不成立的「自动创建」结论(比丢字段更糟)。 接线 - event-dispatcher:auto-sub 占位带溯源;六个丢弃出口(no-comment/trigger-missing/ self-authored/not-mentioned/empty-text/audit-rejected)各记结局;dispatch 仅在 daemon 真接纳(accepted,WS settle 之后)记 dispatched;标题 fire-and-forget 补齐。 - daemon poller:pending 重试接纳、--all 轮询接纳两处记 dispatched;读文档失败记 poll-failed(功能「配着」却静默失效,是最需要可见的故障)。 - command-handler /watch-comment:登记时 best-effort 抓标题,put 走 inheritRuntime。 - dashboard-ipc 四端点 GET/PUT/POST/DELETE /api/doc-watches:复用 daemon 单写者 (dashboard 进程不直接写盘);token 形状闸、workingDir 校验(不静默 mkdir)、 切到 all 先清游标重建基线(mention-only 游标极旧,不重置会重放全部历史)。 - F3:POST 已绑真实飞书话题/群(isDocNativeWatchSubscription 取反)时沿用原 anchor/sessionId/scope/chatId/ownerOpenId,只改可配置部分,避免「改个目录」就把 评论落点从群话题搬到独立文档会话;响应 keptBinding 让界面如实提示。 - dashboard.ts 代理四条路由(不在 PUBLIC_READ_PATHS,写操作另过 canManageHost)。 UI - 新页面 doc-watches-page + 数据层 doc-watches.ts;app.tsx NAV_ITEMS/MANAGE_ROUTES/ NAV_GROUPS、dashboard-routes、中英 i18n、style.css 的 dw- 样式;桌面外壳 renderer/index.html + app.ts 同步导航项(desktop-dashboard-webview 全等比较)。 验证 - tsc --noEmit / bun run build 均 rc=0 - 相关 27 文件 1049 passed / 1 skipped:新增 store 11 例(含运行态/溯源策略相反)、 IPC 20 例(真实 IPC server + 真实 store,含基线重置、F2 保留、F3 不改绑、legacy anchor 迁移、503/400/404)、drop-signal 5 条源码形状断言;desktop webview 29/29 - doc-comment.ts fetchDocTitle 只认 metas[0].title,拿不到返回 undefined 绝不抛 待验证:新页面渲染 / 切模式 / 退订 / 基线重置的实际效果仍需真机确认。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
added a commit
that referenced
this pull request
Oct 6, 2026
把飞书文档评论监听(/watch-comment)补一个 dashboard 页面 #/doc-watches:列表、 切触发范围、退订、贴链接登记,并暴露「最近一次评论为什么没被回复」的运行态,以及 「这条订阅是不是陌生人 @ 出来的」溯源。基于 PR #1366 之后的文档会话模型重做 (watch 用 doc:<token>:watch 内部 anchor、逐评论线程独立会话、WS 投递持久重试)。 store(doc-subs-store) - 新增 8 个 optional 字段:运行态 lastActivityAt/lastOutcome/lastError/ lastDispatchAt/dispatchCount,溯源 autoCreated/autoCreatedBy/autoCreatedAt; 旧记录读 undefined 是正常态。DocWatchOutcome 枚举 + asDocWatchOutcome 收窄。 - recordDocWatchActivity:读后写、绝不抛,dispatched 累加计数并推进 lastDispatchAt, 成功/正常丢弃清旧 lastError;行已删(退订/auto-sub 回滚)时不复活。 - setDocTitle:标题快照 best-effort,未变不写盘。 - putDocSubscription 新增显式 { inheritRuntime }:重新登记时只延续运行态五项 (描述文档投递历史,换绑定不该清零);默认仍整行覆盖,未决 WS 投递照旧保留。 溯源三字段刻意不继承——owner 主动 /watch-comment 接管后这条不再是 auto-sub, 盲目继承会让界面挂着已不成立的「自动创建」结论(比丢字段更糟)。 接线 - event-dispatcher:auto-sub 占位带溯源;六个丢弃出口(no-comment/trigger-missing/ self-authored/not-mentioned/empty-text/audit-rejected)各记结局;dispatch 仅在 daemon 真接纳(accepted,WS settle 之后)记 dispatched;标题 fire-and-forget 补齐。 - daemon poller:pending 重试接纳、--all 轮询接纳两处记 dispatched;读文档失败记 poll-failed(功能「配着」却静默失效,是最需要可见的故障)。 - command-handler /watch-comment:登记时 best-effort 抓标题,put 走 inheritRuntime。 - dashboard-ipc 四端点 GET/PUT/POST/DELETE /api/doc-watches:复用 daemon 单写者 (dashboard 进程不直接写盘);token 形状闸、workingDir 校验(不静默 mkdir)、 切到 all 先清游标重建基线(mention-only 游标极旧,不重置会重放全部历史)。 - F3:POST 已绑真实飞书话题/群(isDocNativeWatchSubscription 取反)时沿用原 anchor/sessionId/scope/chatId/ownerOpenId,只改可配置部分,避免「改个目录」就把 评论落点从群话题搬到独立文档会话;响应 keptBinding 让界面如实提示。 - dashboard.ts 代理四条路由(不在 PUBLIC_READ_PATHS,写操作另过 canManageHost)。 UI - 新页面 doc-watches-page + 数据层 doc-watches.ts;app.tsx NAV_ITEMS/MANAGE_ROUTES/ NAV_GROUPS、dashboard-routes、中英 i18n、style.css 的 dw- 样式;桌面外壳 renderer/index.html + app.ts 同步导航项(desktop-dashboard-webview 全等比较)。 验证 - tsc --noEmit / bun run build 均 rc=0 - 相关 27 文件 1049 passed / 1 skipped:新增 store 11 例(含运行态/溯源策略相反)、 IPC 20 例(真实 IPC server + 真实 store,含基线重置、F2 保留、F3 不改绑、legacy anchor 迁移、503/400/404)、drop-signal 5 条源码形状断言;desktop webview 29/29 - doc-comment.ts fetchDocTitle 只认 metas[0].title,拿不到返回 undefined 绝不抛 待验证:新页面渲染 / 切模式 / 退订 / 基线重置的实际效果仍需真机确认。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
added a commit
that referenced
this pull request
Oct 9, 2026
把飞书文档评论监听(/watch-comment)补一个 dashboard 页面 #/doc-watches:列表、 切触发范围、退订、贴链接登记;展示「最近一条评论为什么没被回复」的运行态,以及 「这条订阅是不是陌生人 @ 出来的」溯源。基于主干 #1366 之后的文档会话模型实现 (watch 用 doc:<token>:watch 内部 anchor、逐评论线程独立会话、WS 投递持久重试)。 store(doc-subs-store) - 新增运行态 lastActivityAt/lastOutcome/lastError/lastDispatchAt/dispatchCount 与 溯源 autoCreated/autoCreatedBy/autoCreatedAt(全 optional,旧记录读 undefined 正常); DocWatchOutcome 枚举 + asDocWatchOutcome 收窄。 - recordDocWatchActivity 读后写、绝不抛,dispatched 累加计数,行已删时不复活; setDocTitle best-effort 且未变不写盘。 - putDocSubscription 新增显式 { inheritRuntime }:重新登记只延续运行态五项(投递 历史换绑定不该清零),默认仍整行覆盖;溯源三项刻意不继承——owner 主动接管后 不再是 auto-sub,盲目继承会让界面挂已不成立的「自动创建」结论。 接线 - event-dispatcher:auto-sub 占位带溯源;六个丢弃出口各记结局;dispatch 仅在 daemon 真接纳(WS accepted + settle 之后)记 dispatched;标题 fire-and-forget。 - daemon poller:pending 重试接纳、--all 轮询接纳两处记 dispatched;读文档失败记 poll-failed(功能「配着」却静默失效最需要可见)。 - /watch-comment 登记抓标题 + inheritRuntime。 - dashboard IPC 四端点,复用 daemon 单写者;token 形状闸、workingDir 校验不静默 mkdir;切到 all 先清游标后改 mode(非原子写时也不留「all+旧游标」重放窗口)。 - resolveDocFile:wiki get_node 无权限(飞书 131006)时透传可操作提示(换被授权 bot / 把本 bot 加进文档协作者),其它错误带 code+msg,不再吞成通用解析失败。 - F3:POST 已绑真实飞书话题/群(isDocNativeWatchSubscription 取反)时沿用原 anchor/sessionId/scope/chatId/ownerOpenId,只改可配置部分,避免「改目录」就把 评论落点搬到独立文档会话;响应 keptBinding 供界面提示。 - dashboard.ts 代理四路由(不在 PUBLIC_READ_PATHS,写操作另过 canManageHost)。 UI - 新页面 doc-watches-page + 数据层 doc-watches.ts;导航/路由/中英 i18n/dw 样式、 桌面外壳导航项(desktop webview 全等比较)。 - 触发模式文案消歧:「@ 本机器人才回复」/「所有新评论(含未 @ 机器人)」,表单 写明飞书只推送「@ 了本机器人」的评论(@自己/@同事需选所有新评论由轮询读取); 机器人下拉在本页专有放宽宽度以完整显示长 bot 名(不改共享下拉全局样式)。 验证:tsc/build rc=0;相关 29 文件 1092 passed/1 skipped;含 store 运行态/溯源 策略相反、IPC(基线重置/F2/F3/legacy anchor 迁移/400/401/404/503)、poller 接线 源码形状(未导出函数)、桌面 webview 等;关键行为均做反变异确认有牙。 待验证:真机页面/切模式/基线重置的持续回归。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
added a commit
that referenced
this pull request
Oct 9, 2026
把飞书文档评论监听(/watch-comment)补一个 dashboard 页面 #/doc-watches:列表、 切触发范围、退订、贴链接登记;展示「最近一条评论为什么没被回复」的运行态,以及 「这条订阅是不是陌生人 @ 出来的」溯源。基于主干 #1366 之后的文档会话模型实现 (watch 用 doc:<token>:watch 内部 anchor、逐评论线程独立会话、WS 投递持久重试)。 store(doc-subs-store) - 新增运行态 lastActivityAt/lastOutcome/lastError/lastDispatchAt/dispatchCount 与 溯源 autoCreated/autoCreatedBy/autoCreatedAt(全 optional,旧记录读 undefined 正常); DocWatchOutcome 枚举 + asDocWatchOutcome 收窄。 - recordDocWatchActivity 读后写、绝不抛,dispatched 累加计数,行已删时不复活; setDocTitle best-effort 且未变不写盘。 - putDocSubscription 新增显式 { inheritRuntime }:重新登记只延续运行态五项(投递 历史换绑定不该清零),默认仍整行覆盖;溯源三项刻意不继承——owner 主动接管后 不再是 auto-sub,盲目继承会让界面挂已不成立的「自动创建」结论。 接线 - event-dispatcher:auto-sub 占位带溯源;六个丢弃出口各记结局;dispatch 仅在 daemon 真接纳(WS accepted + settle 之后)记 dispatched;标题 fire-and-forget。 - daemon poller:pending 重试接纳、--all 轮询接纳两处记 dispatched;读文档失败记 poll-failed(功能「配着」却静默失效最需要可见)。 - /watch-comment 登记抓标题 + inheritRuntime。 - dashboard IPC 四端点,复用 daemon 单写者;token 形状闸、workingDir 校验不静默 mkdir;切到 all 先清游标后改 mode(非原子写时也不留「all+旧游标」重放窗口)。 - resolveDocFile:wiki get_node 无权限(飞书 131006)时透传可操作提示(换被授权 bot / 把本 bot 加进文档协作者),其它错误带 code+msg,不再吞成通用解析失败。 - F3:POST 已绑真实飞书话题/群(isDocNativeWatchSubscription 取反)时沿用原 anchor/sessionId/scope/chatId/ownerOpenId,只改可配置部分,避免「改目录」就把 评论落点搬到独立文档会话;响应 keptBinding 供界面提示。 - dashboard.ts 代理四路由(不在 PUBLIC_READ_PATHS,写操作另过 canManageHost)。 UI - 新页面 doc-watches-page + 数据层 doc-watches.ts;导航/路由/中英 i18n/dw 样式、 桌面外壳导航项(desktop webview 全等比较)。 - 触发模式文案消歧:「@ 本机器人才回复」/「所有新评论(含未 @ 机器人)」,表单 写明飞书只推送「@ 了本机器人」的评论(@自己/@同事需选所有新评论由轮询读取); 机器人下拉在本页专有放宽宽度以完整显示长 bot 名(不改共享下拉全局样式)。 验证:tsc/build rc=0;相关 29 文件 1092 passed/1 skipped;含 store 运行态/溯源 策略相反、IPC(基线重置/F2/F3/legacy anchor 迁移/400/401/404/503)、poller 接线 源码形状(未导出函数)、桌面 webview 等;关键行为均做反变异确认有牙。 待验证:真机页面/切模式/基线重置的持续回归。 Co-authored-by: Claude Code <[email protected]>
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.
问题
飞书文档原生评论监听当前按整篇文档复用
doc:{fileToken}会话。同一文档短时间出现多条独立评论时,它们会进入同一个 CLI 会话,后续评论可能被合并到正在执行的 turn,表现为部分评论长期没有正式回复。预期行为应与飞书话题会话一致:不同评论线程互相独立、可以并行;同一评论线程的后续回复继续复用原会话。
修复
fileToken + commentId创建或复用会话;不同评论线程可并行,同一评论线程继续复用。doc:{fileToken}:watch锚点。关闭单个评论会话不会停止整篇文档监听;旧绑定会在会话恢复前迁移。--all模式用 accepted marker 衔接 WS 重试与列表游标:评论已执行但游标尚未提交时不会重复执行,游标推进与 marker 清理使用同一次原子写。影响面
watch-comment文档原生会话、评论 WS/轮询投递、会话恢复和关闭流程,以及 worker/adopt 的接纳结果上报。验证
9个测试文件,733 passed。tsconfig.json、tsconfig.test-mocks.json、tsconfig.scripts.json均通过。bun run build通过,dist 与嵌入资源审计通过。22506 passed,其中 3 项基线失败(2 个 MCP sandbox、1 个 Dashboard loopback timeout);在精确基线60b460c1上可同样复现。