From 85951cb08614dfe6443905552cae49d59d2d6615 Mon Sep 17 00:00:00 2001 From: Aarav Sareen <96787824+arvsrn@users.noreply.github.com> Date: Fri, 20 Nov 2026 18:07:55 +0530 Subject: [PATCH] fix(session-ui): show subagent status as a colored bar and word in the New timeline (#65164) --- .../timeline-subagent-rows.spec.ts | 7 +- .../src/timeline-next/event-row.tsx | 42 +----- .../stories/subagent-status.stories.tsx | 132 ++++++++++++++++++ .../src/timeline-next/timeline-next.css | 46 ++---- 4 files changed, 147 insertions(+), 80 deletions(-) create mode 100644 packages/session-ui/src/timeline-next/stories/subagent-status.stories.tsx diff --git a/packages/session-ui/component-tests/timeline-subagent-rows.spec.ts b/packages/session-ui/component-tests/timeline-subagent-rows.spec.ts index 48664fc319b..bdaa3925327 100644 --- a/packages/session-ui/component-tests/timeline-subagent-rows.spec.ts +++ b/packages/session-ui/component-tests/timeline-subagent-rows.spec.ts @@ -2,7 +2,7 @@ import { expect, story } from "../../stories/playwright/story" const playground = "timeline-playground--playground" -story("a subagent row leads with its status chip", async ({ mount }) => { +story("a subagent row leads with its status", async ({ mount }) => { const timeline = await mount(playground, { args: { scenario: "Background work", activity: true } }) const rows = timeline.locator('[data-component="timeline-subagent"] > [data-slot="timeline-event-item"]') @@ -21,12 +21,13 @@ story("a subagent row leads with its status chip", async ({ mount }) => { await expect(rows.nth(3).locator("> *")).toHaveText(["Completed", "review Agent", "Review the theme store"]) }) -// The timeline is a list of events: a start keeps its ring even while its subagent has not reported back. +// The timeline is a list of events: a start stays a plain status even while its subagent has not reported back. story("a started subagent never spins", async ({ mount }) => { const timeline = await mount(playground, { args: { scenario: "Subagent between tools", activity: true } }) const status = timeline.locator('[data-component="timeline-subagent"] [data-slot="timeline-event-item-status"]') await expect(status).toHaveText("Started") - await expect(status.locator('svg[data-slot="timeline-event-item-glyph"] circle')).toHaveCount(1) + await expect(status).toHaveAttribute("data-state", "started") + await expect(status.locator("svg")).toHaveCount(0) await expect(status.locator('[data-component="session-progress-indicator-v2"]')).toHaveCount(0) }) diff --git a/packages/session-ui/src/timeline-next/event-row.tsx b/packages/session-ui/src/timeline-next/event-row.tsx index 76e25946e95..8c9f73d6967 100644 --- a/packages/session-ui/src/timeline-next/event-row.tsx +++ b/packages/session-ui/src/timeline-next/event-row.tsx @@ -1,6 +1,6 @@ import { Badge } from "@opencode/ui/badge" import { useI18n } from "@opencode/ui/context/i18n" -import { For, Match, Show, Switch, createMemo } from "solid-js" +import { For, Show, createMemo } from "solid-js" import { BasicTool } from "../components/basic-tool" import { useData } from "../context/data" import { taskAgentName } from "../tools/tool-renderer" @@ -134,10 +134,9 @@ export function TimelineEventItem(props: { event: TimelineEvent; onRevealShell?: open() }} > - {/* A subagent leads with its status chip. */} + {/* A subagent leads with its status. */} - {i18n.t(statusKeys[state()])} @@ -153,40 +152,3 @@ export function TimelineEventItem(props: { event: TimelineEvent; onRevealShell?: ) } - -/** The status chip's glyph: ring, ↻, ✓, ✕ or ■, drawn at 12px in the chip's text color. */ -function StatusGlyph(props: { state: SubagentState }) { - return ( - - ) -} diff --git a/packages/session-ui/src/timeline-next/stories/subagent-status.stories.tsx b/packages/session-ui/src/timeline-next/stories/subagent-status.stories.tsx new file mode 100644 index 00000000000..2fd2fdc1d2e --- /dev/null +++ b/packages/session-ui/src/timeline-next/stories/subagent-status.stories.tsx @@ -0,0 +1,132 @@ +import { For, type JSX } from "solid-js" +import { CurrentSessionProviders } from "../../storybook/current-session-story" +import { storyDocument } from "../../storybook/current-session-scenarios" +import { TimelineEventItem } from "../event-row" +import type { TimelineEvent } from "../events" + +/** + * The status a subagent row in the New timeline leads with, in each state it can show: started, updated (a + * follow-up to a running task), completed, failed and stopped. + */ +export default { + title: "OpenCode/Timeline/Subagent status", + id: "timeline-subagent-status", + parameters: { layout: "fullscreen" }, +} + +const subagent = (event: Omit): TimelineEvent => ({ kind: "subagent", ...event }) + +const states = [ + { + label: "Started", + event: subagent({ verb: "started", failed: false, agent: "explore", title: "Map the timeline grouping rules" }), + }, + { + label: "Updated", + event: subagent({ verb: "updated", failed: false, agent: "review", title: "Also check the RTL layout" }), + }, + { + label: "Completed (background)", + event: subagent({ verb: "finished", failed: false, agent: "test", title: "Run the focused timeline tests" }), + }, + { + label: "Completed (foreground)", + event: subagent({ verb: "ran", failed: false, agent: "build", title: "Regenerate the SDK" }), + }, + { + label: "Failed", + event: subagent({ verb: "finished", failed: true, agent: "test", title: "Run the e2e suite" }), + }, + { + label: "Stopped", + event: subagent({ verb: "stopped", failed: false, agent: "explore", title: "Search for unused exports" }), + }, +] + +const edges = [ + { + label: "Long title", + event: subagent({ + verb: "started", + failed: false, + agent: "explore", + title: + "Find every place the timeline projection groups tool calls, including the legacy renderer and the replay fixtures, and summarize how each handles background work", + }), + }, + { label: "No agent", event: subagent({ verb: "finished", failed: false, title: "Summarize the open issues" }) }, + { label: "No title", event: subagent({ verb: "stopped", failed: false, agent: "review" }) }, + { + label: "Right-to-left title", + event: subagent({ verb: "finished", failed: true, agent: "translator", title: "ترجمة سلاسل الواجهة إلى العربية" }), + }, +] + +function Timeline(props: { children: JSX.Element }) { + return ( + +
+ {props.children} +
+
+ ) +} + +function Section(props: { title: string; children: JSX.Element }) { + return ( +
+

{props.title}

+ {props.children} +
+ ) +} + +function Rows(props: { items: { label: string; event: TimelineEvent }[] }) { + return ( +
+ + {(item) => ( + <> + {item.label} +
+ +
+ + )} +
+
+ ) +} + +export const AllStates = { + render: () => ( + +
+ +
+
+ +
+
+ ), +} + +export const Narrow = { + render: () => ( +
+ +
+
+ + {(item) => ( +
+ +
+ )} +
+
+
+
+
+ ), +} diff --git a/packages/session-ui/src/timeline-next/timeline-next.css b/packages/session-ui/src/timeline-next/timeline-next.css index 8450470e7ba..85914475cc1 100644 --- a/packages/session-ui/src/timeline-next/timeline-next.css +++ b/packages/session-ui/src/timeline-next/timeline-next.css @@ -261,12 +261,6 @@ pointer-events: none; } - &:hover [data-slot="timeline-event-item-title"] { - text-decoration: underline; - text-decoration-color: color-mix(in oklch, currentColor 40%, transparent); - text-underline-offset: 2px; - } - &:focus-visible { outline: 2px solid var(--v2-border-border-focus); outline-offset: 2px; @@ -294,54 +288,42 @@ flex-shrink: 0; } - /* A subagent's status chip: its outline, fill and glyph say what happened, so no status word follows the title. - Updated is info blue softened toward muted; the others use their state colors as they are. */ + /* A subagent's status: a bar and word, in the state's color, say what happened, so no status word follows the + title. Updated is info blue softened toward muted; the others use their state colors as they are. */ [data-slot="timeline-event-item-status"] { - box-sizing: border-box; display: inline-flex; flex-shrink: 0; align-items: center; - gap: 4px; - height: 18px; - padding: 0 6px; - border: 1px solid transparent; - border-radius: 4px; - font-size: 12px; + gap: 6px; font-weight: 530; - line-height: 16px; white-space: nowrap; - [data-slot="timeline-event-item-glyph"] { + &::before { + content: ""; flex-shrink: 0; - width: 12px; - height: 12px; - margin-left: -1px; - color: currentColor; + width: 3px; + height: 10px; + border-radius: 999px; + background: currentColor; } &[data-state="started"] { - border-color: color-mix(in srgb, var(--v2-text-text-muted) 35%, transparent); color: var(--v2-text-text-faint); } &[data-state="updated"] { - border-style: dashed; - border-color: color-mix(in srgb, var(--v2-state-fg-info) 50%, transparent); color: color-mix(in srgb, var(--v2-state-fg-info) 70%, var(--v2-text-text-muted)); } &[data-state="completed"] { - background: color-mix(in srgb, var(--v2-state-fg-success) 16%, transparent); color: var(--v2-state-fg-success); } &[data-state="failed"] { - background: var(--v2-state-bg-danger); color: var(--v2-state-fg-danger); } &[data-state="stopped"] { - border-color: color-mix(in srgb, var(--v2-text-text-muted) 55%, transparent); color: var(--v2-text-text-muted); } } @@ -377,16 +359,6 @@ > [data-slot="timeline-event-item"] { gap: 8px; - margin-inline: -6px; - padding-inline: 6px; - border-radius: var(--radius-sm); - - @media (hover: hover) { - &:hover:not([aria-disabled]) { - cursor: pointer; - background-color: var(--v2-overlay-simple-overlay-hover); - } - } } }