Skip to content

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

fix(transcript): collapse turn change summaries by default

vastsac19c33877203
diff --git a/apps/desktop/src/features/chat/transcript/TurnChangesCard.tsx b/apps/desktop/src/features/chat/transcript/TurnChangesCard.tsx
index f36dbe019..655410192 100644
--- a/apps/desktop/src/features/chat/transcript/TurnChangesCard.tsx
+++ b/apps/desktop/src/features/chat/transcript/TurnChangesCard.tsx
@@ -1,7 +1,8 @@
-import { memo, useMemo } from "react";
+import { memo, useId, useMemo } from "react";
import { useTranslation } from "react-i18next";
import type { ReviewChangeStatus, UiMessage } from "@pi-desktop/shared";
-import { cx } from "../../../components/ui";
+import { IconChevronDown, IconChevronRight } from "../../../components/icons";
+import { Button, cx } from "../../../components/ui";
import { requestReviewFocus } from "../../../lib/review-focus-request";
import {
summarizeTurnChanges,
@@ -12,6 +13,7 @@ import {
import { toolWorkPanelTab } from "../../../lib/work-panel-tabs";
import { useSlotSessionId } from "../../../plugins/renderer-slots/use-slots";
import { useAppStore } from "../../../stores/app-store";
+import { disclosureKey, useAutomaticDisclosure } from "./disclosure";
import "../../../styles/turn-changes.css";
/* Same Git-style letters as the per-call review row, so status never relies
@@ -46,6 +48,12 @@ export const TurnChangesCard = memo(function TurnChangesCard({
const openTabForSession = useAppStore((state) => state.openWorkPanelTabForSession);
const openTab = useAppStore((state) => state.openWorkPanelTab);
const summary = useMemo(() => summarizeTurnChanges(tools), [tools]);
+ const bodyId = useId();
+ const disclosure = useAutomaticDisclosure(
+ false,
+ undefined,
+ disclosureKey("turn-changes", sessionId, tools[0]?.id ?? bodyId),
+ );
const { files } = summary;
if (files.length === 0) return null;
@@ -72,7 +80,18 @@ export const TurnChangesCard = memo(function TurnChangesCard({
return (
<section className="turn-changes-card" aria-label={t("chat.turnChangesLabel")}>
- <div className="turn-changes-head">
+ <Button
+ ref={disclosure.titleRef}
+ type="button"
+ variant="ghost"
+ className="turn-changes-head"
+ aria-expanded={disclosure.open}
+ aria-controls={bodyId}
+ onClick={disclosure.toggle}
+ >
+ <span className="turn-changes-chevron" aria-hidden>
+ {disclosure.open ? <IconChevronDown size={12} /> : <IconChevronRight size={12} />}
+ </span>
<span className="turn-changes-title">{t("chat.turnChangesTitle")}</span>
<span className="turn-changes-meta">
{t("chat.toolChipFiles", { count: files.length })}
@@ -84,48 +103,50 @@ export const TurnChangesCard = memo(function TurnChangesCard({
>
<Counts additions={summary.additions} deletions={summary.deletions} />
</span>
- </div>
- <ul className={cx("turn-changes-body", dense && "is-dense")}>
- {visible.map((file) => {
- const label = rowLabel(file);
- return (
- <li key={file.path}>
- <button
- type="button"
- className="turn-changes-row"
- data-status={file.status}
- data-rolled-back={file.rolledBack || undefined}
- aria-label={label}
- title={label}
- onClick={() => openReview(file.snapshotIds, true)}
- >
- <span className="turn-changes-mark" aria-hidden>
- {STATUS_MARKS[file.status]}
- </span>
- <span className="turn-changes-path">{file.path}</span>
- <Counts additions={file.additions} deletions={file.deletions} />
- </button>
+ </Button>
+ <div ref={disclosure.bodyRef} id={bodyId} hidden={!disclosure.open} {...disclosure.bodyEvents}>
+ <ul className={cx("turn-changes-body", dense && "is-dense")}>
+ {visible.map((file) => {
+ const label = rowLabel(file);
+ return (
+ <li key={file.path}>
+ <button
+ type="button"
+ className="turn-changes-row"
+ data-status={file.status}
+ data-rolled-back={file.rolledBack || undefined}
+ aria-label={label}
+ title={label}
+ onClick={() => openReview(file.snapshotIds, true)}
+ >
+ <span className="turn-changes-mark" aria-hidden>
+ {STATUS_MARKS[file.status]}
+ </span>
+ <span className="turn-changes-path">{file.path}</span>
+ <Counts additions={file.additions} deletions={file.deletions} />
+ </button>
+ </li>
+ );
+ })}
+ {hidden > 0 ? (
+ <li className="turn-changes-more">
+ <span aria-hidden>···</span>
+ {t("chat.turnChangesMore", { count: hidden })}
</li>
- );
- })}
+ ) : null}
+ </ul>
{hidden > 0 ? (
- <li className="turn-changes-more">
- <span aria-hidden>···</span>
- {t("chat.turnChangesMore", { count: hidden })}
- </li>
+ <div className="turn-changes-foot">
+ <button
+ type="button"
+ className="turn-changes-view-all"
+ onClick={() => openReview(files.flatMap((file) => file.snapshotIds), false)}
+ >
+ {t("chat.turnChangesViewAll", { count: files.length })}
+ </button>
+ </div>
) : null}
- </ul>
- {hidden > 0 ? (
- <div className="turn-changes-foot">
- <button
- type="button"
- className="turn-changes-view-all"
- onClick={() => openReview(files.flatMap((file) => file.snapshotIds), false)}
- >
- {t("chat.turnChangesViewAll", { count: files.length })}
- </button>
- </div>
- ) : null}
+ </div>
</section>
);
});
diff --git a/apps/desktop/src/styles/turn-changes.css b/apps/desktop/src/styles/turn-changes.css
index eb835240f..3adc46670 100644
--- a/apps/desktop/src/styles/turn-changes.css
+++ b/apps/desktop/src/styles/turn-changes.css
@@ -13,16 +13,28 @@
.turn-changes-head {
display: flex;
+ width: 100%;
min-width: 0;
+ min-height: 28px;
align-items: center;
+ justify-content: flex-start;
gap: 8px;
- padding: 0 6px 4px;
+ padding: 2px 6px 4px;
+ border-radius: var(--radius-sm);
+ text-align: left;
+}
+
+.turn-changes-chevron {
+ display: inline-flex;
+ flex: 0 0 auto;
+ color: var(--ds-text-muted);
}
.turn-changes-title {
color: var(--ds-text-primary);
font-size: var(--text-sm);
font-weight: var(--font-weight-semibold);
+ white-space: nowrap;
}
.turn-changes-meta {
@@ -37,6 +49,7 @@
.turn-changes-total {
display: inline-flex;
+ flex: 0 0 auto;
margin-left: auto;
}
@@ -67,6 +80,7 @@
color: var(--ds-text-primary);
}
+.turn-changes-head:focus-visible,
.turn-changes-row:focus-visible {
outline: 1.5px solid color-mix(in oklab, var(--ds-focus) 78%, transparent);
outline-offset: -2px;
diff --git a/apps/desktop/test/turn-changes-card.test.mjs b/apps/desktop/test/turn-changes-card.test.mjs
index 186367f5f..e59f7168a 100644
--- a/apps/desktop/test/turn-changes-card.test.mjs
+++ b/apps/desktop/test/turn-changes-card.test.mjs
@@ -151,6 +151,9 @@ test("a finished turn with a few files gets relaxed rows below the reply, above
assert.match(html, /<section class="turn-changes-card" aria-label="Files changed this turn">/);
assert.match(html, /Changes this turn/);
assert.match(html, /2 files/);
+ const disclosure = html.match(/<button[^>]*class="[^"]*turn-changes-head"[^>]*aria-expanded="false"[^>]*aria-controls="([^"]+)"/);
+ assert.ok(disclosure, "the summary header starts collapsed and controls its details");
+ assert.ok(html.includes(`id="${disclosure[1]}" hidden=""`), "file details are hidden initially");
assert.match(html, /class="turn-changes-body"/, "two files use the relaxed rows");
assert.equal(rows(html).length, 2);
assert.match(html, /data-status="added"[^>]*aria-label="Open Added changes for src[^"]*a\.ts in Review \(19 additions, 0 deletions\)"/);
diff --git a/apps/desktop/test/turn-changes-disclosure-user-path.test.mjs b/apps/desktop/test/turn-changes-disclosure-user-path.test.mjs
new file mode 100644
index 000000000..32a332fda
--- /dev/null
+++ b/apps/desktop/test/turn-changes-disclosure-user-path.test.mjs
@@ -0,0 +1,163 @@
+import assert from "node:assert/strict";
+import { spawn } from "node:child_process";
+import { createRequire } from "node:module";
+import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import test from "node:test";
+import { repositoryRoot, resolveElectronBinary } from "../../../scripts/e2e/boot.mjs";
+
+const root = repositoryRoot();
+const { build } = createRequire(join(root, "packages/agent-runtime/package.json"))("esbuild");
+const fixture = String.raw`
+import React from "react";
+import { createRoot } from "react-dom/client";
+import { flushSync } from "react-dom";
+import i18n from "i18next";
+import { initReactI18next } from "react-i18next";
+import { catalogs } from "@pi-desktop/i18n";
+import { IPC } from "@pi-desktop/shared";
+import { TurnChangesCard } from "../../apps/desktop/src/features/chat/transcript/TurnChangesCard";
+import { TranscriptDisclosureProvider } from "../../apps/desktop/src/features/chat/transcript/disclosure";
+import { SlotSessionProvider } from "../../apps/desktop/src/plugins/renderer-slots/use-slots";
+import { useAppStore } from "../../apps/desktop/src/stores/app-store";
+import { currentReviewFocusRequest } from "../../apps/desktop/src/lib/review-focus-request";
+
+await i18n.use(initReactI18next).init({ lng: "en", resources: { en: { translation: catalogs.en } } });
+window.piDesktop = { platform: "darwin", channels: IPC,
+ invoke: async () => ({ ok: true, data: undefined }), on: () => () => {} };
+useAppStore.setState({ activeSessionId: "session-a", workPanelTabs: [], activeWorkPanelTabId: null });
+const view = createRoot(document.getElementById("root"));
+const tools = Array.from({ length: 15 }, (_, index) => ({
+ id: "edit-" + index, role: "tool", content: "", status: "complete", createdAt: "2026-10-28T00:00:00Z",
+ toolName: "Edit", toolStatus: "success", toolResult: { details: { root: "workspace", review: {
+ version: 1, snapshotId: "snap-" + index, messageId: "edit-" + index,
+ path: "src/dir" + (index % 3) + "/file" + index + ".ts", operation: "edit", status: "modified",
+ state: index === 1 ? "rolledBack" : "active", additions: 2, deletions: 1, hunks: [], reversible: true,
+ } } },
+}));
+const otherTools = [{ ...tools[0], id: "other-turn-tool" }];
+const render = () => flushSync(() => view.render(
+ <SlotSessionProvider sessionId="session-a">
+ <TranscriptDisclosureProvider sessionId="session-a">
+ <TurnChangesCard tools={tools} /><TurnChangesCard tools={otherTools} />
+ </TranscriptDisclosureProvider>
+ </SlotSessionProvider>));
+const frame = () => new Promise(requestAnimationFrame);
+const settle = async () => { await frame(); await frame(); };
+function check(condition, message) { if (!condition) throw new Error(message); }
+function heading(index = 0) { return document.querySelectorAll(".turn-changes-head")[index]; }
+function content(index = 0) { return document.getElementById(heading(index).getAttribute("aria-controls")); }
+function expanded(expected) {
+ check(heading().getAttribute("aria-expanded") === String(expected), "Disclosure state is incorrect");
+ check(content().hidden === !expected, "Disclosure accessibility state and body visibility disagree");
+ check(content().querySelector(".turn-changes-row").getClientRects().length === (expected ? 1 : 0),
+ "Collapsed file rows still occupy space");
+}
+window.turnChangesProbe = async (stage) => {
+ if (stage === "pointer") {
+ render(); await settle();
+ expanded(false);
+ const hiddenRow = content().querySelector(".turn-changes-row");
+ hiddenRow.focus();
+ check(document.activeElement !== hiddenRow, "Collapsed file row can receive keyboard focus");
+ check(heading(1).getAttribute("aria-expanded") === "false", "Another turn starts expanded");
+ check(content().querySelector(".turn-changes-view-all").getClientRects().length === 0,
+ "View all action escaped the collapsed body");
+ const totals = heading().textContent;
+ check(totals.includes("15 files") && totals.includes("3 dirs") && totals.includes("+30") && totals.includes("−15"),
+ "Collapsed heading lost summary counts");
+ flushSync(() => heading().click()); await settle();
+ expanded(true);
+ check(useAppStore.getState().activeWorkPanelTabId === null, "Expanding opened Review");
+ check(heading(1).getAttribute("aria-expanded") === "false", "Expanding one turn expands another");
+ check(content().querySelectorAll(".turn-changes-row").length === 12, "Expanded file list lost its row limit");
+ check(content().querySelector('[data-rolled-back="true"]'), "Rolled-back file state was lost");
+ render(); await settle(); expanded(true);
+ flushSync(() => content().querySelector(".turn-changes-row").click());
+ check(currentReviewFocusRequest().snapshotIds.join() === "snap-0" && currentReviewFocusRequest().expand,
+ "Expanded file row did not request its Review changes");
+ const state = useAppStore.getState();
+ check(state.workPanelTabs.find(tab => tab.id === state.activeWorkPanelTabId)?.kind === "review",
+ "File row did not open the originating session's Review tab");
+ flushSync(() => content().querySelector(".turn-changes-view-all").click());
+ check(currentReviewFocusRequest().snapshotIds.length === 15 && !currentReviewFocusRequest().expand,
+ "View all no longer opens every recorded change");
+ flushSync(() => heading().click()); await settle(); expanded(false);
+ check(heading().textContent === totals, "Toggling changed the summary counts");
+ heading().focus();
+ } else {
+ await settle();
+ expanded(stage === "keyboard-open");
+ check(document.activeElement === heading(), "Keyboard activation lost disclosure focus");
+ if (stage === "keyboard-close") flushSync(() => view.unmount());
+ }
+ return { passed: true, stage };
+};
+`;
+
+test("turn changes start collapsed, toggle independently, and keep Review actions", {
+ skip: process.platform === "linux" && !process.env.DISPLAY ? "Electron requires a display" : false,
+}, async () => {
+ const temp = await mkdtemp(join(process.env.PI_SCRATCH_DIR || tmpdir(), "pi-turn-changes-ui-"));
+ try {
+ const styles = await Promise.all(["tokens", "base", "ui-kit", "turn-changes"].map((name) =>
+ readFile(join(root, `apps/desktop/src/styles/${name}.css`), "utf8")));
+ await writeFile(join(temp, "style.css"), styles.join("\n"));
+ await build({
+ stdin: { contents: fixture, resolveDir: join(root, "scripts/e2e"), loader: "tsx" },
+ outfile: join(temp, "renderer.js"), bundle: true, platform: "browser", format: "esm", jsx: "automatic",
+ define: { "process.env.NODE_ENV": '"production"', "import.meta.env": '{"DEV":false,"MODE":"production"}' },
+ loader: { ".css": "empty" },
+ alias: {
+ "@pi-desktop/i18n": join(root, "packages/i18n/src"),
+ "@pi-desktop/shared": join(root, "packages/shared/src"),
+ react: join(root, "apps/desktop/node_modules/react"),
+ "react-dom": join(root, "apps/desktop/node_modules/react-dom"),
+ },
+ nodePaths: [join(root, "apps/desktop/node_modules")],
+ });
+ await writeFile(join(temp, "index.html"), '<!doctype html><meta charset="utf-8"><title>Turn changes disclosure regression</title><link rel="stylesheet" href="style.css"><div id="root"></div><script type="module" src="renderer.js"></script>');
+ await writeFile(join(temp, "main.cjs"), `
+const { app, BrowserWindow } = require("electron");
+const path = require("node:path");
+app.setPath("userData", path.join(__dirname, "profile"));
+app.whenReady().then(async () => {
+ const win = new BrowserWindow({ show: false, width: 1000, height: 800,
+ webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false, backgroundThrottling: false } });
+ win.webContents.on("console-message", (event) => console.error(event.message));
+ try {
+ await win.loadFile(path.join(__dirname, "index.html"));
+ console.log("TURN_CHANGES " + JSON.stringify(await win.webContents.executeJavaScript('window.turnChangesProbe("pointer")')));
+ win.webContents.focus();
+ for (const [keyCode, stage] of [["Enter", "keyboard-open"], ["Space", "keyboard-close"]]) {
+ win.webContents.sendInputEvent({ type: "keyDown", keyCode });
+ win.webContents.sendInputEvent({ type: "char", keyCode: keyCode === "Enter" ? "\\r" : " " });
+ win.webContents.sendInputEvent({ type: "keyUp", keyCode });
+ console.log("TURN_CHANGES " + JSON.stringify(await win.webContents.executeJavaScript("window.turnChangesProbe(" + JSON.stringify(stage) + ")")));
+ }
+ app.exit(0);
+ } catch (error) { console.error(error); app.exit(1); }
+});
+`);
+ const env = { ...process.env };
+ delete env.ELECTRON_RUN_AS_NODE;
+ const child = spawn(resolveElectronBinary(root).electronBinary, [join(temp, "main.cjs")], {
+ env, stdio: ["ignore", "pipe", "pipe"],
+ });
+ let output = "";
+ for (const stream of [child.stdout, child.stderr]) stream.on("data", chunk => { output += chunk; });
+ const timeout = setTimeout(() => child.kill("SIGKILL"), 45_000);
+ let code;
+ try {
+ code = await new Promise((resolve, reject) => {
+ child.once("error", reject);
+ child.once("close", resolve);
+ });
+ } finally { clearTimeout(timeout); }
+ assert.equal(code, 0, output.slice(-6000));
+ const results = output.split(/\r?\n/).filter(line => line.startsWith("TURN_CHANGES "))
+ .map(line => JSON.parse(line.slice("TURN_CHANGES ".length)));
+ assert.deepEqual(results, ["pointer", "keyboard-open", "keyboard-close"].map(stage => ({ passed: true, stage })));
+ } finally { await rm(temp, { recursive: true, force: true }); }
+});
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index e7b1c909b..9b004f2c5 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1010,7 +1010,7 @@ pending action cards remain reachable outside a hidden process. See
| Turn start (send / retry / regenerate) | Re-pins and positions the latest content before paint, even if the user had scrolled up; the later persisted user-message event does not flash the transcript at its top, and the composer collapse / indicator layout clamps during the send never release follow mode |
| Idle (after stream) | Auto-scroll unlocked; user can scroll freely. A completed turn the user was following ends with its prompt at the top of the viewport and jump-to-latest shown, unless the prompt was already in view (D676) |
| Message-scoped review snapshot | Each successful workspace Write/Edit renders as one tool-level review row (`ReviewChangeCard`) carrying that message's added/modified/deleted status and explicit addition/deletion totals. The row itself is the file header — Git-style status letter (`A`/`M`/`D`), path, addition/deletion counts, disclosure caret — with no separate generic tool row above it, so the file header appears exactly once. It keeps the tool-row rhythm with no card border, status rail, icon plate, or status pill; hover fill is the only row chrome, and a rolled-back change is struck through. Its hunks sit in the diff body directly beneath that header behind the row's expandable disclosure: every review row (inline and in the Review tab) is collapsed by default, and the user expands it on demand. The diff body's action row keeps hash-guarded rollback and adds Copy for the hunks. The card remains after a Git commit, never becomes a bottom/global entry, and does not leak into another session's transcript. |
-| Per-turn changed files | A completed reply (same mount condition as the reply plugin slots, so never while streaming and never after a failed turn) whose turn recorded at least one workspace review change shows one read-only `TurnChangesCard` below its answer and above `entryExtra` blocks (D674). It is built only from that turn's message-owned review records: one row per path in first-touched order, counts summed across edits, status `D` when the turn ends by deleting the file, else `A` if any edit created it, else `M`; a file whose every edit was rolled back stays listed, struck through, with the state in its accessible name. The header shows `Changes this turn`, the file count, and the summed `+`/`−`. Up to four files use relaxed 25px rows; more switch to dense 21px rows and add the directory count; rows past 12 fold into `+N more` plus a link that opens Review. The card is one `--ds-tile` surface with no border or rules. Clicking a row opens the originating session's Review tab, scrolls to that file's first recorded change, and expands its changes there — the card has no diff body or rollback of its own. A turn without workspace writes renders nothing. |
+| Per-turn changed files | A completed reply (same mount condition as the reply plugin slots, so never while streaming and never after a failed turn) whose turn recorded at least one workspace review change shows one read-only `TurnChangesCard` below its answer and above `entryExtra` blocks (D674). It is built only from that turn's message-owned review records: one row per path in first-touched order, counts summed across edits, status `D` when the turn ends by deleting the file, else `A` if any edit created it, else `M`; a file whose every edit was rolled back stays listed, struck through, with the state in its accessible name. The card starts collapsed: its full-width header remains visible with a disclosure chevron, `Changes this turn`, the file count, and the summed `+`/`−`. Clicking the header or activating it with Enter/Space toggles the file list and its Review link without opening Review; `aria-expanded` and `aria-controls` expose the state, and hidden details are not keyboard-focusable. Each turn retains its own explicit choice through the existing session-scoped transcript disclosure mechanism and uses the shared scroll anchor. When expanded, up to four files use relaxed 25px rows; more switch to dense 21px rows and add the directory count; rows past 12 fold into `+N more` plus a link that opens Review. The card is one `--ds-tile` surface with no border or rules. Clicking a row opens the originating session's Review tab, scrolls to that file's first recorded change, and expands its changes there — the card has no diff body or rollback of its own. A turn without workspace writes renders nothing. |
### 4.5 Accessibility
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 247fbb134..898452eb4 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -5147,14 +5147,23 @@ window; opening a normal panel afterward must still work.
- **Preconditions**: A project-bound Agent session with a writable workspace.
- **Steps**: 1) Ask the agent to create one file and edit another; watch the
turn while it streams. 2) After the reply finishes, inspect the area below
- the answer. 3) Ask for a change touching more than twelve files across
- several directories. 4) Click a row, then the `View all N files in Review`
- link. 5) Roll back one file's change in Review and return to the turn.
+ the answer: only the summary header is visible. Click it to expand, click
+ again to collapse, then focus it and repeat with Enter and Space. Confirm
+ hidden rows and the Review link cannot receive keyboard focus and the title
+ keeps its viewport anchor. 3) Ask for a change touching more than twelve files
+ across several directories; confirm its card starts collapsed independently.
+ Expand it. 4) Click a row, then the `View all N files in Review` link.
+ 5) Roll back one file's change in Review and return to the turn.
6) Ask a question that writes no files. 7) Switch sessions and come back.
- **Expected**: No summary appears while a turn streams or after a failed
turn. A finished turn that wrote workspace files shows one borderless
`Changes this turn` card below its answer and above plugin `entryExtra`
- blocks, with the file count and summed `+`/`−`. Each path appears once with
+ blocks. It starts collapsed with only its chevron, title, file count, and
+ summed `+`/`−` visible; directory counts remain visible for dense summaries.
+ The full-width header toggles with click, Enter, or Space, exposes its state
+ through ARIA, and leaves Review closed. Collapsed details occupy no space
+ and cannot receive focus. Each turn's explicit choice is independent and
+ survives ordinary rerenders. When expanded, each path appears once with
its merged status letter and counts; up to four files use relaxed rows,
more use dense rows with a directory count, and rows past 12 fold into
`+N more`. A row click opens the session's Review tab scrolled to that file
@@ -5165,7 +5174,9 @@ window; opening a normal panel afterward must still work.
- **Specs linked**: `04-ux/08-component-spec.md` §4.4, D674
- **Acceptance**: D (workspace), Quality
- **Milestone**: M5
-- **Status**: Unit-covered (`turn-changes-card.test.mjs`); full UI scenario Draft
+- **Status**: Unit/SSR-covered (`turn-changes-card.test.mjs`); isolated Chromium
+ pointer, Enter/Space, independent disclosure, hidden-focus, and Review paths
+ covered by `turn-changes-disclosure-user-path.test.mjs`; full UI scenario Draft
#### E2E-CHAT-completed-turn-scrolls-to-prompt: A finished reply reads from its prompt
@@ -10862,6 +10873,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
| Quality (sidebar menu placement) | E2E-021c |
| Quality (project ordering) | E2E-253 |
| Quality (work-panel tab close visibility) | E2E-WORK-PANEL-active-tab-close-visibility |
+| Quality (turn changed-files disclosure) | E2E-CHAT-turn-changed-files-summary |
| C / E / G / Quality — Pi kernel upgrade | E2E-PI-130-kernel-upgrade |
| C / E / G / Quality — Pi kernel upgrade | E2E-PI-140-kernel-upgrade |
| C — Conversation & stream (IME slash alias) | E2E-255 |
diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.md
index 217e79c6d..a67792c37 100644
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@ -335,7 +335,7 @@ Gold source: local Codex electron captures; latest row wins where rows conflict.
| D668 | One process disclosure per turn, with three transcript display modes | **Amend D661 / the `turn-process-and-thinking-display` ADR. A turn renders exactly one top-level process disclosure holding every pre-answer row; the answer stays outside it. `AppSettings.transcriptDisplayMode` selects the layout: `flat` renders no nested activity groups, `command-first` renders `Bash`/run rows as standalone rows beside activity groups, and `fully-folded` (the default for absent or invalid values) keeps commands inside their groups and lets only ordinary assistant progress text split them. The mode is read while rendering, so switching repaints immediately - the projection cache is keyed by messages and compactions only. The disclosure header reports failed / stopped / running / finished with precedence in that order and never echoes the current item, and the disclosure shares one left edge with the levels it reveals. `transcriptDisplayMode` joins the portable application fields; `keepCommandsExpanded` is deprecated, retained only for persisted-settings compatibility, and no longer exposed or read for rendering. No host protocol, persistence schema, permission, or plugin contract change. See the amended ADR, `04-ux/06-settings-ia.md`, `04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`, and E2E-CHAT-turn-process-and-thinking-display.** | Chronological segmentation split one turn into several sibling disclosures above the answer, and the boolean command-folding preference could only express two layouts; a three-mode setting covers flat, command-first, and the released grouped view without changing what a tool received or stored. |
| D669 | `@` queries search past a truncated file index | **Amend D124: while the 8000-entry `fs/index` snapshot is truncated, a non-empty `@` query is also searched over the root's full listing through the read-only Electron channel `pi-desktop/fs/search` once typing pauses, and its best 50 rows merge with the local matches. A complete index never searches. Remote sessions keep their snapshot. No host RPC, storage, or schema change.** | The shallowest-8000-entry index left a script several folders down matching no query at all, even though the truncation note invited the reader to refine it (issue #1781). |
| D671 | Inline generative UI visualizations | **Amend D114: local sessions get a second host-owned contained root `<data_dir>/visualizations/<sessionId>/` for `.html` fragments only (Read/Write/Edit, auto-allowed like scratch, never in remote or contract sessions). A standalone `::visualize{"path","title"}` reply line renders the fragment inline through a sandboxed `pi-genui://session/<sid>/<file>` iframe (`sandbox="allow-scripts"`, strict CSP, no network). Builtin skill `pi-desktop/visualize`. No schema change.** | Interactive explanations need an embedded page; ADR gen-ui-inline-visualization. |
-| D674 | Per-turn changed-files summary under a finished reply | **A completed reply whose turn recorded workspace review changes renders one read-only `TurnChangesCard` below its answer and above `entryExtra`, built only from that turn's message-owned `details.review` records (no new capture, IPC, or persistence). Rows merge edits per path (`D` if the turn ends by deleting, else `A` if any edit created the file, else `M`; counts summed; rolled-back files stay listed and struck through). Up to four files use relaxed rows, more use dense rows, and rows past 12 fold into `+N more`. Clicking a row opens Review on that file's recorded changes; the per-call review rows and the Review tab are unchanged.** | Issue #1891, design 10 (adaptive density): the per-call review rows answer "what did this call change", and Review answers it for the whole session, but nothing answered "what did this turn change" without counting rows. |
+| D674 | Per-turn changed-files summary under a finished reply | **A completed reply whose turn recorded workspace review changes renders one read-only `TurnChangesCard` below its answer and above `entryExtra`, built only from that turn's message-owned `details.review` records (no new capture, IPC, or persistence). The card starts collapsed, keeping its counts visible in a full-width disclosure button; click or Enter/Space reveals or hides its file list and Review link. Choices remain turn-scoped in the existing transcript disclosure state. Rows merge edits per path (`D` if the turn ends by deleting, else `A` if any edit created the file, else `M`; counts summed; rolled-back files stay listed and struck through). When expanded, up to four files use relaxed rows, more use dense rows, and rows past 12 fold into `+N more`. Clicking a row opens Review on that file's recorded changes; the per-call review rows and the Review tab are unchanged.** | Issue #1891, design 10 (adaptive density): the per-call review rows answer "what did this call change", and Review answers it for the whole session, but nothing answered "what did this turn change" without counting rows. |
| D675 | Inline images are admitted by pixel size as well as bytes | **Amend D361: an image whose PNG/JPEG/GIF/WebP header reports a longest edge above `MAX_INLINE_IMAGE_EDGE_PX` (8000) is never inlined. Host Read refuses it with `TOOL_FAILED`; prompt attachments and restored history take the existing `@path` fallback; and the runtime's last provider view replaces any such image block (user or tool result) with a text notice naming its size. The probe reads headers only (no decoder); unknown dimensions keep the byte-only rule. No protocol, schema, or persisted-format change.** | Issue #1913: a 1.89 MB, 780 x 14182 full-page screenshot passed every byte check, the provider rejected it with a non-retriable 400, and replay made every later request in that session fail. Dropping is deterministic for the same bytes, so the request prefix and prompt caching stay stable; resampling would need an image decoder and is deferred. |
| D676 | A completed turn the reader followed ends at its prompt | **Amend the stream-completion rule: when a turn completes while the transcript is visible and still following the stream, the renderer scrolls that turn's newest user message to 16px below the titlebar band the transcript reserves at its top (smooth unless reduced motion), releases follow mode, and shows jump-to-latest. Nothing moves when the prompt is already in view, the reply failed or was aborted, the pane is hidden or in a reading window, a disclosure position is held, or a new run starts before the move. Renderer only; no setting, IPC, or persistence change.** | Issue #1889: after a long reply the reader sat at its last line and had to scroll back up to find where it began. |
| D677 | DeepSeek reasoning replay uses one field per row and never covers real reasoning | **Amend ADR 0256 decision 3: the pi-ai fill pass takes the reasoning field from the newest assistant row that has real reasoning, normalizes every assistant row to that single field (moving real reasoning from another field name, deleting the others), and fills the placeholder only on rows with no reasoning. History rebuild and the thinking panel drop a leading echo of the placeholder (`withoutReasoningReplayPlaceholder`); stored text is not rewritten. No schema, IPC, or setting change.** | Issue #1945: rebuilt rows are stamped `reasoning_content` while a relay streams `reasoning_text`; the fill pass picked `reasoning_content` and wrote the placeholder over the live row's real reasoning, the model echoed it as its own thinking (13.6% of assistant rows in affected sessions), and the echo was persisted and replayed. |