Skip to content

Commit 39cff92

Browse files
fix(ui): keep transcript disclosures anchored (#126272)
* fix(ui): keep transcript disclosures anchored * fix(ui): include file tool disclosure anchors * fix(ui): anchor raw tool disclosures * test(ui): cover merged disclosure invariants * fix(ui): anchor sidebar disclosure commits * test(ui): assert disclosure state transitions * fix(ui): cover semantic transcript disclosures * fix(ui): anchor transcript geometry controls * test(ui): exercise tab geometry anchoring * test(ui): keep geometry proof behavior-bound * refactor(ui): split disclosure anchor coverage * refactor(ui): extract transcript scroll margin * refactor(ui): shorten transcript helper names
1 parent 04d1745 commit 39cff92

10 files changed

Lines changed: 674 additions & 152 deletions

‎ui/src/e2e/chat-tool-turn-outcome.e2e.test.ts‎

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import fs from "node:fs/promises";
33
import path from "node:path";
44
import { expect, it } from "vitest";
55
import { controlUiSessionUrl, installMockGateway } from "../test-helpers/control-ui-e2e.ts";
6-
import { chatThreadDistanceFromBottom, waitForChatScrollIdle } from "./chat-flow.test-support.ts";
76
import { createControlUiE2eSuite } from "./control-ui-e2e-suite.test-support.ts";
87

98
const suite = createControlUiE2eSuite({
@@ -227,84 +226,6 @@ suite.define(() => {
227226
},
228227
);
229228

230-
it("keeps the final activity row anchored while its disclosure opens", async () => {
231-
const context = await suite.browser.newContext({ viewport: { height: 600, width: 900 } });
232-
const page = await context.newPage();
233-
const transcriptPrefix = Array.from({ length: 12 }, (_, index) => [
234-
{
235-
role: "user",
236-
content: `Earlier prompt ${index + 1}: keep enough transcript above the active row to make the pane scroll.`,
237-
timestamp: index * 2 + 1,
238-
},
239-
{
240-
role: "assistant",
241-
content: [{ type: "text", text: `Earlier response ${index + 1}.` }],
242-
timestamp: index * 2 + 2,
243-
},
244-
]).flat();
245-
await installMockGateway(page, {
246-
historyMessages: [
247-
...transcriptPrefix,
248-
{
249-
role: "assistant",
250-
content: [
251-
{
252-
type: "toolCall",
253-
id: "call-anchor",
254-
name: "bash",
255-
arguments: { command: "pnpm test ui/src/pages/chat" },
256-
},
257-
{
258-
type: "toolCall",
259-
id: "call-anchor-read",
260-
name: "read",
261-
arguments: { path: "ui/src/pages/chat/components/chat-tool-cards.ts" },
262-
},
263-
],
264-
timestamp: 100,
265-
},
266-
{
267-
role: "toolResult",
268-
toolCallId: "call-anchor",
269-
toolName: "bash",
270-
content: [{ type: "text", text: "All focused tests passed." }],
271-
timestamp: 101,
272-
},
273-
{
274-
role: "toolResult",
275-
toolCallId: "call-anchor-read",
276-
toolName: "read",
277-
content: [{ type: "text", text: "export function renderToolCard() {}" }],
278-
timestamp: 102,
279-
},
280-
],
281-
});
282-
283-
await page.goto(`${suite.server.baseUrl}chat`);
284-
const activity = page.locator(".chat-group--activity .chat-activity-group__summary");
285-
await activity.waitFor();
286-
await waitForChatScrollIdle(page);
287-
expect(Math.abs(await chatThreadDistanceFromBottom(page))).toBeLessThanOrEqual(2);
288-
const virtualRow = page.locator(".chat-virtual-row").filter({ has: activity });
289-
const rowTop = async () =>
290-
virtualRow.evaluate((row) => {
291-
const thread = row.closest<HTMLElement>(".chat-thread");
292-
if (!thread) {
293-
throw new Error("Expected activity row inside the chat thread");
294-
}
295-
return row.getBoundingClientRect().top - thread.getBoundingClientRect().top;
296-
});
297-
const topBefore = await rowTop();
298-
299-
await activity.click();
300-
await page.locator(".chat-activity-group__body:not([hidden])").waitFor();
301-
await waitForChatScrollIdle(page);
302-
303-
expect(Math.abs((await rowTop()) - topBefore)).toBeLessThanOrEqual(2);
304-
await captureToolActivityProof(page, "activity-disclosure-scroll-anchor");
305-
await context.close();
306-
});
307-
308229
it("keeps an earlier autonomous failure visible after a later turn recovers", async () => {
309230
const context = await suite.browser.newContext({ viewport: { height: 800, width: 1200 } });
310231
const page = await context.newPage();

0 commit comments

Comments
 (0)