Skip to content

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

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.tsx
index 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.ts
index 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 text
diff --git a/apps/desktop/test/turn-process.test.mjs b/apps/desktop/test/turn-process.test.mjs
index 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.md
index 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 messages
and 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 retain
their 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 that
diff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.md
index 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 preference
persists as `thinkingDisplayMode` in host-owned settings; missing values use
Detailed. 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.md
index 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 trailing
aborted partial replies stay visible. Compaction and user/system boundaries are
unchanged.
-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 thinking
label applies only while the latest activity is streaming reasoning without answer
text; streamed answers use the processing label. Delegation
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index 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 elapsed
time 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 keep
their 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. Tools
and progress text remain accessible, and a completed thinking-only process
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 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 an
intermediate 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 text
stays readable. Errors and stopped trailing text stay visible. Compact mode
exposes no reasoning text or excerpt, shows a live indicator, and leaves no
diff --git a/scripts/e2e/turn-process.tsx b/scripts/e2e/turn-process.tsx
index 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") &&