Skip to content

fix(chat): 删除靠前 message 后保持滚动锚点稳定 (#2289) - #2437

Open
gardenZzz wants to merge 1 commit into
makecindy:mainfrom
gardenZzz:fix/message-delete-scroll-anchor
Open

fix(chat): 删除靠前 message 后保持滚动锚点稳定 (#2289)#2437
gardenZzz wants to merge 1 commit into
makecindy:mainfrom
gardenZzz:fix/message-delete-scroll-anchor

Conversation

@gardenZzz

@gardenZzz gardenZzz commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

删除会话中靠前的 message 后,聊天视口可能跳到错误位置。删除路径只更新 store,原有补偿在数组收缩时不会介入;Chromium 的 overflow-anchor 又会在锚点元素本身被删时失效。

本 PR 将删除、分组和程序化滚动的锚点处理收敛到 MessageStream

  • 记录删除前的视口锚点;锚点被删时按旧序列选择相邻存活内容。
  • 顶层 message 被删时按完整 render-item 序列选邻居,不跳过紧随的 work group、工具或媒体内容。
  • 展开 work group 内的子 message 删除按完整 clientId 序列(含 tool / task / 嵌套组)选邻居,不再跳过中间的工具行;DOM 查询取最内层 data-message-client-ids
  • 视口子锚点同时识别展开工具行的 data-message-client-id 与折叠工具块的 data-message-client-ids,避免外层 work-group key 仍在时跳过删除补偿。
  • render window 锚点被连带删除时,从上一帧全量序列重建窗口,待 DOM 就绪后复位。
  • focus / chip / 导航轨道的程序化滚动使用 generation token;用户接管(含空格与滚动条拖拽,输入框内空格除外)会重放延期删除补偿。
  • 跳底 smooth 保存 generation,在 scrollend、用户接管或安全超时后收尾,避免删除补偿被卡住。
  • 用户接管跳底 / focus 平滑滚动时:若有延期删除先解除乐观贴底,再停止原生 smooth,避免重放被贴底保护吞掉。
  • 会话还原落定后量测子锚点,切回已展开工作组内部时也能补偿跨视口顶的 child 删除。

变更类型

  • fix 缺陷修复

范围

  • 关联 Issue:Closes bug: 删除 session 中靠前 message 后页面锚点偏移 #2289
  • 变更文件:MessageStream.tsxAgentActionRow.tsxuseNavigationKeyListener.ts 与对应 key / anchor / focus 生命周期回归测试。
  • 不包含:删除 store 路径、数据库、协议、mount restore 状态机。
  • 用户可见变化:删除靠前 message 后保留原阅读位置;删除当前锚点或 focus 目标时落到相邻内容(含中间工具行);新导航不再被旧 focus 拉回。
  • Breaking change:无

UI 变化

不涉及视觉、文案、颜色或布局规范变更;仅修正既有聊天列表的滚动位置与导航接管语义。

  • 引用的设计规范:docs/design-rules/DESIGN.md §14 Interaction Conventions;保持用户直接控制,用户滚轮、触摸、空格、滚动条或键盘接管后不再被旧程序化滚动拉回。

怎么验证的

本地定向验证

pnpm exec eslint src/renderer/components/chat/MessageStream.tsx \
  src/renderer/__tests__/focusScrollLifecycle.test.ts
结果:通过

pnpm exec vitest run --reporter=dot \
  src/renderer/__tests__/focusScrollLifecycle.test.ts \
  src/renderer/__tests__/buildRenderItemsKeyStability.test.ts \
  src/renderer/__tests__/scrollAnchoringDetect.test.ts \
  src/renderer/__tests__/agentActionRowRendering.test.ts
结果:4 files / 123 tests passed

CI 验证

  • 当前 head 36522ddab:push 后由 fork / 主仓 client-ci 执行,终态以该 SHA 的 run 为准。
  • DCO:commit 带匹配 author 的 Signed-off-by

未在本地执行

  • pnpm test:unit 全量:按维护者指示考虑本地机器负载,不在本机运行;交 client-ci 完整执行。
  • desktop typecheck:交同一 client-civerify-checks
  • Desktop 长会话人工交互:未执行;不把静态检查或单测等同于实机目检。

风险

  • 影响范围:Desktop 聊天消息列表的删除补偿、focus 跳转落定及程序化滚动收尾。
  • 回滚:revert 本 commit 即恢复旧行为;不涉及用户数据或持久化格式。
  • 当前未知:当前 head 的 CI 与 Desktop 长会话人工交互结果。

提交前检查

  • 已 review 完整 diff
  • PR 已合并为单一 commit
  • commit 带匹配 author 的 DCO Signed-off-by
  • UI 路径改动已注明引用的设计规范章节
  • 未提交凭证、令牌或授权文件
  • 已说明本地已验证与未验证边界

@gardenZzz
gardenZzz requested a review from a team as a code owner August 11, 2026 08:53
@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

Greptile Summary

本 PR 将消息删除、分组子项和程序化滚动的视口锚点生命周期统一收敛到 MessageStream

  • 使用完整 render-item 与 clientId 序列,在当前锚点被删除时选择相邻存活内容
  • 为 focus、chip、导航轨道和跳底滚动引入 generation 保护及延期删除补偿重放
  • 为工具行和工作组子消息补充精确 DOM 锚点,并扩充相关生命周期回归测试

Confidence Score: 5/5

当前 HEAD 已覆盖此前反馈的删除补偿与程序化滚动收尾路径,未发现仍需阻止合并的故障。

没有剩余的阻塞性故障。

Important Files Changed

Filename Overview
apps/desktop/src/renderer/components/chat/MessageStream.tsx 集中实现删除锚点采集、相邻内容选择、render window 重建,以及 focus/chip/跳底滚动的 generation 与补偿生命周期。
apps/desktop/src/renderer/components/chat/AgentActionRow.tsx 为展开工具行增加 message clientId DOM 锚点,使视口量测和删除恢复能够定位到具体工具行。
apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts 扩展滚动导航键的共享判定,使空格键接管程序化滚动,同时排除可编辑输入目标。
apps/desktop/src/renderer/tests/focusScrollLifecycle.test.ts 覆盖滚动 generation、用户接管、延期删除重放、目标重新解析和子锚点量测的回归场景。
apps/desktop/src/renderer/tests/buildRenderItemsKeyStability.test.ts 覆盖删除后相邻锚点选择、完整 clientId 顺序及滚动接管按键判定。
apps/desktop/src/renderer/tests/agentActionRowRendering.test.ts 验证工具行会暴露可供视口恢复使用的精确 clientId DOM 锚点。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[记录删除前视口锚点] --> B{消息是否在程序化滚动期间删除}
  B -- 否 --> C[按旧序列选择存活锚点]
  B -- 是 --> D[登记延期删除补偿]
  D --> E{滚动如何结束}
  E -- 正常落定 --> F[校正导航目标]
  E -- 用户接管 --> G[取消当前 generation]
  F --> H[刷新视口锚点]
  G --> I[重放延期删除补偿]
  I --> C
  C --> J{目标是否在当前 render window}
  J -- 是 --> K[恢复 message 或 render-item 偏移]
  J -- 否 --> L[重建窗口并在 DOM 就绪后复位]
Loading

Reviews (33): Last reviewed commit: "fix(chat): 删除靠前 message 后保持滚动锚点稳定 (#2289..." | Re-trigger Greptile

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82e4467491

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 82e4467 to 6ee319a Compare August 11, 2026 09:09
@gardenZzz

Copy link
Copy Markdown
Contributor Author

已采纳 @greptile-apps 的发现并修复。

原问题:删除补偿 effect 之前读 sessionScrollStore 快照,但该快照只在用户手动滚动时落盘(handleScrollprogrammaticScrollRef 时早退,不调 saveScrollSnapshot)。程序化跳转 / mount-restore 后快照陈旧,删除时用它复位反而把视口拉回旧位置。

修复:改用本 effect 每帧量测并缓存的「上一帧视口顶端」ref(lastViewportTopRef)作为删除前快照,不再读 sessionScrollStore。每帧 layout 提交时量到的视口顶端就是用户实际看到的位置,删除前那一帧的值天然是「删除前快照」,不受程序化滚动影响。

已 force push(6ee319a9b),重新触发 client-ci。

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

The fix is well-reasoned and the implementation looks correct. A few observations on the approach:

The ordering is the key insight. Capturing prevViewportTop = lastViewportTopRef.current before updating it with the current frame's measurement means that on any deletion frame, prevViewportTop naturally holds the pre-deletion position — no separate snapshot mechanism needed.

One edge case worth noting: measureViewportTop() can return null (e.g., when the container isn't mounted or has no children). In that case lastViewportTopRef.current stays at its previous value. If a deletion happens on a subsequent frame, prevViewportTop would reflect an even older position. This is unlikely to cause visible issues in practice since measureViewportTop returning null typically means the scroll container isn't visible, but worth being aware of.

The fallback for idx < 0:

idx = Math.min(prevIdx, curKeys.length - 1);

This correctly handles the case where the deleted item was the viewport top — it pins to whatever is now at that index position (the next surviving item). One subtlety: if prevIdx === prevKeys.length - 1 (the last item was deleted), this clamps to curKeys.length - 1 (the new last item), which is correct behavior.

The attribution comment is a nice touch. The approach is sound — using the layout effect's own per-frame measurement as the pre-deletion snapshot is strictly more accurate than relying on sessionScrollStore, and avoids the stale-after-programmatic-scroll class of bugs entirely.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ee319a9b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@gardenZzz 👋 这个 PR 还有 6 条 review conversation 没 resolve(apps/desktop/src/renderer/components/chat/MessageStream.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added the touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) label Aug 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bed39e9ef6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from bed39e9 to 8d27939 Compare August 11, 2026 10:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d27939f8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 8d27939 to a03e953 Compare August 11, 2026 10:07
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a03e953f30

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from a03e953 to 57c4b01 Compare August 11, 2026 10:15
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 57c4b01 to 56e762b Compare August 11, 2026 10:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56e762b651

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 56e762b to 678c29f Compare August 11, 2026 10:26
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 678c29f to 66d7002 Compare August 11, 2026 10:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66d7002e0b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

此 PR 触发了维护者确认门(product:命中 UI 路径 MessageStream.tsx)。已创建讨论 issue,等待维护者确认后放行。

讨论 issue:#2456

@MagicLizi MagicLizi added the awaiting-discussion 等待维护者讨论(review-pr) label Aug 11, 2026
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 66d7002 to b3aa8b5 Compare August 11, 2026 10:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea96eb5ad3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch 2 times, most recently from 93d888d to 49038af Compare August 12, 2026 14:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93d888dfd7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49038af44c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch 2 times, most recently from bef6541 to 6b31112 Compare August 12, 2026 14:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b31112634

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 6b31112 to 57f007b Compare August 12, 2026 14:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57f007b174

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@gardenZzz 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/components/chat/MessageStream.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 57f007b to ad73002 Compare August 12, 2026 15:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad73002b71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from ad73002 to 816b0e4 Compare August 12, 2026 15:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 816b0e48dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@gardenZzz 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/components/chat/MessageStream.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 816b0e4 to e96fcce Compare August 12, 2026 18:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e96fcce7ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from e96fcce to 5296d91 Compare August 12, 2026 19:08
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5296d91d95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 5296d91 to 6da1192 Compare August 12, 2026 19:16
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6da1192e5e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx
Comment thread apps/desktop/src/renderer/components/chat/MessageStream.tsx
删除后用删除前视口快照选择相邻存活内容;展开工作组内的子消息删除按完整
clientId 序列选邻居,不再跳过中间的工具行。视口子锚点同时识别
data-message-client-id 与工具块的 data-message-client-ids;chip/轨道跳转
把空格和滚动条拖拽视为用户接管,输入框内的空格除外。跳底 smooth 的
generation 在 scrollend、接管或安全超时后收尾,避免删除补偿被卡住。
用户接管时先解除乐观贴底并停止原生平滑滚动,避免延期删除重放被贴底
保护吞掉;会话还原落定后补量子锚点。

验证:ESLint 与 focusScrollLifecycle / buildRenderItemsKeyStability /
scrollAnchoringDetect / agentActionRowRendering 共 123 个定向测试通过;
全量 test:unit 与 typecheck 交 client-ci。

Closes makecindy#2289

Signed-off-by: GardenX <20606485+gardenZzz@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@gardenZzz
gardenZzz force-pushed the fix/message-delete-scroll-anchor branch from 6da1192 to 36522dd Compare August 12, 2026 19:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36522ddab7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3127 to +3129
itemElement.querySelectorAll<HTMLElement>(
'[data-message-client-id], [data-message-client-ids]',
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 为展开的 thinking 行提供子锚点

当视口顶边穿过已展开工作组里的 thinking 行时,这个查询无法记录该 child:ExpandedThinkingRowWorkGroupBlock.tsx:203-287)没有 data-message-client-id,redacted 分支也同样没有。若该 thinking 消息随后被删除而同一工作组仍有其他子项,外层 render-item key 和可见条目数都不变,snapshotMessageGone 也不会成立,删除补偿会直接跳过并留下 Chromium 造成的视口跳变;应像工具行和普通消息一样给 thinking 行暴露其 clientId。 docs/dev-rules/engineering-conventions.mdL243-L248

Useful? React with 👍 / 👎.

@MagicLizi MagicLizi removed the status:awaiting-bot-review 等外部审查机器人表态(review-pr 自动维护,仅展示) label Aug 13, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

@gardenZzz 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/components/chat/MessageStream.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added the status:threads-open 还有未 resolve 的评审讨论(review-pr 自动维护,仅展示) label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:threads-open 还有未 resolve 的评审讨论(review-pr 自动维护,仅展示) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: 删除 session 中靠前 message 后页面锚点偏移

3 participants