🪢 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(web): keep the session metrics bar above both sidebars (#17887)
Nikita Kabardin7365af408b9b
diff --git a/web/src/features/scores/components/AnnotateDrawerController.tsx b/web/src/features/scores/components/AnnotateDrawerController.tsxindex 0406cda4b9..49478a67b9 100644--- a/web/src/features/scores/components/AnnotateDrawerController.tsx+++ b/web/src/features/scores/components/AnnotateDrawerController.tsx@@ -11,6 +11,7 @@ import { type ScoreDomain } from "@langfuse/shared";import { type WithStringifiedMetadata } from "@/src/utils/clientSideDomainTypes";import { AnnotationPanelContent } from "./AnnotationPanelContent";import { useTraceReviewPanelOptional } from "@/src/features/traces/contexts/TraceReviewPanelContext";+import { useIsMobile } from "@/src/hooks/use-mobile";export type AnnotateDrawerControllerProps<Target extends ScoreTarget> = {children: (control: {@@ -22,7 +23,7 @@ export type AnnotateDrawerControllerProps<Target extends ScoreTarget> = {type AnnotateDrawerState = AnnotationPanelData;-type AnnotateDrawerPayload<Target extends ScoreTarget> =+export type AnnotateDrawerPayload<Target extends ScoreTarget> =Target extends Extract<ScoreTarget, { type: "trace" }>? Omit<AnnotateDrawerState, "scoreTarget" | "scores"> & {scoreTarget: Target;@@ -39,6 +40,7 @@ export function AnnotateDrawerController<Target extends ScoreTarget>({}: AnnotateDrawerControllerProps<Target>) {const capture = usePostHogClientCapture();const reviewPanel = useTraceReviewPanelOptional();+ const isMobile = useIsMobile();const triggerRef = useRef<HTMLElement | null>(null);const hasAccess = useHasProjectAccess({projectId,@@ -82,7 +84,8 @@ export function AnnotateDrawerController<Target extends ScoreTarget>({document.activeElement instanceof HTMLElement? document.activeElement: null;- if (reviewPanel) {+ // A phone uses the bottom sheet, whose height follows the form.+ if (reviewPanel && !isMobile) {reviewPanel.getState().actions.rememberTrigger(triggerRef.current);diff --git a/web/src/features/sessions/ConnectedModernSessionBodyLegacy.tsx b/web/src/features/sessions/ConnectedModernSessionBodyLegacy.tsxindex 1d5440f25d..59314c8374 100644--- a/web/src/features/sessions/ConnectedModernSessionBodyLegacy.tsx+++ b/web/src/features/sessions/ConnectedModernSessionBodyLegacy.tsx@@ -394,7 +394,7 @@ export function ConnectedModernSessionBodyLegacy({};return (- <div className="bg-background 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">+ <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">{tracesState.type === "loading" ? (<ModernSessionSidebar state="loading" />) : (@@ -421,7 +421,7 @@ export function ConnectedModernSessionBodyLegacy({}/>)}- <div className="bg-card dark:bg-background relative min-h-0 min-w-[320px]">+ <div className="bg-card dark:bg-background session-review-stack:min-w-0 relative min-h-0 min-w-[320px]"><divref={feedRef}className="h-full min-h-0 overflow-y-auto scroll-smooth"diff --git a/web/src/features/sessions/ConnectedModernSessionBodyTimeline.tsx b/web/src/features/sessions/ConnectedModernSessionBodyTimeline.tsxindex 62f1ceb645..d1bc600708 100644--- a/web/src/features/sessions/ConnectedModernSessionBodyTimeline.tsx+++ b/web/src/features/sessions/ConnectedModernSessionBodyTimeline.tsx@@ -405,7 +405,7 @@ export function ConnectedModernSessionBodyTimeline({};return (- <div className="bg-background 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">+ <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">{tracesState.type === "loading" ? (<ModernSessionSidebar state="loading" />) : (@@ -432,7 +432,7 @@ export function ConnectedModernSessionBodyTimeline({}/>)}- <div className="bg-card dark:bg-background relative min-h-0 min-w-[320px]">+ <div className="bg-card dark:bg-background session-review-stack:min-w-0 relative min-h-0 min-w-[320px]"><ConnectedSessionConversationTimelinetraces={timelineTraces}projectId={projectId}diff --git a/web/src/features/sessions/ModernSession.tsx b/web/src/features/sessions/ModernSession.tsxindex d7f017a707..9fc316263a 100644--- a/web/src/features/sessions/ModernSession.tsx+++ b/web/src/features/sessions/ModernSession.tsx@@ -5,6 +5,7 @@ import { ConnectedModernSessionBodyLegacy } from "@/src/features/sessions/Connecimport { ConnectedModernSessionBodyTimeline } from "@/src/features/sessions/ConnectedModernSessionBodyTimeline";import { ModernSessionFilterControls } from "@/src/features/sessions/ModernSessionFilterControls";import { ModernSessionHeader } from "@/src/features/sessions/ModernSessionHeader";+import { SessionReviewLeading } from "@/src/features/sessions/sessionReviewLeading";import { SessionMetadataJsonPathControl } from "@/src/features/sessions/SessionMetadataJsonPathControl";import {type EventSession,@@ -91,19 +92,21 @@ export function ModernSession({filterState={filterState}>{(metadataJsonPaths) => (- <ModernSessionHeader- projectId={projectId}- countTraces={session.countTraces}- traces={headerTraces}- tokensIn={session.inputUsage}- tokensOut={session.outputUsage}- totalTokens={session.totalTokens}- totalCost={session.totalCost ?? 0}- environment={session.environment ?? null}- users={session.users ?? []}- metadataJsonPaths={metadataJsonPaths}- scores={session.scores}- />+ <SessionReviewLeading>+ <ModernSessionHeader+ projectId={projectId}+ countTraces={session.countTraces}+ traces={headerTraces}+ tokensIn={session.inputUsage}+ tokensOut={session.outputUsage}+ totalTokens={session.totalTokens}+ totalCost={session.totalCost ?? 0}+ environment={session.environment ?? null}+ users={session.users ?? []}+ metadataJsonPaths={metadataJsonPaths}+ scores={session.scores}+ />+ </SessionReviewLeading>)}</SessionMetadataJsonPathControl><ModernSessionFilterControls {...filterControlsProps}>diff --git a/web/src/features/sessions/ModernSessionSidebar.tsx b/web/src/features/sessions/ModernSessionSidebar.tsxindex e5e8d05b46..ae410055c9 100644--- a/web/src/features/sessions/ModernSessionSidebar.tsx+++ b/web/src/features/sessions/ModernSessionSidebar.tsx@@ -445,7 +445,7 @@ export function ModernSessionSidebar(role="complementary"aria-label="Session observations"aria-busy="true"- className="bg-background relative flex h-full min-h-0 flex-col border-r"+ 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="flex shrink-0 items-center border-b px-2 py-2.5"><div className="bg-muted h-7 flex-1 animate-pulse rounded-sm" />@@ -502,7 +502,7 @@ export function ModernSessionSidebar(<divrole="complementary"aria-label="Session observations"- className="bg-background relative flex h-full min-h-0 flex-col border-r"+ 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"><div className="flex items-center gap-1 px-2 py-2.5">diff --git a/web/src/features/sessions/SessionPages.tsx b/web/src/features/sessions/SessionPages.tsxindex 57a6d54ba1..77a7aedade 100644--- a/web/src/features/sessions/SessionPages.tsx+++ b/web/src/features/sessions/SessionPages.tsx@@ -16,9 +16,16 @@ import { usdFormatter } from "@/src/utils/numbers";import { getNumberFromMap } from "@/src/utils/map-utils";import Link from "next/link";import { useRouter } from "next/router";-import React, { useEffect, useState, useCallback, useRef } from "react";+import React, {+ useEffect,+ useLayoutEffect,+ useState,+ useCallback,+ useRef,+} from "react";import { useVirtualizer } from "@tanstack/react-virtual";import { AnnotateDrawerController } from "@/src/features/scores";+import { type AnnotateDrawerPayload } from "@/src/features/scores/components/AnnotateDrawerController";import { ActionButtonCountBadge } from "@/src/components/ui/action-button-count-badge";import { Button } from "@/src/components/ui/button";import {@@ -317,6 +324,55 @@ const SessionScores = ({);};+type SessionAnnotatePayload = AnnotateDrawerPayload<{+ type: "session";+ sessionId: string;+}>;++// The mobile overflow menu unmounts its rows when it closes. The annotation+// sheet has to be owned outside that menu, or it closes with the menu.+function SessionAnnotateHost({+ projectId,+ openRef,+ onDisabledChange,+}: {+ projectId: string;+ openRef: React.RefObject<(payload: SessionAnnotatePayload) => void>;+ onDisabledChange: (disabled: boolean) => void;+}) {+ return (+ <AnnotateDrawerController projectId={projectId}>+ {({ disabled, openDrawer }) => (+ <SessionAnnotateBridge+ disabled={disabled}+ openDrawer={openDrawer}+ openRef={openRef}+ onDisabledChange={onDisabledChange}+ />+ )}+ </AnnotateDrawerController>+ );+}++function SessionAnnotateBridge({+ disabled,+ openDrawer,+ openRef,+ onDisabledChange,+}: {+ disabled: boolean;+ openDrawer: (payload: SessionAnnotatePayload) => void;+ openRef: React.RefObject<(payload: SessionAnnotatePayload) => void>;+ onDisabledChange: (disabled: boolean) => void;+}) {+ useLayoutEffect(() => {+ openRef.current = openDrawer;+ onDisabledChange(disabled);+ }, [disabled, onDisabledChange, openDrawer, openRef]);++ return null;+}+const CopySessionIdButton: React.FC<{sessionId: string;/** "menu" renders a full-width labeled row for the mobile ⋯ overflow;@@ -377,6 +433,10 @@ export const SessionPage: React.FC<{const capture = usePostHogClientCapture();const utils = api.useUtils();const isMobile = useIsMobile();+ const openAnnotateRef = useRef<(payload: SessionAnnotatePayload) => void>(+ () => {},+ );+ const [annotateDisabled, setAnnotateDisabled] = useState(true);const parentRef = useRef<HTMLDivElement>(null);const session = api.sessions.byIdWithScores.useQuery({@@ -539,6 +599,11 @@ export const SessionPage: React.FC<{: getCommentDrawerInitialStateFromUrl(router.query)}>+ <SessionAnnotateHost+ projectId={projectId}+ openRef={openAnnotateRef}+ onDisabledChange={setAnnotateDisabled}+ /><PageheaderProps={{title: sessionId,@@ -760,39 +825,35 @@ export const SessionPage: React.FC<{</Button>)}</CommentDrawerController>- <AnnotateDrawerController projectId={projectId}>- {({ disabled, openDrawer }) => (- <Button- variant="ghost"- size="sm"- disabled={disabled}- className="w-full justify-start gap-2 font-normal"- onClick={() => {- closeMenu({ handoffFocus: true });- openDrawer({- scoreTarget: { type: "session", sessionId },- scores: session.data?.scores ?? [],- analyticsData: {- type: "session",- source: "SessionDetail",- isV4: false,- },- scoreMetadata: {- projectId,- environment: session.data?.environment,- },- });- }}- >- {disabled ? (- <LockIcon className="h-3 w-3" />- ) : (- <SquarePen className="h-4 w-4" />- )}- <span className="text-sm">Annotate</span>- </Button>+ <Button+ variant="ghost"+ size="sm"+ disabled={annotateDisabled}+ className="w-full justify-start gap-2 font-normal"+ onClick={() => {+ closeMenu({ handoffFocus: true });+ openAnnotateRef.current({+ scoreTarget: { type: "session", sessionId },+ scores: session.data?.scores ?? [],+ analyticsData: {+ type: "session",+ source: "SessionDetail",+ isV4: false,+ },+ scoreMetadata: {+ projectId,+ environment: session.data?.environment,+ },+ });+ }}+ >+ {annotateDisabled ? (+ <LockIcon className="h-3 w-3" />+ ) : (+ <SquarePen className="h-4 w-4" />)}- </AnnotateDrawerController>+ <span className="text-sm">Annotate</span>+ </Button><AnnotationQueueItemDropdownMenuControllerprojectId={projectId}objectId={sessionId}@@ -1037,6 +1098,10 @@ const LoadedSessionEventsPage: React.FC<{projectId,});const isMobile = useIsMobile();+ const openAnnotateRef = useRef<(payload: SessionAnnotatePayload) => void>(+ () => {},+ );+ const [annotateDisabled, setAnnotateDisabled] = useState(true);const parentRef = useRef<HTMLDivElement>(null);const webCalloutAction = useWebCalloutAction({@@ -1617,6 +1682,11 @@ const LoadedSessionEventsPage: React.FC<{: getCommentDrawerInitialStateFromUrl(router.query)}>+ <SessionAnnotateHost+ projectId={projectId}+ openRef={openAnnotateRef}+ onDisabledChange={setAnnotateDisabled}+ /><PageheaderProps={{title: sessionId,@@ -1863,44 +1933,40 @@ const LoadedSessionEventsPage: React.FC<{</Button>)}</CommentDrawerController>- <AnnotateDrawerController projectId={projectId}>- {({ disabled, openDrawer }) => (- <Button- variant="ghost"- size="sm"- disabled={disabled}- className="w-full justify-start gap-2 font-normal"- onClick={() => {- closeMenu({ handoffFocus: true });- openDrawer({- scoreTarget: { type: "session", sessionId },- scores: session.scores,- analyticsData: {- type: "session",- source: "SessionDetail",- isV4: true,- },- scoreMetadata: {- projectId,- environment: session.environment,- },- });- }}- >- {disabled ? (- <LockIcon className="h-3 w-3" />- ) : (- <SquarePen className="h-4 w-4" />- )}- <span className="text-sm">Annotate</span>- {isModernSessionEnabled && annotationCount > 0 ? (- <span className="ml-1">- <ActionButtonCountBadge count={annotationCount} />- </span>- ) : null}- </Button>+ <Button+ variant="ghost"+ size="sm"+ disabled={annotateDisabled}+ className="w-full justify-start gap-2 font-normal"+ onClick={() => {+ closeMenu({ handoffFocus: true });+ openAnnotateRef.current({+ scoreTarget: { type: "session", sessionId },+ scores: session.scores,+ analyticsData: {+ type: "session",+ source: "SessionDetail",+ isV4: true,+ },+ scoreMetadata: {+ projectId,+ environment: session.environment,+ },+ });+ }}+ >+ {annotateDisabled ? (+ <LockIcon className="h-3 w-3" />+ ) : (+ <SquarePen className="h-4 w-4" />)}- </AnnotateDrawerController>+ <span className="text-sm">Annotate</span>+ {isModernSessionEnabled && annotationCount > 0 ? (+ <span className="ml-1">+ <ActionButtonCountBadge count={annotationCount} />+ </span>+ ) : null}+ </Button><AnnotationQueueItemDropdownMenuControllerprojectId={projectId}objectId={sessionId}diff --git a/web/src/features/sessions/SessionReviewWorkspace.clienttest.tsx b/web/src/features/sessions/SessionReviewWorkspace.clienttest.tsxindex e7c62ba3d2..e4e2f904c9 100644--- a/web/src/features/sessions/SessionReviewWorkspace.clienttest.tsx+++ b/web/src/features/sessions/SessionReviewWorkspace.clienttest.tsx@@ -13,6 +13,7 @@ import {TraceReviewPanelProvider,useTraceReviewPanel,} from "@/src/features/traces/contexts/TraceReviewPanelContext";+import { SessionReviewLeading } from "./sessionReviewLeading";import { SessionReviewWorkspace } from "./SessionReviewWorkspace";const { groupRef, router } = vi.hoisted(() => ({@@ -121,6 +122,9 @@ function Harness() {return (<TraceReviewPanelProvider projectId="project"><SessionReviewWorkspace projectId="project">+ <SessionReviewLeading>+ <div>Session metrics</div>+ </SessionReviewLeading><SessionContent /></SessionReviewWorkspace></TraceReviewPanelProvider>@@ -137,6 +141,7 @@ function resize(nextWidth: number) {beforeEach(() => {width = 1200;+ groupRef.current.setLayout.mockClear();vi.stubGlobal("ResizeObserver",class {@@ -172,6 +177,43 @@ afterEach(() => {});describe("session review workspace", () => {+ it("keeps session metrics above both panels and opens a narrow review column", async () => {+ render(<Harness />);+ fireEvent.click(screen.getByRole("button", { name: "Annotate session" }));++ const metrics = screen.getByText("Session metrics");+ const panels = screen.getByTestId("workspace-panels");+ expect(metrics.parentElement).toHaveClass("sticky");+ expect(metrics.parentElement?.nextElementSibling).toBe(panels);+ expect(panels.contains(metrics)).toBe(false);++ await waitFor(() => {+ const reviewSizes = groupRef.current.setLayout.mock.calls+ .map((call) => {+ const layout: { review?: number } = call[0] ?? {};+ return layout.review ?? 0;+ })+ .filter((review) => review > 0);+ expect(reviewSizes.at(-1)).toBe(32);+ });+ });++ it("keeps a wide workspace near the preferred review width", async () => {+ width = 3440;+ render(<Harness />);+ fireEvent.click(screen.getByRole("button", { name: "Annotate session" }));++ await waitFor(() => {+ const reviewSizes = groupRef.current.setLayout.mock.calls+ .map((call) => {+ const layout: { review?: number } = call[0] ?? {};+ return layout.review ?? 0;+ })+ .filter((review) => review > 0);+ expect(reviewSizes.at(-1)).toBe(11);+ });+ });+it("brings an opened stacked editor into its own scrollport", async () => {width = 320;const { container } = render(<Harness />);diff --git a/web/src/features/sessions/SessionReviewWorkspace.tsx b/web/src/features/sessions/SessionReviewWorkspace.tsxindex ceadd40198..c6af9a31fb 100644--- a/web/src/features/sessions/SessionReviewWorkspace.tsx+++ b/web/src/features/sessions/SessionReviewWorkspace.tsx@@ -1,11 +1,22 @@-import { useLayoutEffect, useRef, type ReactNode } from "react";+import { useLayoutEffect, useRef, useState, type ReactNode } from "react";import { Group, Panel, Separator, useGroupRef } from "react-resizable-panels";import { useStore } from "zustand";import { TraceReviewPanel } from "@/src/features/traces/components/TraceReviewPanel";import { useTraceReviewPanel } from "@/src/features/traces/contexts/TraceReviewPanelContext";+import { SessionReviewLeadingProvider } from "@/src/features/sessions/sessionReviewLeading";import { useElementSize } from "@/src/hooks/useElementSize";import { cn } from "@/src/utils/tailwind";+const DEFAULT_REVIEW_PANEL_WIDTH_PX = 380;++function reviewPanelPercent(available: number, preferredPx: number) {+ if (available <= 0) return 28;+ const percent = (preferredPx / available) * 100;+ // The pixel minSize on the panel keeps a narrow desktop usable. This floor+ // only stops a huge monitor from rounding the preferred width down to nothing.+ return Math.round(Math.min(45, Math.max(8, percent)));+}+export function SessionReviewWorkspace({projectId,children,@@ -17,25 +28,42 @@ export function SessionReviewWorkspace({const active = useStore(store, (state) => state.active);const open = active !== null;const [rootRef, size] = useElementSize<HTMLDivElement>();+ const leadingRef = useRef<HTMLDivElement>(null);const reviewRef = useRef<HTMLDivElement>(null);const groupRef = useGroupRef();+ const [leadingElement, setLeadingElement] = useState<HTMLElement | null>(+ null,+ );const vertical = (size?.width ?? 0) < 762;- const sessionMinimum = vertical ? "360px" : "400px";- const reviewMinimum = vertical ? "320px" : "360px";+ const sessionMinimum = vertical ? "220px" : "400px";+ const reviewMinimum = vertical ? "220px" : "320px";++ useLayoutEffect(() => {+ setLeadingElement(leadingRef.current);+ }, []);useLayoutEffect(() => {let cancelled = false;queueMicrotask(() => {if (cancelled) return;+ const bounds = rootRef.current?.getBoundingClientRect();+ const headerHeight = vertical+ ? (leadingRef.current?.offsetHeight ?? 0)+ : 0;+ const available = vertical+ ? Math.max(0, (bounds?.height ?? 0) - headerHeight)+ : (bounds?.width ?? 0);+ const preferred = vertical ? 280 : DEFAULT_REVIEW_PANEL_WIDTH_PX;+ const review = open ? reviewPanelPercent(available, preferred) : 0;groupRef.current?.setLayout({- session: open ? 60 : 100,- review: open ? 40 : 0,+ session: 100 - review,+ review,});});return () => {cancelled = true;};- }, [open, vertical, groupRef]);+ }, [open, vertical, groupRef, rootRef]);useLayoutEffect(() => {if (!active || !vertical) return;@@ -45,56 +73,66 @@ export function SessionReviewWorkspace({if (!root || !review) return;const offset =review.getBoundingClientRect().top - root.getBoundingClientRect().top;+ const headerHeight = leadingRef.current?.offsetHeight ?? 0;+ const visibleHeight = Math.max(0, root.clientHeight - headerHeight);root.scrollTop +=- offset - Math.max(0, root.clientHeight - review.clientHeight);+ offset -+ headerHeight -+ Math.max(0, visibleHeight - review.clientHeight);});return () => cancelAnimationFrame(frame);}, [active, vertical, rootRef]);return (- <div- ref={rootRef}- className="h-full min-h-0 min-w-0 overflow-y-auto"- data-trace-review-open={open || undefined}- data-review-orientation={vertical ? "vertical" : "horizontal"}- >- <Group- groupRef={groupRef}- orientation={vertical ? "vertical" : "horizontal"}- className={cn(- "h-full min-h-0 min-w-0",- open && (vertical ? "min-h-[681px]" : "min-h-[320px]"),- )}+ <SessionReviewLeadingProvider element={leadingElement}>+ <div+ ref={rootRef}+ className="flex h-full min-h-0 min-w-0 flex-col overflow-y-auto"+ data-trace-review-open={open || undefined}+ data-review-orientation={vertical ? "vertical" : "horizontal"}>- <Panel- id="session"- defaultSize="100%"- minSize={open ? sessionMinimum : "0%"}- >- <div className="@container/session-workspace h-full min-h-0 min-w-0">- {children}- </div>- </Panel>- <Separator- disabled={!open}- aria-label="Resize review panel"+ <div+ ref={leadingRef}+ className="bg-header sticky top-0 z-30 w-full shrink-0 empty:hidden"+ />+ <Group+ groupRef={groupRef}+ orientation={vertical ? "vertical" : "horizontal"}className={cn(- "bg-border",- vertical ? "h-px" : "w-px",- !open && "hidden",+ "min-h-0 w-full min-w-0 flex-1",+ open && (vertical ? "min-h-[441px]" : "min-h-[320px]"),)}- />- <Panel- id="review"- defaultSize="0%"- minSize={open ? reviewMinimum : "0%"}- maxSize={open ? "75%" : "0%"}>- <div ref={reviewRef} className="h-full min-h-0" hidden={!open}>- <TraceReviewPanel projectId={projectId} />- </div>- </Panel>- </Group>- </div>+ <Panel+ id="session"+ defaultSize="100%"+ minSize={open ? sessionMinimum : "0%"}+ >+ <div className="@container/session-workspace h-full min-h-0 min-w-0">+ {children}+ </div>+ </Panel>+ <Separator+ disabled={!open}+ aria-label="Resize review panel"+ className={cn(+ "bg-border",+ vertical ? "h-px" : "w-px",+ !open && "hidden",+ )}+ />+ <Panel+ id="review"+ defaultSize="0%"+ minSize={open ? reviewMinimum : "0%"}+ maxSize={open ? "75%" : "0%"}+ >+ <div ref={reviewRef} className="h-full min-h-0" hidden={!open}>+ <TraceReviewPanel projectId={projectId} />+ </div>+ </Panel>+ </Group>+ </div>+ </SessionReviewLeadingProvider>);}diff --git a/web/src/features/sessions/sessionReviewLeading.tsx b/web/src/features/sessions/sessionReviewLeading.tsxnew file mode 100644index 0000000000..e50e1cbdc7--- /dev/null+++ b/web/src/features/sessions/sessionReviewLeading.tsx@@ -0,0 +1,25 @@+import { createContext, useContext, type ReactNode } from "react";+import { createPortal } from "react-dom";++const SessionReviewLeadingContext = createContext<HTMLElement | null>(null);++export function SessionReviewLeadingProvider({+ element,+ children,+}: {+ element: HTMLElement | null;+ children: ReactNode;+}) {+ return (+ <SessionReviewLeadingContext.Provider value={element}>+ {children}+ </SessionReviewLeadingContext.Provider>+ );+}++/** Renders above the session/review split when a workspace provides a slot. */+export function SessionReviewLeading({ children }: { children: ReactNode }) {+ const target = useContext(SessionReviewLeadingContext);+ if (!target) return children;+ return createPortal(children, target);+}diff --git a/web/src/styles/globals.css b/web/src/styles/globals.cssindex b8704f76b7..71b3aaba0d 100644--- a/web/src/styles/globals.css+++ b/web/src/styles/globals.css@@ -8,6 +8,8 @@@plugin "tailwindcss-animate";@custom-variant dark (&:where(.dark, .dark *));+/* Session metrics bar is open above a stacked annotation column. */+@custom-variant session-review-stack (&:is([data-trace-review-open][data-review-orientation=vertical] *));/* App font tokens. The typeface is deliberately DEFERRED: the app ships thesystem stacks while the token system (families here, weight roles below,