Repository navigation
fix(sessions): 有界详情读取保留新的空闲编辑缓存 - #2233
Merged
Merged
Conversation
旧详情读取不能覆盖空闲会话的编辑缓存和历史窗口。未更新缓存仍正常填充,运行中的实时尾部继续按已有规则合并。 Refs vastsa#2086
SeanLiu326
added a commit
to SeanLiu326/PI-Desktop
that referenced
this pull request
Nov 12, 2026
…e compare The guard required a captured cache entry before comparing, so a read that started with no transcript cache entry could never see the movement an in-flight idle edit makes (undefined -> entry). The runtime guard this mirrors (vastsa#2233) needs no such precondition; dropping it keeps the caller-level compare aligned with that semantics. Warm re-selects are unaffected: the comparison is the same reference check it always was, and a quiet read whose runtime write replaces the entry still resolves to the same window content.
jiangchuanso
pushed a commit
to jiangchuanso/PI-Desktop
that referenced
this pull request
Nov 15, 2026
…s detail read selectSession awaited the bounded detail read and then re-cached and committed its window unconditionally. An idle-session edit (message delete, revision switch) that landed while the read was in flight replaces the transcript cache entry, so committing the stale window reverted the edit on screen and in the cache. vastsa#2233 taught loadSessionDetail itself to refuse caching such a read; the caller-level commit now applies the same guard: when the cache entry moved during the read for an idle session, the commit keeps the edit writer's cache content and cached window instead. Pinned by session-select-stale-read.test.mjs driving the real slice (superseded read keeps the edit; uneventful re-select still hydrates; running sessions still merge the live tail).
jiangchuanso
pushed a commit
to jiangchuanso/PI-Desktop
that referenced
this pull request
Nov 15, 2026
…e compare The guard required a captured cache entry before comparing, so a read that started with no transcript cache entry could never see the movement an in-flight idle edit makes (undefined -> entry). The runtime guard this mirrors (vastsa#2233) needs no such precondition; dropping it keeps the caller-level compare aligned with that semantics. Warm re-selects are unaffected: the comparison is the same reference check it always was, and a quiet read whose runtime write replaces the entry still resolves to the same window content.
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.
侧边栏预读取的有界 session.get 晚返回时,原逻辑把旧正文及旧历史窗口写回缓存,覆盖请求期间的空闲编辑。现在仅在缓存仍未变化,或需要合并运行中的实时尾部时回填;调用方仍获得读取响应。此修复是 loadSessionDetail 路径,区别于已合入 #2224 的 loadFullSessionMessages。
主要实现:apps/desktop/src/stores/runtime/session-runtime.ts;新增生产入口回归和独立 Electron 检查,同步中英文规格及 E2E 场景。
旧代码回归把 edited 内容变回 original;候选有界/全量缓存、streaming、空读取保护及相关回归 25/25 通过。真实 Electron 用生产 runtime/API 及 MessageRow 呈现恢复缓存,正文为新编辑内容且窗口与之配对。Desktop TypeScript、样式、文档检查通过。仅调整已有源码断言以容纳缓存所有权条件,保留可疑空读取保护及新增 live-tail 行为断言。
候选 81e5f13,基线 4ad0094。运行命令为 Node D:/pi/toolchain/node.exe、
node --test、Desktoptsc --noEmit、node scripts/e2e-session-window-cache-race.mjs、样式及文档检查。Electron 检查使用本候选的生产代码与实际 BrowserWindow,仅控制外部 API 结果,复用宿主依赖和样式;没有访问真实用户配置、真实远端或付费 provider。此专项 Electron 测试不等同于完整应用 bootstrap E2E,后者未运行。Refs #2086。修复与该综合反馈有关的确定缺陷,未声称覆盖原 issue 全部根因。等待最新 head 的远端 CI 和人工评审。
2026-11-10 12:00 复查:本 PR 上述最新 head 的六项 CI 均 SUCCESS,无 pending、无失败;主线仍为 4ad0094,无冲突,GitHub merge-ref 的源码树再次核对与本地已验证候选一致。尚无人工批准。