Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
address review: keep system rows inside the live walk
yu.xiabc4cfbf7a189
diff --git a/apps/desktop/src/lib/turn-process.ts b/apps/desktop/src/lib/turn-process.tsindex db75e40e2..d589c7f36 100644--- a/apps/desktop/src/lib/turn-process.ts+++ b/apps/desktop/src/lib/turn-process.ts@@ -266,12 +266,15 @@ export function turnHasStreamingRows(* entry. Tail position alone cannot identify it: a steering message or a* system row may render after the live turn (#1949), while the history list* renders every entry as inactive. Walk back like- * `collectLiveDelegationEntries`: steering user messages stay inside the run,- * an ordinary user message or system row ends it. The last assistant-turn of- * the current run is live only while it still has streaming rows; an earlier- * turn left streaming by a crash is outside this run's boundary and keeps+ * `collectLiveDelegationEntries`, with one deliberate difference: system rows+ * stay inside the run, because a system update can land during a tool call+ * and render after the turn's rows. The last assistant-turn of the current+ * run is live only while it still has streaming rows; an earlier turn left+ * streaming by a crash is outside this run's boundary and keeps* `turnProcessPhase`'s unsettled reading (#1923). A tail assistant-turn- * reports its own active state, so it yields no history id.+ * reports its own active state, so it yields no history id. `modelSystem`+ * rows never reach this walk: `isVisibleMessage` filters them from the+ * projected entries entirely.*/export function liveHistoryTurnId(entries: readonly TranscriptEntry[],@@ -286,8 +289,10 @@ export function liveHistoryTurnId(}if (entry.kind === "message") {const { message } = entry;+ // System rows arrive mid-run and stay inside it, like steering messages.+ if (message.role === "system") continue;if (message.role === "user" && message.steering) continue;- if (message.role === "user" || message.role === "system") break;+ break;}}return undefined;diff --git a/apps/desktop/test/turn-process.test.mjs b/apps/desktop/test/turn-process.test.mjsindex 1c1e70c7e..22b92ec32 100644--- a/apps/desktop/test/turn-process.test.mjs+++ b/apps/desktop/test/turn-process.test.mjs@@ -709,6 +709,41 @@ test("the last assistant-turn of the current run is the live turn when it is notundefined,);+ // A system row renders after the running turn's rows when a system update+ // lands during a tool call; it stays inside the run, so the walk reaches+ // the turn instead of stopping at the row.+ const systemTailed = buildTranscriptEntries([+ message("u8", "user", "go"),+ message("a8", "assistant", "partial answer", { status: "streaming" }),+ message("sys8", "system", "model config updated mid-turn"),+ ]);+ const systemHistory = systemTailed.entries.slice(0, -1);+ const systemTurn = systemHistory.find((entry) => entry.kind === "assistant-turn");+ assert.equal(systemTurn.kind, "assistant-turn");+ assert.equal(+ liveHistoryTurnId(systemHistory, systemTailed.entries.at(-1)),+ systemTurn.id,+ );++ // modelSystem rows never render: the projection filters them from the+ // entries, so they cannot end the walk either way.+ const modelSystemTailed = buildTranscriptEntries([+ message("u9", "user", "go"),+ message("a9", "assistant", "partial answer", { status: "streaming" }),+ message("ms9", "system", "hidden model system note", { modelSystem: true }),+ message("steer9", "user", "keep going", { steering: true }),+ ]);+ const msHistory = modelSystemTailed.entries.slice(0, -1);+ assert.equal(+ msHistory.some((entry) => entry.kind === "message" && entry.message.id === "ms9"),+ false,+ );+ const msTurn = msHistory.find((entry) => entry.kind === "assistant-turn");+ assert.equal(+ liveHistoryTurnId(msHistory, modelSystemTailed.entries.at(-1)),+ msTurn.id,+ );+// A turn left streaming behind a later ordinary prompt keeps the unsettled// reading: the later run's boundary excludes it (#1923).const crashedThenNew = buildTranscriptEntries([diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex d4821f1ed..d67da9816 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -911,9 +911,10 @@ without expanding the process. An untouched process closes on completion, leavinthe final answer; with no final text, the process header and those surfacesremain. Liveness follows the turn's rows, not the transcript's tail position:while the session runs, a turn whose rows are still streaming stays open and-reads as running even when a steering message renders after it. An ordinary-user message or a system row ends the run's boundary, so a turn left streaming-by an earlier crash keeps reading as an unknown outcome.+reads as running even when a steering message or a system row renders after+it — both stay inside the run. An ordinary user message ends the run's+boundary, so a turn left streaming by an earlier crash keeps reading as an+unknown outcome.Within the process, the `Transcript display` mode decides the grouping.`fully-folded` (the default; absent or unknown values use it) forms ordinarydiff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.mdindex 5a5f221f5..7823fa966 100644--- a/docs/zh-CN/spec/04-ux/08-component-spec.md+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md@@ -1078,9 +1078,9 @@ SESSIONS [msg+][↕]同级,长回合可以用一次操作收起。末尾回答、助手错误、中止后的末尾部分文字和待处理操作卡留在披露之外,无需展开过程即可访问。未操作的过程在完成时收起,只剩最终回答;没有最终文字时,过程标题和这些操作面仍会保留。回合的活跃性跟随其行状态而非转录的尾部位置:会话-运行期间,行仍在流式输出的回合即使后面渲染了 steering 消息,也保持展开并显示为执行中;-普通用户消息或系统行会结束当前运行的边界,早前崩溃遗留流式行的回合因此保持结果未知的-读法。+运行期间,行仍在流式输出的回合即使后面渲染了 steering 消息或系统行,也保持展开并显示+为执行中——两者都留在当前运行内;普通用户消息会结束运行的边界,早前崩溃遗留流式行的+回合因此保持结果未知的读法。在披露内部,`过程显示`模式决定活动如何分组。`fully-folded`(默认;缺失或未知值使用它)把普通助手进度段落之间的连续工具、搜索或思考片段组为普通活动组,`Bash`/run 别名