Skip to content

fix(panel): 从 KV 恢复终态条目时保留 endedAt(#26) - #28

Merged
Hotakus merged 1 commit into
Hotakus:masterfrom
aiev:fix/entry-endedAt-26
Sep 24, 2026
Merged

Hotakus merged 1 commit into
Hotakus:masterfrom
aiev:fix/entry-endedAt-26

Conversation

@aiev

@aiev aiev commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

修复

从 KV 恢复终态条目时,loadEntries() 通过 upsertSubEntry() 重建 map,而后者把 endedAt 视为「本次 upsert 的时刻」:恢复路径没有 existing,持久化的 endedAt 被写成 Date.now(),渲染侧 elapsed = (entry.endedAt ?? now()) - entry.startedAt 于是随每次进入会话被重置并持续变大(实测 21.14s → 10m28s)。

  • SubEntryPatch 允许透传 endedAt?;
  • upsertSubEntry:endedAt: existing?.endedAt ?? partial.endedAt ?? now——事件路径不携带 endedAt,行为不变;恢复路径保留持久化值。

引入自 0ccba2d(v1.6.0);仅影响内存显示,不污染持久化数据(落盘走 mergeSubEntries,本就会保留原值),无需数据迁移。

验证

  • 新增回归测试:恢复带 endedAt: 500 的终态条目后仍为 500。
  • npm run typecheck / npm run build / npm test:29 项测试全部通过。

备注

@Hotakus Hotakus added the bug Something isn't working label Sep 24, 2026
@Hotakus

Hotakus commented Sep 24, 2026

Copy link
Copy Markdown
Owner

感谢你的BUG修复和新功能添加,我会尽快上线新版本,感谢你的支持

@Hotakus
Hotakus merged commit d6c67c3 into Hotakus:master Sep 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: 切换会话返回后,已完成子代理条目的耗时被重置并持续增长

2 participants