Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(sessions): Change session timeline default view (#17412)

Ben Bachem40251ed249d7
diff --git a/web/src/features/filters/filter-integration.clienttest.ts b/web/src/features/filters/filter-integration.clienttest.ts
index 661de09bb5..eec433795d 100644
--- a/web/src/features/filters/filter-integration.clienttest.ts
+++ b/web/src/features/filters/filter-integration.clienttest.ts
@@ -933,6 +933,7 @@ describe("Saved view validation", () => {
const defaultPreset = getSessionDetailPresetToApply({
selectedViewId: null,
hasFilters: false,
+ isTimelineEnabled: false,
});
expect(defaultPreset).toEqual(SESSION_DETAIL_SYSTEM_PRESETS[0]);
expect(defaultPreset?.name).toBe("All observations with I/O");
@@ -962,12 +963,20 @@ describe("Saved view validation", () => {
const appliedFirstLlmCall = getSessionDetailPresetToApply({
selectedViewId: firstLlmCallPreset?.id ?? null,
hasFilters: false,
+ isTimelineEnabled: true,
});
const lastPreset = SESSION_DETAIL_SYSTEM_PRESETS.find(
(preset) => preset.name === "Last LLM Call per Trace",
);
expect(appliedFirstLlmCall).toEqual(firstLlmCallPreset);
+ expect(
+ getSessionDetailPresetToApply({
+ selectedViewId: null,
+ hasFilters: false,
+ isTimelineEnabled: true,
+ }),
+ ).toBeNull();
expect(firstLlmCallPreset?.filters).toEqual([
{
column: "type",
diff --git a/web/src/features/sessions/SessionPages.tsx b/web/src/features/sessions/SessionPages.tsx
index 3e7eb6b3a4..7b1a45abbc 100644
--- a/web/src/features/sessions/SessionPages.tsx
+++ b/web/src/features/sessions/SessionPages.tsx
@@ -1543,12 +1543,15 @@ const LoadedSessionEventsPage: React.FC<{
const presetToApply = getSessionDetailPresetToApply({
selectedViewId: null,
hasFilters: visibleFilterState.length > 0,
+ isTimelineEnabled: isSessionTimelineEnabled && isModernSessionEnabled,
});
if (!presetToApply) return;
applySystemPreset(presetToApply);
}, [
applySystemPreset,
arrivedOnVisitedHistoryEntry,
+ isModernSessionEnabled,
+ isSessionTimelineEnabled,
isViewLoading,
selectedViewId,
sessionId,
diff --git a/web/src/features/sessions/session-detail-presets.ts b/web/src/features/sessions/session-detail-presets.ts
index 7fb6cf3db8..b2699ea1a5 100644
--- a/web/src/features/sessions/session-detail-presets.ts
+++ b/web/src/features/sessions/session-detail-presets.ts
@@ -101,15 +101,18 @@ const getSessionDetailDefaultPreset = () => SESSION_DETAIL_SYSTEM_PRESETS[0];
/**
* Which system preset to auto-apply on load. A selected system preset (deep
- * link / saved view) is re-applied; a user's own filters win; otherwise the
- * default "All observations with I/O" view is applied.
+ * link / saved view) is re-applied; a user's own filters win; the legacy
+ * timeline otherwise defaults to "All observations with I/O" while the new
+ * timeline starts without a selected view.
*/
export const getSessionDetailPresetToApply = ({
selectedViewId,
hasFilters,
+ isTimelineEnabled,
}: {
selectedViewId: string | null;
hasFilters: boolean;
+ isTimelineEnabled: boolean;
}): SessionDetailSystemPreset | null => {
const selectedSystemPreset = SESSION_DETAIL_SYSTEM_PRESETS.find(
(preset) => preset.id === selectedViewId,
@@ -123,6 +126,10 @@ export const getSessionDetailPresetToApply = ({
return null;
}
+ if (isTimelineEnabled) {
+ return selectedSystemPreset ?? null;
+ }
+
return selectedSystemPreset ?? getSessionDetailDefaultPreset();
};