🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(sessions): Session view improvements (#18393)
Ben Bachem91ba954bb2c7
diff --git a/web/src/components/design-system/Dialog/Dialog.tsx b/web/src/components/design-system/Dialog/Dialog.tsxindex 79e091e5c3..beaa9d9006 100644--- a/web/src/components/design-system/Dialog/Dialog.tsx+++ b/web/src/components/design-system/Dialog/Dialog.tsx@@ -12,14 +12,14 @@ import { cn } from "@/src/utils/tailwind";import motionStyles from "./Dialog.module.css";const dialogContentVariants = cva(- "fixed left-[50%] top-[50%] flex max-h-[85vh] w-full translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden bg-modal shadow-lg sm:rounded-lg",+ "fixed top-0 left-0 flex h-dvh w-full flex-col overflow-hidden bg-modal shadow-lg sm:top-[50%] sm:left-[50%] sm:h-auto sm:max-h-[85vh] sm:translate-x-[-50%] sm:translate-y-[-50%] sm:rounded-lg",{variants: {size: {- sm: "max-w-md",- default: "max-w-lg",- lg: "max-w-4xl",- xxl: "h-[90vh] max-w-[95vw]",+ sm: "sm:max-w-md",+ default: "sm:max-w-lg",+ lg: "sm:max-w-4xl",+ xxl: "sm:h-[90vh] sm:max-w-[95vw]",},},defaultVariants: {@@ -115,7 +115,7 @@ function DialogRoot({}}><header className="bg-modal sticky top-0 z-30 flex shrink-0 flex-col gap-1 rounded-t-lg p-4">- <div className="flex w-full items-center justify-between gap-4 text-center sm:text-left">+ <div className="flex w-full items-center justify-between gap-4 text-left"><DialogPrimitive.Title className="min-w-0 flex-1 text-lg leading-none font-bold tracking-tight">{title}</DialogPrimitive.Title>diff --git a/web/src/components/ui/MarkdownViewer.stories.tsx b/web/src/components/ui/MarkdownViewer.stories.tsxindex a768e093da..e5b25c277e 100644--- a/web/src/components/ui/MarkdownViewer.stories.tsx+++ b/web/src/components/ui/MarkdownViewer.stories.tsx@@ -1,5 +1,5 @@import preview from "../../../.storybook/preview";-import { expect, waitFor, within } from "storybook/test";+import { expect, userEvent, waitFor, within } from "storybook/test";import { MarkdownView } from "./MarkdownViewer";const meta = preview.meta({@@ -16,6 +16,29 @@ export const Default = meta.story({},});+export const CollapsedPlainTextFallback = meta.story({+ name: "(Test) Collapsed Plain Text Fallback",+ args: {+ markdown: `${"> ".repeat(101)}Deeply nested content`,+ fallbackDisplay: "collapsed",+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const content = canvas.getByText(+ `${"> ".repeat(101)}Deeply nested content`,+ {+ exact: false,+ selector: "pre",+ },+ );+ await expect(content).not.toBeVisible();+ await userEvent.click(canvas.getByText("Expand content"));+ await expect(content).toBeVisible();+ await userEvent.click(canvas.getByText("Collapse content"));+ await expect(content).not.toBeVisible();+ },+});+export const NestedLists = meta.story({args: {markdown: `In practical terms, it helps you:diff --git a/web/src/components/ui/MarkdownViewer.tsx b/web/src/components/ui/MarkdownViewer.tsxindex 0ded7e7d63..aa4240a927 100644--- a/web/src/components/ui/MarkdownViewer.tsx+++ b/web/src/components/ui/MarkdownViewer.tsx@@ -3,6 +3,7 @@import { cn } from "@/src/utils/tailwind";import {type FC,+ type ComponentProps,type ReactNode,type ReactElement,memo,@@ -19,7 +20,7 @@ import ReactMarkdown, {import remarkGfm from "remark-gfm";import { Codeblock as CodeBlock } from "@/src/components/design-system/Codeblock/Codeblock";import { useTheme } from "next-themes";-import { ImageOff, Info } from "lucide-react";+import { ChevronRight, ImageOff, Info } from "lucide-react";import { MentionBadge } from "@/src/features/comments/components/MentionBadge";import {OpenAIUrlImageUrl,@@ -414,9 +415,11 @@ const markdownComponents: NonNullable<Options["components"]> = {function MarkdownRenderer({markdown,className,+ fallbackDisplay,}: {markdown: string;className?: string;+ fallbackDisplay?: "expanded" | "collapsed";}) {const promptReferenceProjectId = usePromptReferenceProjectId();const characterLimit = useMarkdownRenderCharacterLimit();@@ -438,9 +441,34 @@ function MarkdownRenderer({Content is too large or deeply nested to render as markdown.Displaying as plain text.</div>- <pre className="text-base break-words whitespace-pre-wrap">- {markdown}- </pre>+ {fallbackDisplay === "collapsed" ? (+ <details className="group" data-markdown-fallback>+ <Button+ asChild+ variant="ghost"+ size="sm"+ className="text-muted-foreground w-fit cursor-pointer justify-start gap-1.5 text-left text-xs [&::-webkit-details-marker]:hidden"+ >+ <summary>+ <ChevronRight+ className="icon-sm transition-transform group-open:rotate-90"+ aria-hidden="true"+ />+ <span className="group-open:hidden">Expand content</span>+ <span className="hidden group-open:inline">+ Collapse content+ </span>+ </summary>+ </Button>+ <pre className="pt-2 text-base break-words whitespace-pre-wrap">+ {markdown}+ </pre>+ </details>+ ) : (+ <pre className="text-base break-words whitespace-pre-wrap">+ {markdown}+ </pre>+ )}</div>);}@@ -511,6 +539,7 @@ export function MarkdownView({controlButtons,afterHeader,isSystemPrompt,+ fallbackDisplay,}: {/** The UNPARSED content shape — see `canRenderContentAsMarkdown`. Mediareference strings must still be strings when they reach the part guards. */@@ -527,6 +556,7 @@ export function MarkdownView({(`role === "system"`) — the title can be a message `name` instead of therole. Falls back to matching the title for callers without role data. */isSystemPrompt?: boolean;+ fallbackDisplay?: ComponentProps<typeof MarkdownRenderer>["fallbackDisplay"];}) {const { forcedTheme, resolvedTheme } = useTheme();const theme = forcedTheme ?? resolvedTheme;@@ -626,6 +656,7 @@ export function MarkdownView({<><MarkdownRenderermarkdown={isCollapsed ? truncatedContent : markdown}+ fallbackDisplay={fallbackDisplay}/>{collapseToggle}</>@@ -638,7 +669,10 @@ export function MarkdownView({<>{isCollapsed ? (<>- <MarkdownRenderer markdown={truncatedContent} />+ <MarkdownRenderer+ markdown={truncatedContent}+ fallbackDisplay={fallbackDisplay}+ />{(markdown ?? []).map((content, index) =>isOpenAITextContentPart(content)? null@@ -654,6 +688,7 @@ export function MarkdownView({{audio ? (<><MarkdownRenderer+ fallbackDisplay={fallbackDisplay}markdown={audio.transcript ? "[Audio] \n" + audio.transcript : ""}@@ -700,7 +735,13 @@ export function MarkdownView({}if (isOpenAITextContentPart(content)) {- return <MarkdownRenderer key={index} markdown={content.text} />;+ return (+ <MarkdownRenderer+ key={index}+ markdown={content.text}+ fallbackDisplay={fallbackDisplay}+ />+ );}if (content.type === "image_url") {diff --git a/web/src/features/sessions/SessionDetailPage.tsx b/web/src/features/sessions/SessionDetailPage.tsxindex 5449bab089..c9aa3de38e 100644--- a/web/src/features/sessions/SessionDetailPage.tsx+++ b/web/src/features/sessions/SessionDetailPage.tsx@@ -3,16 +3,19 @@ import {SessionPage,} from "@/src/features/sessions/SessionPages";import { useReadPath } from "@/src/features/events";-import {- RouteParamsPendingFallback,- useReadyRouteParams,-} from "@/src/hooks/useReadyRouteParams";+import { useReadyRouteParams } from "@/src/hooks/useReadyRouteParams";+import { Spinner } from "@/src/components/layouts/spinner";export default function SessionDetailPage() {const route = useReadyRouteParams(["projectId", "sessionId"]);const { isV4 } = useReadPath();- if (!route.ready) return <RouteParamsPendingFallback />;+ if (!route.ready)+ return (+ <div className="bg-background fixed inset-0 z-50 flex">+ <Spinner message="Loading" />+ </div>+ );const { projectId, sessionId } = route.params;diff --git a/web/src/features/sessions/SessionPages.tsx b/web/src/features/sessions/SessionPages.tsxindex 4503ac542e..cd1cb97bee 100644--- a/web/src/features/sessions/SessionPages.tsx+++ b/web/src/features/sessions/SessionPages.tsx@@ -3,6 +3,7 @@import { cn } from "@/src/utils/tailwind";import { GroupedScoreBadges } from "@/src/components/grouped-score-badge";import { ErrorPage } from "@/src/components/error-page";+import { Spinner } from "@/src/components/layouts/spinner";import { PublishSessionSwitch } from "@/src/components/publish-object-switch";import { IOPreview } from "@/src/features/traces";import { JsonSkeleton } from "@/src/components/ui/CodeJsonViewer";@@ -1044,24 +1045,26 @@ export const SessionEventsPage: React.FC<{/>);- if (!session.data) {+ if (session.error && !session.data && !session.isFetching) {return (- <Page- headerProps={{- title: sessionId,- itemType: "SESSION",- breadcrumb: [- {- name: "Sessions",- href: `/project/${projectId}/sessions`,- },- ],+ <ErrorPage+ title="Failed to load session"+ message="The session could not be loaded. Please try again."+ additionalButton={{+ label: "Retry",+ onClick: () => {+ session.refetch();+ },}}- >- <div className="h-full p-4">- <JsonSkeleton className="h-full w-full" numRows={8} />- </div>- </Page>+ />+ );+ }++ if (!session.data) {+ return (+ <div className="bg-background fixed inset-0 z-50 flex">+ <Spinner message="Loading" />+ </div>);}diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.stories.tsx b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.stories.tsxindex 88ac952e31..58b44e5641 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.stories.tsx+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.stories.tsx@@ -2129,6 +2129,7 @@ function SessionConversationalViewStory({groupedTools = false,searchQueryOverride,viewportHeight,+ viewportWidth,pageOffset = 0,delayedLoad = false,}: {@@ -2139,6 +2140,7 @@ function SessionConversationalViewStory({groupedTools?: boolean;searchQueryOverride?: string;viewportHeight?: number;+ viewportWidth?: number;pageOffset?: number;delayedLoad?: boolean;}) {@@ -2260,6 +2262,7 @@ function SessionConversationalViewStory({? undefined: viewportHeight + pageOffset,paddingTop: pageOffset,+ width: viewportWidth,}}>{delayedLoad && !transcriptsLoaded && (@@ -2614,8 +2617,16 @@ export const ExactMessageNavigation = meta.story({.getByLabelText("Session conversation timeline").querySelector<HTMLElement>('[data-session-item-id="scroll-turn-2:0"]')!;await expect(- within(entry).getByRole("button", { name: "Hide tools: lookup · save" }),- ).toHaveAttribute("aria-expanded", "true");+ within(entry).queryByRole("button", {+ name: /^(Show|Hide) tools: lookup · save$/,+ }),+ ).not.toBeInTheDocument();+ await expect(+ within(entry).getByRole("button", { name: "Expand lookup" }),+ ).toBeVisible();+ await expect(+ within(entry).getByRole("button", { name: "Expand save" }),+ ).toBeVisible();},});@@ -2843,7 +2854,7 @@ export const NestedThreadsHidden = meta.story({}}const search = sidebar.getByRole("textbox", {- name: "Search messages and tools",+ name: "Search session",});await userEvent.type(search, "confirms delivery");await expect(@@ -2875,7 +2886,7 @@ export const Loading = meta.story({await expect(sidebar).toHaveAttribute("aria-busy", "true");await expect(within(sidebar).getByRole("textbox", {- name: "Search messages and tools",+ name: "Search session",}),).toBeDisabled();},@@ -2899,7 +2910,7 @@ export const SupportAgentWorkflow = meta.story({await sidebar.findByRole("button", { name: "tool: Get order" }),).toBeInTheDocument();await expect(- sidebar.getByRole("textbox", { name: "Search messages and tools" }),+ sidebar.getByRole("textbox", { name: "Search session" }),).toBeEnabled();await expect(await within(@@ -2946,6 +2957,8 @@ export const ConsecutiveToolGroups = meta.story({await expect(sidebar.getByRole("button", { name: `Tool: ${summary}` }),).toBeInTheDocument();+ }+ for (const summary of ["5x tool_1", longNames]) {await expect(timeline.getByRole("button", { name: `Show tools: ${summary}` }),).toHaveAttribute("aria-expanded", "false");@@ -2954,16 +2967,25 @@ export const ConsecutiveToolGroups = meta.story({sidebar.getByRole("button", { name: "Tool: tool_a · tool_b" }),);await expect(- timeline.getByRole("button", { name: "Hide tools: tool_a · tool_b" }),- ).toHaveAttribute("aria-expanded", "true");+ timeline.queryByRole("button", { name: "Show tools: tool_a · tool_b" }),+ ).not.toBeInTheDocument();+ await expect(+ timeline.getByRole("button", { name: "Expand tool_a" }),+ ).toHaveAttribute("aria-expanded", "false");await expect(timeline.getByRole("button", { name: "Expand tool_b" }),).toBeInTheDocument();await userEvent.click(- timeline.getByRole("button", { name: "Hide tools: tool_a · tool_b" }),+ timeline.getByRole("button", { name: "Expand tool_a" }),+ );+ await expect(+ timeline.getByRole("button", { name: "Collapse tool_a" }),+ ).toHaveAttribute("aria-expanded", "true");+ await userEvent.click(+ timeline.getByRole("button", { name: "Collapse tool_a" }),);await expect(- timeline.getByRole("button", { name: "Show tools: tool_a · tool_b" }),+ timeline.getByRole("button", { name: "Expand tool_a" }),).toHaveAttribute("aria-expanded", "false");await userEvent.type(sidebar.getByRole("textbox"), "tool_1");await expect(@@ -2983,6 +3005,107 @@ export const CodingAgentWorkflow = meta.story({export const LangfuseAssistantWorkflow = meta.story({args: { workflowTraces: langfuseAssistantWorkflow },});+export const CollapsedLargeMessage = meta.story({+ name: "(Test) Collapsed Large Message",+ args: {+ transcriptTraces: [+ {+ ...traces[0]!,+ trace: { ...traces[0]!.trace, name: "Large message fallback" },+ state: {+ type: "transcript",+ result: {+ state: "loaded",+ cutoff: false,+ transcript: {+ threads: [+ {+ conversationHistory: [],+ currentTurn: {+ nestingLevel: 0,+ observations: [],+ messages: [+ {+ observationId: "large-message",+ traceId: "trace-1",+ startTime: new Date("2026-09-24T12:00:00Z"),+ endTime: null,+ role: "user",+ source: "input",+ parts: [+ {+ type: "text",+ text: "Show me the diagnostic output.",+ },+ ],+ },+ {+ observationId: "large-message",+ traceId: "trace-1",+ startTime: new Date("2026-09-24T12:00:00Z"),+ endTime: null,+ role: "assistant",+ source: "output",+ parts: [+ {+ type: "text",+ text: `${"> ".repeat(101)}Deeply nested diagnostic output\n\n${"Diagnostic line: operation completed successfully.\n".repeat(300)}`,+ },+ ],+ },+ {+ observationId: "large-message-summary",+ traceId: "trace-1",+ startTime: new Date("2026-09-24T12:00:01Z"),+ endTime: null,+ role: "assistant",+ source: "output",+ parts: [+ {+ type: "text",+ text: "Summary: all operations completed successfully.",+ },+ ],+ },+ ],+ },+ },+ ],+ },+ },+ },+ },+ ],+ },+ play: async ({ canvasElement }) => {+ const timeline = within(+ within(canvasElement).getByLabelText("Session conversation timeline"),+ );+ const content = await timeline.findByText(+ /Deeply nested diagnostic output/,+ {+ selector: "pre",+ },+ );+ await expect(content).not.toBeVisible();+ await expect(+ timeline.getByText("Summary: all operations completed successfully."),+ ).toBeVisible();+ await userEvent.click(timeline.getByText("Expand content"));+ await expect(content).toBeVisible();+ await userEvent.click(timeline.getByText("Collapse content"));+ await expect(content).not.toBeVisible();+ const sidebar = within(within(canvasElement).getByRole("complementary"));+ await userEvent.type(+ sidebar.getByRole("textbox"),+ "Deeply nested diagnostic output",+ );+ await userEvent.click(+ await sidebar.findByRole("button", { name: "Assistant message" }),+ );+ await waitFor(() => expect(content).toBeVisible());+ },+});export const ManySimpleTurns = meta.story({args: { workflowTraces: manySimpleTurnsWorkflow },});@@ -3064,7 +3187,7 @@ export const ClearPendingSearch = meta.story({play: async ({ canvasElement }) => {const canvas = within(canvasElement);const input = canvas.getByRole("textbox", {- name: "Search messages and tools",+ name: "Search session",});const timeline = canvas.getByLabelText("Session conversation timeline");await userEvent.type(input, "ORDER");diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.tsx b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.tsxindex 1f9d92da71..e4067875e7 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.tsx+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/SessionConversationalView.tsx@@ -1,4 +1,9 @@import { type ComponentProps, useLayoutEffect, useId, useRef } from "react";+import { Search } from "lucide-react";+import { Input } from "@/src/components/ui/input";+import { Dialog } from "@/src/components/design-system/Dialog/Dialog";+import { DialogController } from "@/src/components/design-system/DialogController/DialogController";+import { Trigger as DialogTrigger } from "@radix-ui/react-dialog";import {SessionConversationSidebar,type SessionConversationSidebarTrace,@@ -191,20 +196,89 @@ export function SessionConversationalView(});}}+ const sidebarProps =+ props.state === "loading"+ ? { state: "loading" as const }+ : {+ ...props,+ traces: sidebarTraces,+ activeTraceId: props.controller.activeItemId ?? undefined,+ };return (- <div className="bg-background session-review-stack:grid-rows-[minmax(7rem,9rem)_minmax(0,1fr)] session-review-stack:gap-x-0 relative grid min-h-0 flex-1 grid-rows-[minmax(10rem,13rem)_minmax(0,1fr)] gap-x-4 overflow-hidden @3xl/session-workspace:grid-cols-[clamp(200px,24cqw,296px)_minmax(0,1fr)] @3xl/session-workspace:grid-rows-1">- {props.state === "loading" ? (- <SessionConversationSidebar state="loading" />- ) : (- <SessionConversationSidebar- {...props}- traces={sidebarTraces}- activeTraceId={props.controller.activeItemId ?? undefined}- />- )}+ <div className="bg-background relative grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-x-4 overflow-hidden @3xl/session-workspace:grid-cols-[clamp(200px,24cqw,296px)_minmax(0,1fr)] @3xl/session-workspace:grid-rows-1">+ <div className="border-b px-2 py-2.5 @3xl/session-workspace:hidden">+ <DialogController+ renderDialog={({ closeDialog }) => (+ <Dialog title="Search session" closeOnInteractionOutside>+ <div className="shrink-0 border-b px-4 pt-0 pb-2">+ <div className="relative min-w-0">+ <Search className="icon-base text-foreground-tertiary absolute top-1/2 left-2 -translate-y-1/2" />+ <Input+ disabled={props.state === "loading"}+ value={props.state === "loaded" ? props.search : ""}+ onChange={(event) => {+ if (props.state === "loaded")+ props.onSearchChange(event.target.value);+ }}+ aria-label="Search session"+ placeholder="Search session"+ className="h-7 rounded-sm bg-transparent pl-7 font-mono text-xs"+ />+ </div>+ </div>+ <div className="min-h-0 flex-1 sm:h-[60dvh] sm:flex-none">+ {sidebarProps.state === "loading" ? (+ <SessionConversationSidebar+ state="loading"+ searchVisibility="hidden"+ />+ ) : (+ <SessionConversationSidebar+ {...sidebarProps}+ searchVisibility="hidden"+ onSelect={(...args) => {+ sidebarProps.onSelect(...args);+ closeDialog();+ }}+ />+ )}+ </div>+ </Dialog>+ )}+ >+ {({ openDialog }) => (+ <DialogTrigger asChild>+ <button+ type="button"+ disabled={props.state === "loading"}+ onClick={() => openDialog()}+ aria-label="Search session"+ className="border-input text-muted-foreground flex h-7 w-full items-center gap-2 rounded-sm border px-2 text-left font-mono text-xs"+ >+ <Search className="icon-base shrink-0" />+ <span+ className="truncate"+ title={+ props.state === "loaded" && props.search+ ? props.search+ : "Search session"+ }+ >+ {props.state === "loaded" && props.search+ ? props.search+ : "Search session"}+ </span>+ </button>+ </DialogTrigger>+ )}+ </DialogController>+ </div>+ <div className="hidden min-h-0 @3xl/session-workspace:block">+ <SessionConversationSidebar {...sidebarProps} />+ </div><divref={transcriptRef}- className="bg-card dark:bg-background session-review-stack:min-w-0 relative min-h-0 min-w-[320px]"+ className="bg-card dark:bg-background relative min-h-0 min-w-0"><style>{`::highlight(${highlightName}) { background-color: ${searchQuery ? "hsl(var(--find-match-background))" : "transparent"}; color: ${searchQuery ? "hsl(var(--foreground))" : "inherit"}; }`}</style><SessionConversationTimelinediff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.stories.tsx b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.stories.tsxindex 9e26d629f8..1d238d22e5 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.stories.tsx+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.stories.tsx@@ -159,7 +159,7 @@ export const SearchAndCollapse = meta.story({throw new globalThis.Error("Expected loaded sidebar");const canvas = within(canvasElement);const input = canvas.getByRole("textbox", {- name: "Search messages and tools",+ name: "Search session",});await userEvent.type(input, "Initialize");await expect(args.onSearchChange).toHaveBeenLastCalledWith("Initialize");diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.tsx b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.tsxindex 431b3a89bc..13a85a46f3 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.tsx+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationSidebar/SessionConversationSidebar.tsx@@ -43,9 +43,10 @@ export type SessionConversationSidebarTrace = {const EMPTY_TRACES: SessionConversationSidebarTrace[] = [];const SIDEBAR_AUTO_FOLLOW_IDLE_MS = 750;+const SIDEBAR_SCROLL_PADDING = 16;export function SessionConversationSidebar(- props:+ props: (| { state: "loading" }| {state: "loaded";@@ -63,7 +64,8 @@ export function SessionConversationSidebar(onVisibleTraceIdsChange: (traceIds: string[]) => void;isLoadingTranscripts: boolean;transcriptLoadError: boolean;- },+ }+ ) & { searchVisibility?: "hidden" },) {const traces = props.state === "loaded" ? props.traces : EMPTY_TRACES;const activeTraceId =@@ -140,6 +142,10 @@ export function SessionConversationSidebar(getScrollElement: () => listRef.current,estimateSize: () => 160,overscan: 5,+ paddingStart: SIDEBAR_SCROLL_PADDING,+ paddingEnd: SIDEBAR_SCROLL_PADDING,+ scrollPaddingStart: SIDEBAR_SCROLL_PADDING,+ scrollPaddingEnd: SIDEBAR_SCROLL_PADDING,getItemKey: (index) =>traces[index]?.itemId ?? traces[index]?.trace.id ?? index,onChange: (instance) => {@@ -159,6 +165,10 @@ export function SessionConversationSidebar(({ trace, itemId }) => (itemId ?? trace.id) === activeTraceId,): -1;+ const activeTraceSize = virtualizer+ .getVirtualItems()+ .find((item) => item.index === activeTraceIndex)?.size;+ const sidebarHeight = virtualizer.scrollRect?.height;const setListElement = useCallback((element: HTMLDivElement | null) => {listRef.current = element;@@ -169,10 +179,16 @@ export function SessionConversationSidebar(Date.now() < autoFollowPausedUntilRef.current)return;- // `auto` preserves the viewport when the active turn is already visible.- virtualizer.scrollToIndex(activeTraceIndex, { align: "auto" });+ const availableHeight =+ (sidebarHeight ?? element.clientHeight) - SIDEBAR_SCROLL_PADDING * 2;+ virtualizer.scrollToIndex(activeTraceIndex, {+ align:+ activeTraceSize !== undefined && activeTraceSize > availableHeight+ ? "start"+ : "auto",+ });},- [activeTraceIndex, virtualizer],+ [activeTraceIndex, activeTraceSize, sidebarHeight, virtualizer],);useLayoutEffect(() => {resumeAutoFollowRef.current = () => {@@ -205,14 +221,19 @@ export function SessionConversationSidebar(aria-busy="true"className="bg-background session-review-stack:border-r-0 session-review-stack:border-b relative flex h-full min-h-0 flex-col border-r">- <div className="shrink-0 border-b px-2 py-2.5">+ <div+ className={cn(+ "shrink-0 border-b px-2 py-2.5",+ props.searchVisibility === "hidden" && "hidden",+ )}+ ><div className="relative min-w-0"><Search className="icon-base text-foreground-tertiary absolute top-1/2 left-2 -translate-y-1/2" /><Inputdisabledvalue=""- aria-label="Search messages and tools"- placeholder="Search messages and tools"+ aria-label="Search session"+ placeholder="Search session"className="h-7 rounded-sm bg-transparent pl-7 font-mono text-xs"/></div>@@ -246,7 +267,12 @@ export function SessionConversationSidebar(aria-label="Session messages and tools"className="bg-background session-review-stack:border-r-0 session-review-stack:border-b relative flex h-full min-h-0 flex-col border-r">- <div className="shrink-0 border-b px-2 py-2.5">+ <div+ className={cn(+ "shrink-0 border-b px-2 py-2.5",+ props.searchVisibility === "hidden" && "hidden",+ )}+ ><div className="relative min-w-0"><Search className="icon-base text-foreground-tertiary absolute top-1/2 left-2 -translate-y-1/2" /><Input@@ -255,8 +281,8 @@ export function SessionConversationSidebar(virtualizer.scrollToOffset(0);props.onSearchChange(event.target.value);}}- aria-label="Search messages and tools"- placeholder="Search messages and tools"+ aria-label="Search session"+ placeholder="Search session"className="h-7 rounded-sm bg-transparent pl-7 font-mono text-xs"/></div>@@ -265,7 +291,7 @@ export function SessionConversationSidebar(ref={setListElement}role="region"aria-label="Session turns"- className="min-h-0 flex-1 overflow-y-auto pt-2.5 pb-4"+ className="min-h-0 flex-1 overflow-y-auto"onWheel={pauseAutoFollow}onTouchMove={pauseAutoFollow}onKeyDown={(event) => {@@ -426,6 +452,7 @@ export function SessionConversationSidebar(</h4>)}{groupConsecutiveTools(rows, {+ minGroupSize: 2,isTool: (row) =>props.search.trim() === "" &&row.role === "tool",diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/SessionConversationTimelineTrace.stories.tsx b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/SessionConversationTimelineTrace.stories.tsxindex 8cfeff35cc..8285a49246 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/SessionConversationTimelineTrace.stories.tsx+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/SessionConversationTimelineTrace.stories.tsx@@ -471,15 +471,10 @@ export const KeepDifferentToolData = meta.story({play: async ({ canvasElement }) => {const canvas = within(canvasElement);await expect(- canvas.getByRole("button", {+ canvas.queryByRole("button", {name: /^Show tools:.*search_documentation.*get_customer_profile/,}),- ).toBeInTheDocument();- await userEvent.click(- canvas.getByRole("button", {- name: /^Show tools:.*search_documentation.*get_customer_profile/,- }),- );+ ).not.toBeInTheDocument();await expect(canvas.getByRole("button", { name: "Expand search_documentation" }),).toBeInTheDocument();diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/SessionTranscriptContent.tsx b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/SessionTranscriptContent.tsxindex 872357f348..2e18b88d57 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/SessionTranscriptContent.tsx+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/SessionTranscriptContent.tsx@@ -11,6 +11,7 @@ import { SessionTimelineSystemMessage } from "@/src/features/sessions/componentsimport { SessionTimelineCollapsibleRow } from "@/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/components/SessionTimelineCollapsibleRow/SessionTimelineCollapsibleRow";import { formatIntervalSeconds } from "@/src/utils/dates";import { groupConsecutiveTools } from "@/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools";+import { cn } from "@/src/utils/tailwind";export function SessionTranscriptContent({result,@@ -44,12 +45,9 @@ export function SessionTranscriptContent({threadIndex === selectedThreadIndex,).map(({ threadIndex }) => (- <div- key={threadIndex}- className="space-y-4 [&>[data-session-system-row]:has(+[data-session-system-row])]:mb-1 [&>[data-session-tool-row]:has(+[data-session-tool-row])]:mb-1"- >+ <div key={threadIndex}>{selectedThreadIndex === undefined && visibleThreads.length > 1 && (- <h3 className="text-muted-foreground text-xs font-bold">+ <h3 className="text-muted-foreground mb-4 text-xs font-bold">Thread {threadIndex + 1}</h3>)}@@ -83,6 +81,7 @@ function SessionTranscriptThread({} | null;}) {const groups = groupConsecutiveTools(rows, {+ minGroupSize: 4,isTool: ({ row }) => row.type === "tool",getBoundary: ({ threadIndex }) => threadIndex,getToolName: ({ row }) =>@@ -91,28 +90,48 @@ function SessionTranscriptThread({: undefined,summaryBudget: 72,});- return groups.map((group) => {- if (group.type === "tools") {- return (+ const displayGroups = groups.map((group) => {+ if (group.type === "tools") return { group, isCompact: true };+ const { row } = group.row;+ if (row.type === "tool" || row.message.role === "system") {+ return { group, isCompact: true };+ }+ return {+ group,+ isCompact: row.message.parts.every((part) => part.type === "reasoning"),+ };+ });+ return displayGroups.map(({ group, isCompact }, index) => (+ <div+ key={group.type === "tools" ? group.rows[0]!.id : group.row.id}+ data-session-compact-row={isCompact ? "" : undefined}+ className={cn(+ index > 0 &&+ (() => {+ const previousIsCompact = displayGroups[index - 1]!.isCompact;+ if (isCompact && previousIsCompact) return "mt-1";+ if (!isCompact && !previousIsCompact) return "mt-4";+ return "mt-6";+ })(),+ )}+ >+ {group.type === "tools" ? (<SessionTranscriptToolGroup- key={group.rows[0]!.id}summary={group.summary}title={group.title}rows={group.rows}onOpenObservation={onOpenObservation}scrollTarget={scrollTarget}/>- );- }- return (- <SessionTranscriptRow- key={group.row.id}- item={group.row}- onOpenObservation={onOpenObservation}- scrollTarget={scrollTarget}- />- );- });+ ) : (+ <SessionTranscriptRow+ item={group.row}+ onOpenObservation={onOpenObservation}+ scrollTarget={scrollTarget}+ />+ )}+ </div>+ ));}function SessionTranscriptRow({diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/components/SessionTimelinePart/SessionTimelinePart.tsx b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/components/SessionTimelinePart/SessionTimelinePart.tsxindex 12b2330b18..a05c7cf5ab 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/components/SessionTimelinePart/SessionTimelinePart.tsx+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/components/SessionConversationTimeline/components/SessionConversationTimelineTrace/components/SessionTranscriptContent/components/SessionTimelinePart/SessionTimelinePart.tsx@@ -16,6 +16,14 @@ import { decodeUnicodeEscapesOnly } from "@/src/utils/unicode";function SessionTimelineReasoning({ part }: { part: ReasoningPart }) {const content = part.content;+ if (content.kind === "encrypted") {+ return (+ <span className="text-muted-foreground py-1 font-mono text-xs">+ Encrypted reasoning+ </span>+ );+ }+if (content.kind === "text") {return (<SessionTimelineCollapsiblePart@@ -25,6 +33,7 @@ function SessionTimelineReasoning({ part }: { part: ReasoningPart }) {><MarkdownViewmarkdown={decodeUnicodeEscapesOnly(content.text, true)}+ fallbackDisplay="collapsed"className="px-0 py-0"/></SessionTimelineCollapsiblePart>@@ -43,21 +52,21 @@ function SessionTimelineReasoning({ part }: { part: ReasoningPart }) {);}- return (- <SessionTimelineCollapsiblePart- label={- content.kind === "redacted"- ? "Redacted reasoning"- : "Encrypted reasoning"- }- variant="plain"- alignment="row"- >- <pre className="text-muted-foreground overflow-hidden font-mono text-xs break-all whitespace-pre-wrap">- {content.data}- </pre>- </SessionTimelineCollapsiblePart>- );+ if (content.kind === "redacted") {+ return (+ <SessionTimelineCollapsiblePart+ label="Redacted reasoning"+ variant="plain"+ alignment="row"+ >+ <pre className="text-muted-foreground overflow-hidden font-mono text-xs break-all whitespace-pre-wrap">+ {content.data}+ </pre>+ </SessionTimelineCollapsiblePart>+ );+ }++ return assertUnreachable(content);}function SessionTimelineFile({ part }: { part: FilePart }) {@@ -123,6 +132,7 @@ export function SessionTimelinePart({<div data-session-search-content><MarkdownViewmarkdown={decodeUnicodeEscapesOnly(part.text, true)}+ fallbackDisplay="collapsed"className="px-0 py-0"/></div>diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.clienttest.ts b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.clienttest.tsindex feef4ffb18..7e244805b5 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.clienttest.ts+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.clienttest.ts@@ -6,9 +6,46 @@ const options = {getBoundary: (row: { boundary: number }) => row.boundary,getToolName: (row: { name: string }) => row.name,summaryBudget: 36,+ minGroupSize: 2,};describe("groupConsecutiveTools", () => {+ it.each([1, 2, 3])(+ "keeps %i consecutive timeline tools ungrouped",+ (count) => {+ const rows = Array.from({ length: count }, (_, index) => ({+ role: "tool",+ name: `tool_${index}`,+ boundary: 0,+ }));+ expect(+ groupConsecutiveTools(rows, { ...options, minGroupSize: 4 }),+ ).toEqual(rows.map((row) => ({ type: "row", row })));+ },+ );++ it("groups four consecutive timeline tools", () => {+ const rows = Array.from({ length: 4 }, () => ({+ role: "tool",+ name: "read",+ boundary: 0,+ }));+ expect(+ groupConsecutiveTools(rows, { ...options, minGroupSize: 4 }),+ ).toEqual([{ type: "tools", rows, summary: "4x read", title: "4x read" }]);+ });++ it("keeps small sidebar groups grouped", () => {+ const rows = Array.from({ length: 2 }, () => ({+ role: "tool",+ name: "read",+ boundary: 0,+ }));+ expect(groupConsecutiveTools(rows, options)).toEqual([+ { type: "tools", rows, summary: "2x read", title: "2x read" },+ ]);+ });+it("fits measured glyph widths, including the conditional sidebar prefix", () => {const rows = ["iiii", "WWWW"].map((name) => ({role: "tool",diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.ts b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.tsindex b516cbabc0..19424d4746 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.ts+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/components/SessionConversationalView/fns/groupConsecutiveTools.ts@@ -5,6 +5,7 @@ export function groupConsecutiveTools<T>(getBoundary: (row: T) => string | number | undefined;getToolName: (row: T) => string | null | undefined;summaryBudget: number;+ minGroupSize: number;measureSummary?: (summary: string) => number;},) {@@ -28,8 +29,10 @@ export function groupConsecutiveTools<T>() {tools.push(rows[++index]!);}- if (tools.length === 1) {- groups.push({ type: "row", row });+ if (tools.length < options.minGroupSize) {+ for (const tool of tools) {+ groups.push({ type: "row", row: tool });+ }continue;}const counts = new Map<string, number>();diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.clienttest.ts b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.clienttest.tsindex 22fdad6742..c5b8821641 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.clienttest.ts+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.clienttest.ts@@ -52,6 +52,157 @@ const transcript = {>;describe("getSessionTranscriptRows", () => {+ it("hides protected Microsoft reasoning while preserving unprotected content", () => {+ const thread = transcript.threads[0]!;+ const protectedTranscript: NonNullable<+ RouterOutputs["events"]["transcriptByTraceId"]["transcript"]+ > = {+ threads: [+ {+ ...thread,+ currentTurn: {+ ...thread.currentTurn,+ messages: [+ {+ ...thread.currentTurn.messages[0]!,+ parts: [+ { type: "text", text: "Visible answer" },+ {+ type: "custom",+ kind: "Microsoft.Extensions.AI.TextReasoningContent",+ value: {+ content: {+ text: "",+ protectedData: "opaque-microsoft-payload",+ },+ },+ },+ {+ type: "custom",+ kind: "Microsoft.Extensions.AI.TextReasoningContent",+ value: { content: { text: "Readable reasoning" } },+ },+ {+ type: "custom",+ kind: "metadata",+ value: { content: { protectedData: "unrelated-field" } },+ },+ ],+ },+ ],+ },+ },+ ],+ };+ const rows = getSessionTranscriptRows(protectedTranscript);+ expect(rows[0]?.row.message.parts).toEqual([+ { type: "text", text: "Visible answer" },+ {+ type: "custom",+ kind: "Microsoft.Extensions.AI.TextReasoningContent",+ value: { content: { text: "Readable reasoning" } },+ },+ {+ type: "custom",+ kind: "metadata",+ value: { content: { protectedData: "unrelated-field" } },+ },+ ]);+ expect(JSON.stringify(rows)).not.toContain("opaque-microsoft-payload");+ protectedTranscript.threads[0]!.currentTurn.messages[0]!.parts = [+ {+ type: "custom",+ kind: "Microsoft.Extensions.AI.TextReasoningContent",+ value: { content: { protectedData: "opaque-microsoft-payload" } },+ },+ ];+ expect(getSessionTranscriptRows(protectedTranscript)).toEqual([]);+ });++ it("hides encrypted custom parts without changing remaining row IDs", () => {+ const thread = transcript.threads[0]!;+ const message = thread.currentTurn.messages[0]!;+ const encryptedTranscript = {+ threads: [+ {+ ...thread,+ currentTurn: {+ ...thread.currentTurn,+ messages: [+ {+ ...message,+ parts: [+ {+ type: "custom",+ kind: "encrypted_content",+ value: {+ type: "encrypted_content",+ encrypted_content: "opaque-payload",+ },+ },+ ],+ },+ ...thread.currentTurn.messages,+ ],+ },+ },+ ],+ } satisfies NonNullable<+ RouterOutputs["events"]["transcriptByTraceId"]["transcript"]+ >;+ const rows = getSessionTranscriptRows(encryptedTranscript);+ expect(rows.map(({ id }) => id)).toEqual(["0:1", "0:2", "0:3"]);+ expect(JSON.stringify(rows)).not.toContain("opaque-payload");+ });++ it("preserves readable parts and other custom content in mixed messages", () => {+ const thread = transcript.threads[0]!;+ const mixedTranscript: NonNullable<+ RouterOutputs["events"]["transcriptByTraceId"]["transcript"]+ > = {+ threads: [+ {+ ...thread,+ currentTurn: {+ ...thread.currentTurn,+ messages: [+ {+ ...thread.currentTurn.messages[0]!,+ parts: [+ { type: "text", text: "Visible answer" },+ {+ type: "custom",+ kind: "encrypted_content",+ value: { encrypted_content: "opaque-payload" },+ },+ {+ type: "custom",+ kind: "metadata",+ value: { confidence: 1 },+ },+ {+ type: "reasoning",+ content: { kind: "encrypted", data: "reasoning-payload" },+ },+ ],+ },+ ],+ },+ },+ ],+ };+ expect(+ getSessionTranscriptRows(mixedTranscript)[0]?.row.message.parts,+ ).toEqual([+ { type: "text", text: "Visible answer" },+ { type: "custom", kind: "metadata", value: { confidence: 1 } },+ {+ type: "reasoning",+ content: { kind: "encrypted", data: "reasoning-payload" },+ },+ ]);+ });+it("flattens visible threads with contiguous labels but original identities", () => {const base = transcript.threads[0]!;const entries = getSessionConversationEntries([diff --git a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.ts b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.tsindex 3f92ca0a12..a415e68952 100644--- a/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.ts+++ b/web/src/features/sessions/components/ConnectedModernSessionBodyTimeline/components/ConnectedSessionConversationTimeline/fns/getSessionTranscriptRows.ts@@ -11,11 +11,49 @@ export function getSessionTranscriptRows(...message,timing: { startTime: message.startTime, endTime: message.endTime },}));- return groupTranscriptMessages(messages).map((row, rowIndex) => ({- id: `${threadIndex}:${rowIndex}`,- threadIndex,- row,- }));+ return groupTranscriptMessages(messages).flatMap((row, rowIndex) => {+ // TODO: Consider excluding opaque encrypted parts during transcript generation instead.+ const parts = row.message.parts.filter((part) => {+ if (part.type !== "custom") return true;+ if (part.kind === "encrypted_content") {+ return false;+ }+ if (part.kind !== "Microsoft.Extensions.AI.TextReasoningContent") {+ return true;+ }+ const value = part.value;+ if (+ value === null ||+ typeof value !== "object" ||+ Array.isArray(value)+ ) {+ return true;+ }+ const content = value.content;+ if (+ content === null ||+ typeof content !== "object" ||+ Array.isArray(content)+ ) {+ return true;+ }+ if (+ typeof content.protectedData === "string" &&+ content.protectedData.length > 0+ ) {+ return false;+ }+ return true;+ });+ if (row.type === "message" && parts.length === 0) return [];+ return [+ {+ id: `${threadIndex}:${rowIndex}`,+ threadIndex,+ row: { ...row, message: { ...row.message, parts } },+ },+ ];+ });},);}diff --git a/web/src/features/sessions/hooks/useSessionConversationTimelineController.ts b/web/src/features/sessions/hooks/useSessionConversationTimelineController.tsindex ae8d944494..074b739362 100644--- a/web/src/features/sessions/hooks/useSessionConversationTimelineController.ts+++ b/web/src/features/sessions/hooks/useSessionConversationTimelineController.ts@@ -184,6 +184,13 @@ export function useSessionConversationTimelineController(): undefined;const mountedTarget = rowId || observationId ? row : entry;+ row+ ?.querySelectorAll<HTMLDetailsElement>(+ "details[data-markdown-fallback]",+ )+ .forEach((fallback) => {+ fallback.open = true;+ });const measurements = virtualizer.measurementsCache;const itemOffset = measurements[currentIndex]?.start;if (itemOffset === undefined) {