Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

Merge pull request #2222 from yg2224/fix/session-model-write-order

vastsad128b12e2cac
diff --cc docs/spec/04-ux/08-component-spec.md
index 5a4b6bcb4,61c9f4cc7..a5b3f8aef
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@@ -1,13 -1,9 +1,17 @@@
# 08. Component Spec
+Workspace file index Git queries settle at their deadline or output limit,
+even when inherited child pipes do not close. Composer file search and the
+Files index then use the existing bounded filesystem fallback (Refs #1731).
+
+The Composer queue mirror accepts only the current read for each session. A newer queueChanged event invalidates earlier reads so an already delivered prompt cannot reappear. Reads in other sessions remain independent, and future refreshes still reconcile authoritative entries (Refs #1699).
+
+A bounded session detail read must not overwrite an idle transcript cache changed while that read was pending. Keep its newer messages and history window together. Running sessions still merge unflushed live rows, and the requesting caller receives its own read response (Refs #2086).
+
+ Idle session model writes participate in the same per-session configuration
+ queue as running-turn changes. Rapid choices serialize; the newest queued
+ choice is applied after the in-flight write, rather than racing older replies.
+
A full transcript read may fill its session cache only when that cache has not
changed during the request. New streaming or edit snapshots retain ownership;
the caller still receives the requested history for its own action validation.
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index 645735072,fad7bc640..5ee166e85
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -1,20 -1,12 +1,27 @@@
# 04. E2E Test Plan
+### E2E-FILE-INDEX-git-deadline
+
+Drive `getWorkspaceFileIndex` and `searchWorkspaceFiles` against real fixture
+files. Hold Git's close event beyond its deadline: both calls return the bounded
+filesystem listing. Coverage: `fs-index-git-deadline.test.mjs`. Existing index
+tests cover Git ignore semantics, Unicode chunk boundaries and deep search.
+
+### E2E-QUEUE-late-read-after-event
+
+Render two queued prompts, hold a production refresh, deliver a queueChanged event removing the first prompt, then return the old read. Only the second remains visible; a later authoritative refresh still applies. `queue-refresh-event-order.test.mjs` covers event/read order, reversed reads and session independence; `e2e-queue-refresh-event-order.mjs` renders production ComposerStatus/useAppStore in real Electron. No prompt is dispatched to a provider.
+
+### E2E-TRANSCRIPT-window-cache-edit-race
+
+Hold a bounded production session read, publish an idle edit cache with a different history window, then return the older window. Navigate/render from cache and observe the edited content. Also cover unchanged hydration and running live-tail merge. `session-window-cache-race.test.mjs` exercises the runtime API; `e2e-session-window-cache-race.mjs` renders the recovered snapshot through production MessageRow in real Electron. The API is controlled and no provider executes.
+
+ ### E2E-MODEL-idle-write-order
+
+ Hold the first idle configuration response, select a second model, then release
+ both responses. Assert a single in-flight write and the final newest model.
+ Coverage: `session-model-write-order.test.mjs`, using real slice/coordination
+ with only Host API controlled. Running-turn configuration remains queued.
+
### E2E-EXTENSION-thinking-request-state
Set high thinking through the production extension bridge, send a prompt and
diff --cc docs/zh-CN/spec/04-ux/08-component-spec.md
index 0ddb1120d,0f6cdf671..243461b8d
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@@ -1,12 -1,8 +1,15 @@@
# 08. 组件规格
+工作区文件索引的 Git 查询在截止时间或输出上限直接结束等待,即使继承的
+子进程管道未关闭。输入框文件搜索及 Files 索引使用现有有界目录回退(Refs #1731)。
+
+Composer 队列镜像仅接受每个会话当前读取。更新的 queueChanged 事件使旧读取失效,已送出的提示不会重新出现。其他会话读取相互独立,后续刷新仍可同步权威队列条目(Refs #1699)。
+
+有界会话详情读取期间,空闲会话缓存发生修改时,旧读取不能覆盖新消息及其历史窗口。运行中会话继续合并未落盘的实时消息,读取调用方仍得到自己的响应(Refs #2086)。
+
+ 空闲会话的模型写入使用与运行中配置相同的会话队列,快速选择顺序写入,
+ 最新排队选择在当前写入完成后生效,避免旧响应覆盖新模型。
+
全量会话读取仅在请求期间缓存未改变时写入该会话缓存。新的流式消息或编辑
快照保留所有权;调用方仍得到读取的历史,用于独立动作校验。
diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index b1f1e05aa,70a63e5e9..7e7698b2b
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@@ -1,20 -1,11 +1,26 @@@
# 04. E2E 测试 Plan
+### E2E-FILE-INDEX-git-deadline
+
+对真实测试文件调用 `getWorkspaceFileIndex` 和 `searchWorkspaceFiles`,
+保持 Git 的 close 事件未到达,推进截止时间后两者均返回有界目录列表。
+覆盖:`fs-index-git-deadline.test.mjs`。原有索引测试覆盖 Git 忽略规则、
+Unicode 字节分块及深层搜索。
+
+### E2E-QUEUE-late-read-after-event
+
+呈现两个排队提示,保持生产刷新,发送 queueChanged 事件移除第一个提示,再返回旧读取;只显示第二个提示,后续权威刷新继续生效。`queue-refresh-event-order.test.mjs` 覆盖事件与读取顺序、逆序响应及会话独立性;`e2e-queue-refresh-event-order.mjs` 在真实 Electron 中呈现生产 ComposerStatus/useAppStore。不向提供商发送提示。
+
+### E2E-TRANSCRIPT-window-cache-edit-race
+
+保持生产有界会话读取,发布带新历史窗口的空闲编辑缓存,再返回旧窗口;从缓存恢复并呈现编辑后的正文。同时覆盖未变化时正常填充及运行中实时尾部合并。`session-window-cache-race.test.mjs` 验证 runtime API;`e2e-session-window-cache-race.mjs` 在真实 Electron 中使用生产 MessageRow 呈现恢复快照。仅控制 API,不执行提供商。
+
+ ### E2E-MODEL-idle-write-order
+
+ 保持空闲配置的首个响应,选择第二个模型再顺序释放响应,验证只有一个写入
+ 进行中且最终保留最新模型。`session-model-write-order.test.mjs` 使用真实 slice
+ 与协调器,仅控制 Host API 边界。运行中配置继续排队。
+
### E2E-EXTENSION-thinking-request-state
通过生产扩展桥接设置 high,发送提示并捕获提供商流参数。真实 Agent 循环