Skip to content

fix: panel dock frozen after page refresh — barrier rejects every new fence - #5

Merged
taekchef merged 1 commit into
mainfrom
fix/panel-dock-frozen-after-refresh
Aug 14, 2026
Merged

fix: panel dock frozen after page refresh — barrier rejects every new fence#5
taekchef merged 1 commit into
mainfrom
fix/panel-dock-frozen-after-refresh

Conversation

@taekchef

Copy link
Copy Markdown
Collaborator

Closes #4 — 页面刷新后面板 dock 冻结,新 panel:true 围栏被持久化重放屏障静默拒绝。

根因(与 issue 排查一致,已在宿主源码证实)

宿主 anchor key 格式 = conversationContextKey(kind, id) = ${kind长度}:${kind}${id};assistant step 的 id 是 ${turn}:${step} → 完整 key 如 14:assistant-step3:0。DOM 通道 anchorSeqOf 旧实现取 key 里第一个数字 = kind 名称长度常量(assistant-step=14,所有消息相同)→ 面板 store 的持久化屏障(刷新后 replayBarrier = 持久化 maxSeenSeq = 该常量)拒绝一切新围栏(order[0] <= barrier):dock 停在旧快照、旧按钮 action 仍活、控制台零日志、清 localStorage 恢复但刷新复发。

修复

  • src/client/dom-fence.tsx anchorSeqOf:从 assistant-step key 解析 <turn>:<step>seq = turn*1000+step —— 随消息顺序严格单调,刷新后新消息的 turn 必然大于持久化屏障 → 新面板正常更新;历史重放(同 turn)依旧被屏障正确杀死。非 assistant 行 / 无锚点(Safari)行保留文档序兜底
  • /panel 本地覆盖连带修复localBarrier 同样依赖该 seq,此前 /panel 一次也会冻结后续所有面板更新——同一根因,一并解决
  • 诊断(issue 建议 3)applyPanelOperation barrier 拒绝路径加一次性 console.warn[genui] 面板操作被重放屏障拒绝(source …,order[0]=… ≤ replayBarrier … / localBarrier …),每 source 每页面会话一条);预算 overflow 后置 append 拒绝仍走既有 budget 诊断不重复告警

验证

  • 新增 3 个回归测试:DOM 通道刷新全流程(turn 2/3 面板 → 模拟刷新 → 历史重放保持旧快照 → turn 4 新围栏更新 dock)——旧代码上该测试失败于 expected '面板B' to be '面板C',精确复现报告症状;同 turn 内 step 单调性;屏障拒绝告警一次/条
  • 全量 363 项:261 passed / 102 skipped,0 失败
  • lib/client.js 已重建并提交

… fence

The host's anchor key is `<kindLen>:<kind><id>` (`14:assistant-step3:0`);
`anchorSeqOf` grabbed the FIRST number in the key — the kind-name length
constant — so every assistant step yielded the same order[0]. The panel
store's persisted replay barrier (hydration sets replayBarrier = persisted
maxSeenSeq = that constant) then rejected every new panel:true fence after
a refresh. Dock froze on the old snapshot, actions kept working, zero logs
(issue #4).

- anchorSeqOf: parse `<turn>:<step>` from assistant-step keys → seq =
  turn*1000+step, strictly monotonic in message order and growing across
  reloads; document-order fallback kept for non-assistant / anchor-less
  (Safari) rows. Also un-freezes the /panel local-override barrier, which
  depended on the same broken seq.
- Diagnostics: one-time console.warn per source per page session when a
  barrier rejects an op ([genui] prefix, values included); budget-overflow
  rejections stay on the existing budget diagnostic.

Closes #4
@taekchef
taekchef merged commit f75f286 into main Aug 14, 2026
2 checks passed
@taekchef
taekchef deleted the fix/panel-dock-frozen-after-refresh branch August 14, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 页面刷新后面板 dock 停止更新——新的 panel:true 围栏被持久化重放屏障静默拒绝

1 participant