BitFun icon indicating copy to clipboard operation
BitFun copied to clipboard

[Bug]: 历史分页失败提示中的「重新同步记录」按钮不可点击(哨兵容器 pointer-events:none),且部分加载会话上滚偶发 no-next-presentation

Open QZQ-go opened this issue 2 weeks ago • 0 comments

摘要

两个问题叠加,导致「更早的记录读取失败」出现之后用户无法自行恢复:

  1. (确定性 UI bug)报错行里的「重新同步记录」按钮完全点不动。 承载它的哨兵容器 .virtual-message-list__history-paging-sentinel 声明了 pointer-events: none,而重试按钮就渲染在这个容器内部。data-history-paging-sentinel=error 只恢复了 visibility: visible,容器依旧不接收指针事件,按钮永远点不到。
  2. (竞态)部分加载的会话在仍有新 turn 写入时上滚分页会偶发失败,边界状态被置为 error,也就是用户看到的那句提示。本次实测 2 次,均为 direction=before, reason=no-next-presentation;后端与 relay 无任何报错,会话数据完好(42 个 turn 文件与 turn-catalog.json 一致,complete: true),没有记录丢失。

复现(问题 2)

  1. 打开一个 40+ turn 的本地历史会话。打开时只 hydrate 尾部极少量 turn(诊断日志:store_state_commit_finished {totalTurnCount: 40, dialogTurnCount: 1, isPartial: true},historyState 从 metadata-only 变 ready)。
  2. 向上滚动触发 before 分页,前几次正常。
  3. 在会话仍在生成新 turn(或刚发出新消息)时继续上滚 → 顶部出现「更早的记录读取失败;当前内容仍可查看。」+「重新同步记录」。
  4. 点击「重新同步记录」→ 无任何反应(见问题 1),只能退出会话或重启应用才能恢复。

证据(webview.log)

[2026-11-15T22:15:26][WARN][webview] [HistorySessionDiagnostics] FlowChat history paging did not become ready {"sessionId":"3afb433f-…","diagnosticId":"3afb433f-156633425-114","direction":"before","reason":"no-next-presentation","targetOrdinal":38}
[2026-11-15T22:16:50][WARN][webview] [HistorySessionDiagnostics] FlowChat history paging did not become ready {"sessionId":"3afb433f-…","diagnosticId":"3afb433f-156633425-114","direction":"before","reason":"no-next-presentation","targetOrdinal":36}

第二次失败发生在 22:16:47 用户发出新消息(Dialog turn started)之后 3 秒。日志里不存在 Relay history page failed、Failed to synchronize session history from its owner、Failed to prefetch an adjacent session Turn window 之类的错误,说明 load_session_turn_window 本身返回了结果,失败发生在客户端窗口拼接阶段。

代码定位(1.0.10 打包产物)

问题 1 — ChatPane-*.css

.virtual-message-list__history-paging-sentinel{...;pointer-events:none;overflow-anchor:none;visibility:hidden}
.virtual-message-list__history-paging-sentinel[data-history-paging-sentinel=loading],
.virtual-message-list__history-paging-sentinel[data-history-paging-sentinel=error]{visibility:visible}

error 态只恢复了 visibility,没有恢复 pointer-events;而重试按钮(onSynchronize → fo("before", true),文案 historyState.synchronize)是哨兵节点的子元素。建议:error 态补 pointer-events: auto,或给按钮自身加 pointer-events: auto,或把按钮移出哨兵容器。

问题 2 — 分页状态机

loadSessionTurnWindow 返回 status:"ready" 之后,extendSessionHistoryWindow() / activateSessionHistoryWindowFromTail() 返回 null,于是记录 outcome_not_ready{reason:"no-next-presentation"} 并把该边界钉成 error。可疑点:

  • seedSessionHistoryLoadedRanges() 在 turn catalog revision 变化时会执行 navigationGeneration += 1; pendingTargetOrdinal = null; activeRange = null; loadedRanges = []。若此时界面上的 presentation 仍是 history-range(ChatPane 里 jt 仍非空),下一次上滚必然走 extendSessionHistoryWindow(),而它依赖 sessionHistoryViews.get(id).activeRange,activeRange === null 时直接返回 null → no-next-presentation。
  • activateSessionHistoryWindowFromTail() 在 activeRange !== null 时同样直接返回 null,所以「store 里残留旧 range、界面却显示 canonical tail」的不一致也会命中同一失败。

建议:range 被重置时同步重建/清空 presentation;或让这两条路径找不到 activeRange 时退化为「从 loadedRanges 重新 activate」;并把 no-next-presentation 视为可自动重试的瞬时失败,不要直接把边界钉成 error。

环境

  • OpenBitFun 1.0.10(macOS 桌面版,Apple Silicon)
  • 会话类型:本地工作区(surfaceId=local,非 remote/relay,非 dispatch job)
  • 会话:3afb433f-…,42 turns,turn-catalog.json complete: true
  • diagnosticId:3afb433f-156633425-114

QZQ-go avatar Nov 15 '26 14:11 QZQ-go