From 41d4a9c45cab93a55d390fc835d5441119ec3c4a Mon Sep 17 00:00:00 2001
From: Luke Parker <10430890+Hona@users.noreply.github.com>
Date: Tue, 29 Sep 2026 14:58:13 +1000
Subject: [PATCH] fix(session-ui): render moved notice as a timeline divider
(#52009)
---
.../session-timeline-notices.spec.ts | 10 ++---
.../src/components/timeline-separator.tsx | 43 +++++++++++++++++--
.../session-ui/src/timeline/projection.ts | 7 ++-
.../src/timeline/rows-current.test.ts | 34 +++++++++++++++
.../src/timeline/session-timeline-row.tsx | 26 +++--------
.../src/timeline/timeline-row.stories.tsx | 2 +-
6 files changed, 90 insertions(+), 32 deletions(-)
diff --git a/packages/session-ui/component-tests/session-timeline-notices.spec.ts b/packages/session-ui/component-tests/session-timeline-notices.spec.ts
index 3c18e403c6d..2a476c576af 100644
--- a/packages/session-ui/component-tests/session-timeline-notices.spec.ts
+++ b/packages/session-ui/component-tests/session-timeline-notices.spec.ts
@@ -1,7 +1,7 @@
import { expect, story } from "../../storybook/playwright/story"
// Moved from packages/app/e2e/regression/session-timeline-notices.spec.ts
-story("renders the moved location notice in its compact timeline style", async ({ mount, page }) => {
+story("renders the moved location notice as a timeline divider", async ({ mount, page }) => {
const directory = `/Users/usrnk1/Developer/opencode/${"nested-directory/".repeat(24)}session`
await page.setViewportSize({ width: 480, height: 720 })
const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "location" } })
@@ -14,12 +14,10 @@ story("renders the moved location notice in its compact timeline style", async (
await expect(value).toHaveText(directory)
await expect(notice).not.toContainText("ยท")
await expect(notice.locator("svg")).toHaveCount(0)
- await expect(notice).toHaveCSS("height", "28px")
- await expect(notice).toHaveCSS("gap", "8px")
- await expect(notice).toHaveCSS("padding-top", "4px")
- await expect(notice).toHaveCSS("padding-bottom", "4px")
+ await expect(notice).toHaveCSS("padding-top", "8px")
+ await expect(notice).toHaveCSS("padding-bottom", "8px")
await expect(label).toHaveCSS("font-size", "13px")
- await expect(label).toHaveCSS("font-weight", "530")
+ await expect(label).toHaveCSS("font-weight", "440")
await expect(label).toHaveCSS("line-height", "16px")
await expect(label).toHaveCSS("color", "rgb(128, 128, 128)")
await expect(value).toHaveCSS("font-size", "13px")
diff --git a/packages/session-ui/src/components/timeline-separator.tsx b/packages/session-ui/src/components/timeline-separator.tsx
index dfe1d0a5825..fdb3700e18a 100644
--- a/packages/session-ui/src/components/timeline-separator.tsx
+++ b/packages/session-ui/src/components/timeline-separator.tsx
@@ -1,7 +1,25 @@
import { ProviderIcon } from "@opencode/ui/provider-icon"
+import { Tooltip } from "@opencode/ui/tooltip"
import { Show } from "solid-js"
-export function TimelineSeparator(props: { label: string; providerID?: string; variant?: string }) {
+export function TimelineSeparator(props: {
+ label: string
+ value?: string
+ tooltip?: string
+ providerID?: string
+ variant?: string
+}) {
+ const label = () => (
+
+ {props.label}
+
+ )
return (
@@ -10,9 +28,26 @@ export function TimelineSeparator(props: { label: string; providerID?: string; v
{(providerID) =>
}
-
- {props.label}
-
+
+ {(tooltip) => (
+
+ {label()}
+
+ )}
+
+
+ {(value) => (
+
+ {value()}
+
+ )}
+
{(variant) => (
<>
diff --git a/packages/session-ui/src/timeline/projection.ts b/packages/session-ui/src/timeline/projection.ts
index effcaa9ba2f..a9f31918e2e 100644
--- a/packages/session-ui/src/timeline/projection.ts
+++ b/packages/session-ui/src/timeline/projection.ts
@@ -271,7 +271,12 @@ export namespace Timeline {
detail,
new Set(
messages
- .filter((message) => message.type === "compaction" || message.type === "model-switched")
+ .filter(
+ (message) =>
+ message.type === "compaction" ||
+ message.type === "model-switched" ||
+ message.type === "location-switched",
+ )
.map((message) => message.id),
),
)
diff --git a/packages/session-ui/src/timeline/rows-current.test.ts b/packages/session-ui/src/timeline/rows-current.test.ts
index 8571629a02f..7f6af683ba5 100644
--- a/packages/session-ui/src/timeline/rows-current.test.ts
+++ b/packages/session-ui/src/timeline/rows-current.test.ts
@@ -5,6 +5,7 @@ import type {
SessionMessageInfo,
} from "@opencode/client/promise"
import { storyDocument, storyTool } from "../storybook/current-session-scenarios"
+import { timelinePresets } from "./detail"
import { createTimelineProjection, Timeline, TimelineRow } from "./projection"
describe("current session timeline rows", () => {
@@ -333,6 +334,39 @@ describe("current session timeline rows", () => {
])
})
+ test("keeps divider notices outside grouped context rows", () => {
+ const source = [
+ { id: "msg_user", type: "user", text: "move", time: { created: 1 } },
+ {
+ id: "msg_assistant",
+ type: "assistant",
+ agent: "build",
+ model: { id: "model", providerID: "provider" },
+ content: [storyTool("tool_read", "read", "completed", {})],
+ time: { created: 2, completed: 3 },
+ },
+ { id: "msg_moved", type: "location-switched", location: { directory: "/tmp/next" }, time: { created: 4 } },
+ { id: "msg_skill", type: "skill", skill: "review", name: "Review", text: "instructions", time: { created: 5 } },
+ ] satisfies SessionMessageInfo[]
+ const rows = Timeline.constructSessionMessageRows(
+ source,
+ false,
+ { type: "idle" },
+ undefined,
+ false,
+ false,
+ undefined,
+ timelinePresets.find((preset) => preset.id === "compact")!.value,
+ ).rows
+
+ expect(rows.map(TimelineRow.key)).toEqual([
+ "user-message:msg_user",
+ "assistant-part:context:context:msg_assistant:tool_read",
+ "notice:msg_moved",
+ "assistant-part:context:message:msg_skill",
+ ])
+ })
+
test("keeps assistant errors and retries before later notices", () => {
const result = Timeline.constructSessionMessageRows(
[
diff --git a/packages/session-ui/src/timeline/session-timeline-row.tsx b/packages/session-ui/src/timeline/session-timeline-row.tsx
index ee677260e68..b56109cc7ab 100644
--- a/packages/session-ui/src/timeline/session-timeline-row.tsx
+++ b/packages/session-ui/src/timeline/session-timeline-row.tsx
@@ -5,7 +5,6 @@ import type {
SessionStatus,
} from "@opencode/client/promise"
import { useI18n } from "@opencode/ui/context/i18n"
-import { Tooltip } from "@opencode/ui/tooltip"
import { For, Show, createMemo, type Accessor, type JSX } from "solid-js"
import { Dynamic } from "solid-js/web"
import type { SessionUserActions, SessionUserAttachmentReference, SessionUserComment } from "../actions"
@@ -522,25 +521,12 @@ export function createSessionTimelineRowRenderer(input: {
}
>
{(message) => (
-
-
-
- {i18n.t("ui.sessionTimeline.notice.movedTo")}
-
- {" "}
-
- {message().location.directory}
-
+
+
)}
diff --git a/packages/session-ui/src/timeline/timeline-row.stories.tsx b/packages/session-ui/src/timeline/timeline-row.stories.tsx
index 3f8149c6fd9..31a03bc02c1 100644
--- a/packages/session-ui/src/timeline/timeline-row.stories.tsx
+++ b/packages/session-ui/src/timeline/timeline-row.stories.tsx
@@ -455,7 +455,7 @@ const MovedLocation = {
render: () => (