Skip to content

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

fix(chat): preserve message anchors and explicit latest navigation

new-Beginner5dfeb8e50fd4
diff --git a/apps/desktop/src/features/chat/transcript/hooks/useTranscriptScroll.ts b/apps/desktop/src/features/chat/transcript/hooks/useTranscriptScroll.ts
index d18fd2c4d..e0e4392de 100644
--- a/apps/desktop/src/features/chat/transcript/hooks/useTranscriptScroll.ts
+++ b/apps/desktop/src/features/chat/transcript/hooks/useTranscriptScroll.ts
@@ -728,6 +728,9 @@ export function useTranscriptScroll({
}, [reachTop, releaseDisclosureAnchor, releaseFollow, retryHistoryPaging]);
const jumpToLatest = useCallback(() => {
+ // Explicit navigation supersedes the gesture that entered history. Its
+ // queued scroll events must not start another page during the smooth jump.
+ lastScrollGestureAtRef.current = -Infinity;
cancelReadingPosition();
cancelHistoryPaging();
releaseDisclosureAnchor();
diff --git a/apps/desktop/src/lib/transcript-reading-position.ts b/apps/desktop/src/lib/transcript-reading-position.ts
index 4f6433265..d26dc8e15 100644
--- a/apps/desktop/src/lib/transcript-reading-position.ts
+++ b/apps/desktop/src/lib/transcript-reading-position.ts
@@ -58,14 +58,17 @@ export function captureTranscriptReadingPosition(
if (!transcriptHasLayout(scroller)) return;
if (pinned) return { pinned, offset: 0, scrollTop: scroller.scrollTop, windowSize };
const viewport = scroller.getBoundingClientRect();
- // Prefer the outer message/turn: its offset also describes reading inside an
- // expanded tool body, whose explicit disclosure choices survive eviction.
- for (const row of content.querySelectorAll<HTMLElement>("[data-minimap-id], [data-message-id]")) {
- const rect = row.getBoundingClientRect();
- if (rect.bottom <= viewport.top || rect.top >= viewport.bottom || rect.height === 0) continue;
- const messageId = row.dataset.minimapId ?? row.dataset.messageId;
- if (messageId) return { pinned, messageId, offset: rect.top - viewport.top,
- scrollTop: scroller.scrollTop, windowSize };
+ // Answer groups can acquire an earlier first message when a page is prepended.
+ // Anchor the visible message itself, whose identity and local offset survive
+ // regrouping; use a turn only for visible content without a message node.
+ for (const selector of ["[data-message-id]", "[data-minimap-id]"]) {
+ for (const row of content.querySelectorAll<HTMLElement>(selector)) {
+ const rect = row.getBoundingClientRect();
+ if (rect.bottom <= viewport.top || rect.top >= viewport.bottom || rect.height === 0) continue;
+ const messageId = row.dataset.messageId ?? row.dataset.minimapId;
+ if (messageId) return { pinned, messageId, offset: rect.top - viewport.top,
+ scrollTop: scroller.scrollTop, windowSize };
+ }
}
}
@@ -78,7 +81,8 @@ export function restoreTranscriptReadingPosition(
if (!transcriptHasLayout(scroller)) return false;
if (position.messageId) {
const id = CSS.escape(position.messageId);
- const row = content.querySelector<HTMLElement>(`[data-minimap-id="${id}"], [data-message-id="${id}"]`);
+ const row = content.querySelector<HTMLElement>(`[data-message-id="${id}"]`)
+ ?? content.querySelector<HTMLElement>(`[data-minimap-id="${id}"]`);
if (row) {
const rect = row.getBoundingClientRect();
if (rect.height > 0) {
diff --git a/apps/desktop/test/transcript-disclosure-reading.test.mjs b/apps/desktop/test/transcript-disclosure-reading.test.mjs
index c57705f1e..ee84451be 100644
--- a/apps/desktop/test/transcript-disclosure-reading.test.mjs
+++ b/apps/desktop/test/transcript-disclosure-reading.test.mjs
@@ -130,7 +130,7 @@ test("real input, a new turn and every navigation drop the held position", () =>
);
assert.match(
transcript,
- /const jumpToLatest = useCallback\(\(\) => \{\s*cancelReadingPosition\(\);\s*cancelHistoryPaging\(\);\s*releaseDisclosureAnchor\(\);\s*pinnedRef\.current = true;/,
+ /const jumpToLatest = useCallback\(\(\) => \{\s*(?:\/\/[^\n]*\n\s*)*lastScrollGestureAtRef\.current = -Infinity;\s*cancelReadingPosition\(\);\s*cancelHistoryPaging\(\);\s*releaseDisclosureAnchor\(\);\s*pinnedRef\.current = true;/,
);
assert.match(
transcript,
diff --git a/apps/desktop/test/transcript-reading-position-fallback.test.mjs b/apps/desktop/test/transcript-reading-position-fallback.test.mjs
index d20cde836..7ea245fd3 100644
--- a/apps/desktop/test/transcript-reading-position-fallback.test.mjs
+++ b/apps/desktop/test/transcript-reading-position-fallback.test.mjs
@@ -7,7 +7,7 @@ register(new URL("./helpers/ts-import-hooks.mjs", import.meta.url));
// `restoreTranscriptReadingPosition` escapes the id with the browser-only
// `CSS.escape`; this suite runs the function directly in Node.
globalThis.CSS ??= { escape: (value) => String(value).replace(/["\\]/g, "\\$&") };
-const { restoreTranscriptReadingPosition } = await import(
+const { captureTranscriptReadingPosition, restoreTranscriptReadingPosition } = await import(
"../src/lib/transcript-reading-position.ts"
);
@@ -112,3 +112,42 @@ test("a pane with no layout is still refused outright", () => {
false,
);
});
+
+test("capture anchors the visible message, not its regroupable answer wrapper", () => {
+ const scroller = fakeScroller({ scrollTop: 80 });
+ const row = (dataset, top, height) => ({
+ dataset,
+ getBoundingClientRect: () => ({ top, bottom: top + height, height }),
+ });
+ const wrapper = row({ minimapId: "old-group" }, -400, 1600);
+ const previous = row({ messageId: "above" }, -400, 350);
+ const visible = row({ messageId: "visible" }, -20, 800);
+ const content = {
+ querySelectorAll: selector => selector === "[data-message-id]"
+ ? [previous, visible] : selector === "[data-minimap-id]" ? [wrapper] : [wrapper, previous, visible],
+ };
+ const position = captureTranscriptReadingPosition(scroller, content, false, 60);
+ assert.equal(position.messageId, "visible");
+ assert.equal(position.offset, -20);
+ // Prepending the preceding half changes the group key, not this message id.
+ const moved = row({ messageId: "visible" }, 6400, 800);
+ assert.equal(restoreTranscriptReadingPosition(scroller, fakeContent({ row: moved }), position), true);
+ assert.equal(scroller.scrollTop, 6500);
+});
+
+test("capture retains a turn anchor when no visible message body is mounted", () => {
+ const scroller = fakeScroller();
+ const wrapper = { dataset: { minimapId: "tools-only" },
+ getBoundingClientRect: () => ({ top: -20, bottom: 800, height: 820 }) };
+ const content = { querySelectorAll: selector => selector === "[data-message-id]" ? [] : [wrapper] };
+ assert.equal(captureTranscriptReadingPosition(scroller, content, false, 60).messageId, "tools-only");
+});
+
+test("restore prefers the actual message over a group with the same marker id", () => {
+ const scroller = fakeScroller({ scrollTop: 80 });
+ const content = { querySelector: selector => ({
+ getBoundingClientRect: () => ({ top: selector.startsWith("[data-message-id=") ? 140 : 100, height: 600 }),
+ }) };
+ assert.equal(restoreTranscriptReadingPosition(scroller, content, bookmark({ offset: 20 })), true);
+ assert.equal(scroller.scrollTop, 200);
+});
diff --git a/docs/adr/0130-bounded-mounted-transcript-window.md b/docs/adr/0130-bounded-mounted-transcript-window.md
index 93ca2bd7d..cafdef617 100644
--- a/docs/adr/0130-bounded-mounted-transcript-window.md
+++ b/docs/adr/0130-bounded-mounted-transcript-window.md
@@ -49,6 +49,10 @@ reference-equal, and that runs on every streamed token.
The pane-local history paging hook captures the visible message's viewport
offset for both. It holds input during the transaction and restores that
anchor before paint, through committed projection and late row layout.
+ Reading bookmarks prefer a visible message node to an answer-group marker;
+ prepending the earlier half of an answer can replace the group's first id.
+ Explicit latest navigation clears the preceding gesture as well as the hold,
+ so queued near-top scroll events cannot initiate another history transaction.
This replaces the old `prependHeightRef` total-height delta: deferred DOM,
tail updates and intrinsic-size estimates made that delta unreliable.
4. The window **resets per session** and is clamped to the loaded history, so a
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index 6411fccbd..f76fc0290 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -1612,7 +1612,9 @@ Project drag/drop follows these patterns:
visible message and its viewport offset before either mounting more cached
rows or requesting a page. Keep that anchor through the committed projection
and late row layout; total scroll-height growth is not an anchor because it
- can include tail updates and offscreen intrinsic-size estimates.
+ can include tail updates and offscreen intrinsic-size estimates. Prefer the
+ actual visible message node over its enclosing answer/minimap group: loading
+ the preceding part of a continuous answer can change the group's identity.
- While that transaction owns the viewport, discard wheel/trackpad, touch-scroll
and scrolling-key input addressed to the transcript. Do not queue input for
replay after loading. Nested scroll owners, editable fields, title activation
@@ -1658,7 +1660,9 @@ Project drag/drop follows these patterns:
- User send / retry / regenerate: re-pins, hides the jump control, and positions the latest content in the layout phase so the new turn is visible without a top-of-history flash; subsequent persisted and streamed rows continue to follow the bottom
- Scroll-to-bottom button: position fixed at bottom-right of transcript area, offset 12px
- Button appears as soon as upward scrolling releases follow mode
-- Click button: scrolls to bottom, resumes auto-scroll
+- Click button: scrolls to bottom, resumes auto-scroll and retires the prior
+ scroll gesture before navigation. Queued scroll events or a pending page must
+ not reopen historical reading or fetch another page during that jump.
- Button disappears when at bottom
- A delegation tab uses the same single-body scroll owner as the work panel.
It renders the delegate's conversation — each `Task` call's prompt as a user
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index f061b51f9..21e3e315d 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -13533,6 +13533,12 @@ This test plan spec is accepted when:
`e2e-transcript-render.mjs`. Production React and styles, native Electron wheel
bursts, per-frame anchor samples with 2 CSS-pixel rounding tolerance, tail
updates, delayed row geometry, rejection, hide/reveal and latest navigation.
+ The production `SessionPane` and real store path additionally paginate a small
+ tail across continuous assistant-answer boundaries, sample actual message
+ positions, and click the real latest button during/after Host reads for both
+ standalone rows and grouped answers. Only external Host IPC is controlled.
+ Run with normal animation; do not force reduced motion to hide smooth-scroll
+ races. Assert latest navigation stays at bottom without opening another page.
Manual procedures: `tests/history-loading-scroll-test-cases.md`.
- **Specs linked**: `04-ux/09-interaction-patterns.md` §9.1, ADR 0130.
- **Acceptance**: C (conversation), Quality.
diff --git a/scripts/e2e-transcript-history-loading.mjs b/scripts/e2e-transcript-history-loading.mjs
index 78a0d1dba..56ab5bead 100644
--- a/scripts/e2e-transcript-history-loading.mjs
+++ b/scripts/e2e-transcript-history-loading.mjs
@@ -34,7 +34,6 @@ try {
const { app, BrowserWindow } = require('electron');
const assert = require('node:assert/strict');
app.setPath('userData', require('node:path').join(__dirname, 'profile'));
-app.commandLine.appendSwitch('force-prefers-reduced-motion');
app.disableHardwareAcceleration();
app.on('window-all-closed', () => app.quit());
app.whenReady().then(async () => {
@@ -51,6 +50,7 @@ app.whenReady().then(async () => {
try {
await win.loadFile(require('node:path').join(__dirname, 'index.html'));
await js('new Promise((resolve,reject)=>{const end=performance.now()+10000;const check=()=>{if(globalThis.historyLoadingFixture)resolve();else if(performance.now()>end)reject(new Error("fixture did not initialize"));else requestAnimationFrame(check)};check()})');
+ console.log('HISTORY_MOTION ' + await js('JSON.stringify({ reduced: matchMedia("(prefers-reduced-motion: reduce)").matches })'));
if (${manual}) return;
const results = [];
for (const name of ['wheel', 'quiet', 'tail', 'late-layout', 'failure', 'empty', 'hide']) {
@@ -85,6 +85,8 @@ app.whenReady().then(async () => {
const navigation = await call('jumpWhileLoading()');
assert.equal(navigation.locked, false, 'return-to-latest did not cancel the old hold');
assert(Math.abs(navigation.distanceFromBottom) <= 2, 'late page stole explicit latest navigation');
+ const realNavigation = await js('globalThis.transcriptHistoryNavigationProbe()');
+ console.log('REAL_HISTORY_NAVIGATION_PROBE ' + JSON.stringify(realNavigation));
console.log('HISTORY_LOADING_PROBE ' + JSON.stringify({ ok: true, cases: results.length, cachedWindow: true, inputOwnership: true, latestNavigation: true }));
app.exit(0);
} catch(e) { console.error(e.stack || String(e)); app.exit(1); }
diff --git a/scripts/e2e/transcript-history-loading.tsx b/scripts/e2e/transcript-history-loading.tsx
index 19b9d8836..150b36131 100644
--- a/scripts/e2e/transcript-history-loading.tsx
+++ b/scripts/e2e/transcript-history-loading.tsx
@@ -1,3 +1,4 @@
+import "./transcript-history-navigation";
import { createRoot } from "react-dom/client";
import { flushSync } from "react-dom";
import i18n from "i18next";
diff --git a/scripts/e2e/transcript-history-navigation.tsx b/scripts/e2e/transcript-history-navigation.tsx
new file mode 100644
index 000000000..1f0b1fced
--- /dev/null
+++ b/scripts/e2e/transcript-history-navigation.tsx
@@ -0,0 +1,177 @@
+import { createRoot } from "react-dom/client";
+import { flushSync } from "react-dom";
+import { createInstance } from "i18next";
+import { I18nextProvider } from "react-i18next";
+import { en } from "@pi-desktop/i18n";
+import { IPC } from "@pi-desktop/shared/protocol";
+import type { Result, SessionSummary, UiMessage } from "@pi-desktop/shared";
+import { SessionPane } from "../../apps/desktop/src/components/SessionPane";
+import { useAppStore } from "../../apps/desktop/src/stores/app-store";
+
+const frame = () => new Promise<void>(resolve => requestAnimationFrame(() => resolve()));
+async function until(predicate: () => boolean, label: string) {
+ const deadline = performance.now() + 8000;
+ while (!predicate()) {
+ if (performance.now() >= deadline) throw new Error(`Real history navigation: ${label}`);
+ await frame();
+ }
+}
+function assert(value: unknown, label: string): asserts value {
+ if (!value) throw new Error(`Real history navigation: ${label}`);
+}
+
+declare global { var transcriptHistoryNavigationProbe: () => Promise<unknown>; }
+globalThis.transcriptHistoryNavigationProbe = async () => {
+ const i18n = createInstance();
+ await i18n.init({ lng: "en", resources: { en: { translation: en } } });
+ const originalState = useAppStore.getState();
+ const originalBridge = window.piDesktop;
+ const host = document.createElement("div");
+ host.style.cssText = "position:fixed;inset:0;display:flex;flex-direction:column;background:var(--ds-bg-primary)";
+ document.body.append(host);
+ const root = createRoot(host);
+ const createdAt = "2026-11-04T00:00:00Z";
+ let id = "";
+ let data: UiMessage[] = [];
+ let summary: SessionSummary;
+ let pending: { resolve: (value: unknown) => void; response: unknown }[] = [];
+ const reads: number[] = [];
+ const unexpected: string[] = [];
+ window.piDesktop = { channels: IPC, platform: "win32", on: () => () => {},
+ invoke: async <T,>(channel: string, ...args: unknown[]): Promise<Result<T>> => {
+ let value: unknown;
+ if (channel === IPC.invoke.sessionGet) {
+ const input = args[0];
+ assert(input && typeof input === "object" && "id" in input && input.id === id, "unexpected session request");
+ const before = "messageBefore" in input && typeof input.messageBefore === "number" ? input.messageBefore : undefined;
+ const end = before === undefined ? data.length : Math.min(data.length, before);
+ const limit = before === undefined ? 35 : "messageLimit" in input ? Number(input.messageLimit) : 100;
+ const start = Math.max(0, end - limit);
+ const response = { session: { ...summary, messages: data.slice(start, end), messageStart: start,
+ messageEnd: end, hasMoreBefore: start > 0, hasMoreAfter: end < data.length } };
+ if (before !== undefined && before < data.length) {
+ reads.push(before);
+ value = await new Promise(resolve => pending.push({ resolve, response }));
+ } else value = response;
+ } else if (channel === IPC.invoke.sessionList) value = { sessions: [summary] };
+ else if (channel === IPC.invoke.plansPending) value = { plans: [], state: "inactive" };
+ else if (channel === IPC.invoke.pendingInteractive) value = { permissions: [], asks: [] };
+ else if (channel === IPC.invoke.agentQueueList) value = { entries: [] };
+ else if (channel === IPC.invoke.notificationMarkRead || channel === IPC.invoke.notificationSetViewingSession) value = { ok: true };
+ else { unexpected.push(channel); return { ok: false, error: { code: "FIXTURE_UNEXPECTED", message: channel } }; }
+ return { ok: true, data: value as T };
+ },
+ };
+ const scroller = () => host.querySelector<HTMLDivElement>(".thread-scroll")!;
+ const busy = () => host.querySelector('.transcript-history-loading[aria-hidden="false"]') !== null;
+ const bottom = () => Math.abs(scroller().scrollHeight - scroller().clientHeight - scroller().scrollTop) <= 2;
+ const render = () => flushSync(() => root.render(<I18nextProvider i18n={i18n}>
+ <div className="session-panes"><SessionPane key={id} sessionId={id} visible /></div>
+ </I18nextProvider>));
+ const reset = async (name: string, role: "user" | "mixed" = "user") => {
+ flushSync(() => root.render(null));
+ for (const item of pending.splice(0)) item.resolve(item.response);
+ id = `navigation-${name}`;
+ data = Array.from({ length: 280 }, (_, index) => ({ id: `${id}-${index}`,
+ role: role === "user" || index % 30 === 0 ? "user" : "assistant",
+ content: `Message ${index}\n\n${"Stationary visible reading paragraph. ".repeat(80)}`,
+ createdAt, status: "complete" }));
+ summary = { id, title: id, mode: "agent", permissionMode: "ask", thinkingLevel: "off",
+ providerId: "fixture", modelId: "fixture", createdAt, updatedAt: createdAt, messageCount: data.length };
+ useAppStore.setState({ sessions: [summary], messages: [], activeSessionId: undefined, selectingSessionId: undefined,
+ retainedSessionIds: [], retainedTranscripts: {}, transcriptViews: {}, sessionHistory: {}, sessionCompactions: {},
+ providers: [], providerModels: {}, pendingPlans: {}, pendingAsks: {}, pendingPermissions: {}, planningStates: {},
+ runningSessions: {}, isRunning: false, workspace: undefined, queuedPrompts: {}, notifications: [], page: "chat",
+ settings: { ...originalState.settings, smoothStreaming: false } });
+ await useAppStore.getState().selectSession(id);
+ render();
+ await until(() => Boolean(scroller()) && !host.querySelector('[data-transcript-settling="true"]') && bottom(), "cold pane follows latest");
+ await frame();
+ };
+ const begin = () => {
+ const el = scroller();
+ el.dispatchEvent(new WheelEvent("wheel", { bubbles: true, deltaY: -400 }));
+ el.scrollTo({ top: 80, behavior: "instant" });
+ const viewport = el.getBoundingClientRect();
+ const row = [...el.querySelectorAll<HTMLElement>("[data-message-id]")].find(node => {
+ const r = node.getBoundingClientRect(); return r.height > 0 && r.bottom > viewport.top + 20 && r.top < viewport.bottom;
+ });
+ assert(row?.dataset.messageId, "visible message missing before loading");
+ const messageId = row.dataset.messageId;
+ const measure = () => {
+ const node = el.querySelector<HTMLElement>(`[data-message-id="${CSS.escape(messageId)}"]`);
+ return node?.isConnected ? node.getBoundingClientRect().top - el.getBoundingClientRect().top : Infinity;
+ };
+ const offset = measure();
+ const samples: number[] = [];
+ let handle = 0;
+ const sample = () => { samples.push(measure()); handle = requestAnimationFrame(sample); };
+ handle = requestAnimationFrame(sample);
+ el.dispatchEvent(new Event("scroll", { bubbles: true }));
+ return { messageId, offset, measure, samples, stop: () => cancelAnimationFrame(handle) };
+ };
+ const finish = async () => {
+ assert(pending.length === 1, `expected one held physical page, got ${pending.length}`);
+ const item = pending.shift()!;
+ item.resolve(item.response);
+ await until(() => !busy() && !useAppStore.getState().transcriptViews[id]?.loading, "page did not settle");
+ for (let n = 0; n < 8; n++) await frame();
+ };
+ const results: unknown[] = [];
+ const failures: string[] = [];
+ try {
+ for (const role of ["user", "mixed"] as const) {
+ await reset(`quiet-${role}`, role);
+ const anchor = begin();
+ await until(() => pending.length === 1, "ordinary paging did not reach Host boundary");
+ for (let n = 0; n < 6; n++) await frame();
+ const during = anchor.measure();
+ await finish();
+ anchor.stop();
+ const result = { role, duringDrift: Math.abs(during - anchor.offset),
+ finalDrift: Math.abs(anchor.measure() - anchor.offset), maxDrift: Math.max(...anchor.samples.map(x => Math.abs(x - anchor.offset))),
+ historical: Boolean(useAppStore.getState().transcriptViews[id]), top: scroller().scrollTop };
+ console.log("REAL_HISTORY_QUIET " + JSON.stringify(result));
+ if (result.maxDrift > 2) failures.push(`loading moved visible ${role} message: ${JSON.stringify(result)}`);
+ results.push(result);
+ }
+ for (const scenario of [
+ { timing: "pending", role: "user" }, { timing: "settled", role: "user" },
+ { timing: "pending", role: "mixed" }, { timing: "settled", role: "mixed" },
+ ] as const) {
+ const { timing, role } = scenario;
+ await reset(`latest-${timing}-${role}`, role);
+ const anchor = begin();
+ try {
+ await until(() => pending.length === 1, "pending page for latest navigation");
+ if (timing === "settled") await finish();
+ const button = host.querySelector<HTMLButtonElement>(".jump-latest-btn");
+ assert(button, "actual return-to-latest button missing");
+ const readsBeforeJump = reads.length;
+ button.click();
+ if (timing === "pending") { const item = pending.shift()!; item.resolve(item.response); }
+ await until(() => !useAppStore.getState().transcriptViews[id] && bottom(), `latest button failed after ${timing} page`);
+ for (let n = 0; n < 15; n++) { await frame(); assert(bottom(), "latest navigation was reversed after reaching bottom"); }
+ assert(pending.length === 0 && reads.length === readsBeforeJump, "latest navigation started another history page");
+ const result = { timing, role, top: scroller().scrollTop, height: scroller().scrollHeight,
+ historical: Boolean(useAppStore.getState().transcriptViews[id]), reduced: matchMedia("(prefers-reduced-motion: reduce)").matches };
+ console.log("REAL_HISTORY_LATEST " + JSON.stringify(result));
+ results.push(result);
+ } catch (error) {
+ const result = { timing, role, error: String(error), top: scroller().scrollTop, height: scroller().scrollHeight,
+ historical: Boolean(useAppStore.getState().transcriptViews[id]), pending: pending.length };
+ console.log("REAL_HISTORY_LATEST " + JSON.stringify(result));
+ failures.push(JSON.stringify(result));
+ } finally { anchor.stop(); }
+ }
+ assert(unexpected.length === 0, `unexpected IPC: ${unexpected.join(",")}`);
+ assert(failures.length === 0, failures.join("\n"));
+ return { ok: true, cases: results, reads };
+ } finally {
+ for (const item of pending.splice(0)) item.resolve(item.response);
+ flushSync(() => root.unmount());
+ host.remove();
+ useAppStore.setState(originalState);
+ window.piDesktop = originalBridge;
+ }
+};
diff --git a/tests/history-loading-scroll-test-cases.md b/tests/history-loading-scroll-test-cases.md
index ec2edd121..fc9f466b3 100644
--- a/tests/history-loading-scroll-test-cases.md
+++ b/tests/history-loading-scroll-test-cases.md
@@ -5,8 +5,10 @@
- Requirements: discard transcript scrolling while earlier messages load; keep
the current visible turn stationary through paging and late layout; restore
normal input afterwards without changing other navigation.
-- Integration base: official `vastsa/PI-Desktop` main,
- `9d86fc95b17780a820fec1890fabcabb1d0fa788`.
+- Follow-up integration base: official `vastsa/PI-Desktop` main,
+ `14b928f3171e9e00b6d2851d67c832812ff61fc7`, including merged PR #2080.
+ The continuous-answer jump and pending-page latest-button race both fail on
+ this baseline despite the original seven direct-component cases passing.
- The original failing reproduction was verified on official main
`3f8c02c63e6ca6ed9ff0c9c570cfc4aeadea92cd`.
- Run from this request checkout, not another installed Desktop build. Existing
@@ -50,6 +52,17 @@ are used. It is not a mock implementation of scrolling.
page is pending, when rows mount, or when the label disappears. Repeating the
case must not produce alternating small jumps.
+### TC-F-003: a continuous answer spanning a page stays stationary
+
+- Priority: High. Requirement: pagination must not anchor a temporary group.
+- Use the automated `SessionPane` journey below, or a local conversation with
+ several consecutive assistant messages in one answer spanning a page edge.
+- Steps: scroll into the oldest loaded fragment and trigger an earlier page;
+ identify a visible paragraph, then allow the preceding answer fragments to load.
+- Expected: that same message stays at its screen offset even when its enclosing
+ answer group's first message changes. Do not assess only `scrollTop` or the
+ outer group's position. Repeat with ordinary standalone user rows.
+
### TC-ERR-001: a failed page releases input
- Priority: High. Requirement: failure recovery does not leave a locked viewport.
@@ -66,6 +79,10 @@ are used. It is not a mock implementation of scrolling.
button, then click **Complete page**.
- Expected: navigation reaches and stays at the latest turn. The old page must
not pull the viewport back to its former reading anchor or keep input locked.
+ Repeat via the real session/store paging path, both immediately after the
+ upward gesture while a page is pending and after the page settles, using
+ standalone rows and a continuous grouped answer. Keep normal motion enabled.
+ No queued scroll event may reopen history or start another older-page read.
### TC-E-001: verify the real application paths
@@ -101,7 +118,11 @@ checks single-flight IO, samples the visible anchor each frame (2 CSS-pixel
rounding tolerance), and checks normal input after completion. Cases include
quiet loading, native wheel bursts, tail updates, six successive delayed row
height changes, rejection, empty pages, cached-window growth, hide/reveal, input
-ownership and return-to-latest.
+ownership and return-to-latest. Its additional `transcript-history-navigation`
+journey uses production `SessionPane`, the real store and delayed external Host
+IPC reads: two message-stability cases (standalone/grouped) plus four real
+latest-button cases (pending/settled page × standalone/grouped). It checks the
+historical view is cleared, the bottom remains reached and no extra page starts.
| Requirement | Cases | Evidence level |
| --- | --- | --- |