Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/browser/utils/messages/transcriptRenderProjection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })],
{
Expand All @@ -721,7 +721,7 @@ describe("operational bundle coalescing", () => {
expect(justSettledTail[0]).toMatchObject({
position: "head",
state: "settled",
defaultExpanded: true,
defaultExpanded: false,
});

const afterVisibleEvent = computeOperationalBundleInfos(
Expand Down
16 changes: 2 additions & 14 deletions src/browser/utils/messages/transcriptRenderProjection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export function computeWorkBundleInfos(

export function computeOperationalBundleInfos(
messages: DisplayedMessage[],
options: ComputeBundleInfosOptions
_options: ComputeBundleInfosOptions
): Array<OperationalBundleInfo | undefined> {
const infos = new Array<OperationalBundleInfo | undefined>(messages.length);
let index = 0;
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/chat/transcriptDensity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -170,6 +172,7 @@ describe("Hyper transcript density", () => {
}
return button;
});
expect(failedOperationalButton.getAttribute("aria-expanded")).toBe("false");
fireEvent.click(failedOperationalButton);

await waitFor(() => {
Expand Down
Loading