Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(chat): keep detailed turn process open after completion
vastsa1b34777fcdca
diff --git a/apps/desktop/src/features/chat/transcript/TurnProcess.tsx b/apps/desktop/src/features/chat/transcript/TurnProcess.tsxindex 69d119582..360e5c0bb 100644--- a/apps/desktop/src/features/chat/transcript/TurnProcess.tsx+++ b/apps/desktop/src/features/chat/transcript/TurnProcess.tsx@@ -8,6 +8,7 @@ import {isTurnThinking,processContainsMessage,resolveThinkingDisplayMode,+ shouldAutoOpenTurnProcess,turnProcessTiming,visibleProcessSteps,} from "../../../lib/turn-process";@@ -42,7 +43,7 @@ export function TurnProcess({const hasToolFailure = hasFailedProcessTool(processParts);const thinkingNow = isTurnThinking(turnParts, isActive);const disclosure = useAutomaticDisclosure(- isActive && (hasToolFailure || mode === "detailed"),+ shouldAutoOpenTurnProcess(mode, isActive, hasToolFailure),revealRequest,);const detailsId = useId();diff --git a/apps/desktop/src/lib/turn-process.ts b/apps/desktop/src/lib/turn-process.tsindex 6c3411124..01dd2cc49 100644--- a/apps/desktop/src/lib/turn-process.ts+++ b/apps/desktop/src/lib/turn-process.ts@@ -54,6 +54,15 @@ export function hasFailedProcessTool(parts: readonly AssistantTurnPart[]): boole);}+/** Detailed keeps process visible; compact only auto-opens an active tool failure. */+export function shouldAutoOpenTurnProcess(+ mode: ThinkingDisplayMode,+ isActive: boolean,+ hasToolFailure: boolean,+): boolean {+ return mode === "detailed" || (isActive && hasToolFailure);+}+/*** Only a trailing assistant text can be the answer: text followed by tools is* progress. The stream carries no final-answer marker, so a live trailing textdiff --git a/apps/desktop/test/turn-process.test.mjs b/apps/desktop/test/turn-process.test.mjsindex 7c324a39d..4d4799787 100644--- a/apps/desktop/test/turn-process.test.mjs+++ b/apps/desktop/test/turn-process.test.mjs@@ -7,6 +7,7 @@ const {projectTurnProcess,visibleProcessSteps,resolveThinkingDisplayMode,+ shouldAutoOpenTurnProcess,turnProcessTiming,} = await import("../src/lib/turn-process.ts");@@ -96,6 +97,16 @@ test("missing and unknown display settings retain detailed mode", () => {assert.equal(resolveThinkingDisplayMode("compact"), "compact");});+test("detailed auto-opens completed process; compact only opens active failures", () => {+ assert.equal(shouldAutoOpenTurnProcess("detailed", false, false), true);+ assert.equal(shouldAutoOpenTurnProcess("detailed", true, false), true);+ assert.equal(shouldAutoOpenTurnProcess("detailed", false, true), true);+ assert.equal(shouldAutoOpenTurnProcess("compact", false, false), false);+ assert.equal(shouldAutoOpenTurnProcess("compact", true, false), false);+ assert.equal(shouldAutoOpenTurnProcess("compact", true, true), true);+ assert.equal(shouldAutoOpenTurnProcess("compact", false, true), false);+});+test("history timing uses recorded ends and rejects invalid timestamps and durations", () => {const entry = turn([message("read", "tool", "", { toolCompletedAt: "2026-09-17T00:00:02.000Z" }),diff --git a/docs/adr/turn-process-and-thinking-display.md b/docs/adr/turn-process-and-thinking-display.mdindex 5c7abf51b..8e2817322 100644--- a/docs/adr/turn-process-and-thinking-display.md+++ b/docs/adr/turn-process-and-thinking-display.md@@ -22,11 +22,12 @@ belongs to the process. There is no semantic final-answer marker in UiMessage,so the renderer does not guess intent from the wording. User/system messagesand compaction dividers retain their existing turn boundaries.-Completed process areas start collapsed. Detailed mode opens the active-process automatically and retains the existing thinking-row disclosures.-Manual disclosure choices survive streaming and completion. Search navigation-opens the containing process. Tool failures open an unclaimed active process so the-invocation error stays visible; that does not mark the whole turn as failed.+Detailed mode keeps process areas open for both active and completed turns+and retains the existing thinking-row disclosures. Compact mode starts+completed process areas collapsed. Manual disclosure choices survive+streaming and completion. Search navigation opens the containing process.+Tool failures open an unclaimed active process so the invocation error stays+visible even in compact mode; that does not mark the whole turn as failed.Assistant errors and stopped trailing partial answers stay outside the process.Tool/delegation detail controls, permission cards, and transcript actions retaintheir existing behavior.@@ -50,7 +51,7 @@ tool and intermediate-text items and omit hidden compact-mode thinking.## Consequences- One completed turn has one process disclosure plus its visible answer.-- Reasoning remains available by switching back to detailed mode.+- Detailed mode keeps thinking, tools and intermediate text visible without an extra click; compact remains the collapsed presentation.- Unchanged activity groups keep their memoized boundary during text deltas;the process wrapper does not move execution or persistence into the renderer.- This groups loaded transcript entries; it does not reconstruct history thatdiff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.mdindex 37045e280..eb6a8df73 100644--- a/docs/spec/04-ux/06-settings-ia.md+++ b/docs/spec/04-ux/06-settings-ia.md@@ -172,8 +172,9 @@ Settings is a **full-window page** that replaces the app sidebar + main chrome (to Off, and has no follow-the-session entry. Settings search indexes the card,its switch, the template row, the default-model row, and the reasoning row.- **Thinking display mode** uses a menu select with Detailed (default) and- Compact. Detailed retains reasoning text; Compact shows only an active- thinking indicator and hides finished thought rows. The global preference+ Compact. Detailed keeps the turn process open and retains reasoning text;+ Compact collapses completed processes, shows only an active thinking+ indicator, and hides finished thought rows. The global preferencepersists as `thinkingDisplayMode` in host-owned settings; missing values useDetailed. It affects presentation only, not model reasoning configuration.Settings search indexes the row and both mode names.diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex 5ed35758a..37dbbf7d7 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -811,9 +811,11 @@ the process without altering the stored message. Assistant errors and trailingaborted partial replies stay visible. Compaction and user/system boundaries areunchanged.-Completed process areas start collapsed; detailed mode opens the active process.-Manual choices and search reveals own the disclosure until unmount. Failed tools-open an unclaimed active process and keep their invocation-level error presentation.+Detailed mode keeps process areas open, including completed history. Compact+mode starts completed process areas collapsed. Manual choices and search+reveals own the disclosure until unmount. Failed tools open an unclaimed+active process even in compact mode and keep their invocation-level error+presentation.The header shows elapsed time and the visible process step count. Its thinkinglabel applies only while the latest activity is streaming reasoning without answertext; streamed answers use the processing label. Delegationdiff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex 8c86d108c..43645fc31 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -804,11 +804,12 @@ may be retained while exactly one workspace supplies the visible shell context.and intermediate progress text. The trailing answer streams outside it;later activity moves that text into the process. The header updates elapsedtime once per second while active and shows the visible step count.-- Detailed mode opens the active process and retains the latest thinking row's- automatic disclosure. Completed process areas collapse unless a click,- keyboard activation or search reveal has taken ownership. Tool details keep+- Detailed mode keeps the process open, including after completion, and+ retains the latest thinking row's automatic disclosure. Compact completed+ process areas collapse unless a click, keyboard activation or search+ reveal has taken ownership. Tool details keeptheir individual controls. Failed tool calls open an unclaimed active process so- their errors stay visible.+ their errors stay visible even in compact mode.- Compact thinking mode shows only a status indicator while reasoning streams;when answer text starts or reasoning ends, the thought row disappears. Toolsand progress text remain accessible, and a completed thinking-only processdiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex b2791cd0a..dab9f7e89 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -13490,7 +13490,8 @@ plugin-form fixtures in an isolated temporary directory at runtime.- **Steps:** Stream the turn; finish it; expand/collapse its process; search anintermediate message; switch display modes through Settings → AI → Defaults.Repeat with a stopped partial answer, an assistant error and a failed tool.-- **Expected:** Completed work has one collapsed process plus its final answer.+- **Expected:** In detailed mode, completed work has one open process plus+ its final answer. Compact mode keeps that process collapsed until expanded.Manual choices survive updates; search reveals its target; live answer textstays readable. Errors and stopped trailing text stay visible. Compact modeexposes no reasoning text or excerpt, shows a live indicator, and leaves nodiff --git a/scripts/e2e/turn-process.tsx b/scripts/e2e/turn-process.tsxindex ecab2d9cb..74a2f490e 100644--- a/scripts/e2e/turn-process.tsx+++ b/scripts/e2e/turn-process.tsx@@ -115,8 +115,8 @@ export async function turnProcessProbe() {"one process per turn",);check(- header()?.getAttribute("aria-expanded") === "false" && !visible(process()),- "completed process starts collapsed",+ header()?.getAttribute("aria-expanded") === "true" && visible(process()),+ "detailed completed process starts open",);check(visible(container.querySelector('[data-message-id="answer"]')),@@ -126,19 +126,23 @@ export async function turnProcessProbe() {header()?.textContent?.includes("5 steps"),"process counts thought, tools and progress once",);- click(header());check(visible(container.querySelector('[data-message-id="progress"]')),- "expanding reveals intermediate progress",+ "detailed completed process shows intermediate progress",);check(process()?.querySelectorAll(".tool-row").length === 3,- "expanding retains thinking and both tools",+ "detailed process shows thinking and both tools",+ );+ click(header());+ check(+ header()?.getAttribute("aria-expanded") === "false" && !visible(process()),+ "detailed process can still collapse",);render(messages, true);render(messages);check(- header()?.getAttribute("aria-expanded") === "true",+ header()?.getAttribute("aria-expanded") === "false","manual disclosure survives active-to-complete transition",);@@ -149,8 +153,9 @@ export async function turnProcessProbe() {);render(messages, false, null, "live");check(- header()?.getAttribute("aria-expanded") === "false",- "unclaimed process collapses on completion",+ header()?.getAttribute("aria-expanded") === "true" &&+ visible(container.querySelector('[data-message-id="progress"]')),+ "detailed unclaimed process stays open on completion",);render(messages,@@ -309,6 +314,10 @@ export async function turnProcessProbe() {"compact thinking ends as soon as answer text starts",);render(messages, false, null, "compact-tools");+ check(+ header()?.getAttribute("aria-expanded") === "false" && !visible(process()),+ "compact completed process starts collapsed",+ );click(header());check(!container.querySelector(".thinking") &&