Repository navigation
Perf/review diff serialization - #2518
Merged
Merged
Conversation
Cache serialized review payloads by object identity so streamed text does not repeatedly serialize unchanged diffs. Preserve refresh detection for new tool results and rollbacks.
Reuse the previous review revision when tool facts are unchanged. Preserve refreshes for late delegate edits, rollbacks, and session switches.
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.
Summary / 概要
Review 面板打开时,即使助手只是流式追加文本,刷新判定也会重新序列化并拼接已有工具消息的 diff。审阅数据没变,但这部分工作仍在重复执行。
本 PR 按对象引用缓存 diff 的序列化结果,并在工具消息的 ID、状态、顺序和审阅内容都未变化时复用上一次的刷新标识。不改变审阅面板的界面或交互。新增变更、回滚及迟到的子任务结果仍会更新审阅数据;切换会话时不复用上一会话的刷新状态。
Validation / 验证
Review 相关单测共 21 项通过,覆盖纯文本更新、迟到的子任务结果、会话切换和回滚。已补充 Electron 回归场景;当前环境缺少
packages/shared/dist/index.js,Review E2E 未能启动,完整桌面类型检查尚未运行。Node.js 22.23.2 微基准:同一组 30 条审阅记录,每条 250 行 diff,连续 100 次仅更新助手文本。与第一笔已缓存序列化、但仍重新拼接标识的实现(
820e8eefe)相比,11 轮测量的中位耗时从 25.85 ms 降至 0.05 ms,生成的刷新标识一致。该结果只衡量刷新标识计算,不代表 Electron 界面整体耗时。Requirement link / 需求关联