diff --git a/src/browser/utils/messages/transcriptRenderProjection.test.ts b/src/browser/utils/messages/transcriptRenderProjection.test.ts index 85c3dfdcef..aeb80fe464 100644 --- a/src/browser/utils/messages/transcriptRenderProjection.test.ts +++ b/src/browser/utils/messages/transcriptRenderProjection.test.ts @@ -701,7 +701,7 @@ describe("operational bundle coalescing", () => { expect(infos[4]).toMatchObject({ key: "bundle:search-1", position: "member" }); }); - test("active and just-settled tail bundles stay expanded until a visible event or turn end", () => { + test("keeps active bundles expanded while completed bundles default collapsed", () => { const active = computeOperationalBundleInfos( [reasoning({ id: "think-1", isStreaming: true })], { @@ -721,7 +721,7 @@ describe("operational bundle coalescing", () => { expect(justSettledTail[0]).toMatchObject({ position: "head", state: "settled", - defaultExpanded: true, + defaultExpanded: false, }); const afterVisibleEvent = computeOperationalBundleInfos( diff --git a/src/browser/utils/messages/transcriptRenderProjection.ts b/src/browser/utils/messages/transcriptRenderProjection.ts index 49283ad90a..12bac55753 100644 --- a/src/browser/utils/messages/transcriptRenderProjection.ts +++ b/src/browser/utils/messages/transcriptRenderProjection.ts @@ -178,7 +178,7 @@ export function computeWorkBundleInfos( export function computeOperationalBundleInfos( messages: DisplayedMessage[], - options: ComputeBundleInfosOptions + _options: ComputeBundleInfosOptions ): Array { const infos = new Array(messages.length); let index = 0; @@ -224,9 +224,7 @@ export function computeOperationalBundleInfos( const state = frozenEntries.some((entry) => isActiveOperationalMessage(entry.message)) ? "active" : "settled"; - const hasSubsequentVisibleEvent = hasVisibleEventAfter(messages, index); - const defaultExpanded = - state === "active" || (options.isTurnActive && !hasSubsequentVisibleEvent); + const defaultExpanded = state === "active"; const key = `bundle:${first.id}`; const summary = summarizeOperationalBundle(frozenEntries.map((entry) => entry.message)); @@ -468,16 +466,6 @@ function computeWorkBundleDurationMs( return endTimestamp - startTimestamp; } -function hasVisibleEventAfter(messages: DisplayedMessage[], startIndex: number): boolean { - for (let index = startIndex; index < messages.length; index++) { - if (!isOperationalBundleMemberMessage(messages[index])) { - return true; - } - } - - return false; -} - export function summarizeOperationalBundle( messages: OperationalBundleMemberMessage[] ): OperationalBundleSummary { diff --git a/tests/ui/chat/transcriptDensity.test.ts b/tests/ui/chat/transcriptDensity.test.ts index d1b1a2ced9..4e125bbe14 100644 --- a/tests/ui/chat/transcriptDensity.test.ts +++ b/tests/ui/chat/transcriptDensity.test.ts @@ -147,7 +147,9 @@ describe("Hyper transcript density", () => { return button; }); expect(firstOperationalButton.textContent).toContain("Ran 5 operations"); + expect(firstOperationalButton.getAttribute("aria-expanded")).toBe("false"); expect(view.container.textContent).toContain("Please validate with typecheck too"); + expect(view.container.textContent).not.toContain("src/auth.ts"); expect(view.container.textContent).not.toContain("make typecheck"); expectTextOrder( view.container, @@ -170,6 +172,7 @@ describe("Hyper transcript density", () => { } return button; }); + expect(failedOperationalButton.getAttribute("aria-expanded")).toBe("false"); fireEvent.click(failedOperationalButton); await waitFor(() => {