Skip to content
TypeScript

feat(web): add compact thread list mode (#9417)

Alex Southwell77bca8b2d76a
diff --git a/apps/desktop/src/settings/DesktopClientSettings.test.ts b/apps/desktop/src/settings/DesktopClientSettings.test.ts
index 53044dcf7e5..5ad23ee7058 100644
--- a/apps/desktop/src/settings/DesktopClientSettings.test.ts
+++ b/apps/desktop/src/settings/DesktopClientSettings.test.ts
@@ -57,6 +57,7 @@ const clientSettings: ClientSettings = {
proactivePanelsEnabled: true,
showSkillsInSlashMenu: false,
providerModelPreferences: {},
+ sidebarCompactThreadRows: false,
sidebarProjectGroupingMode: "repository_path",
sidebarProjectGroupingOverrides: {
"environment-1:/tmp/project-a": "separate",
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index a86bb9a3868..ea25b5c2c5c 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -124,6 +124,7 @@ import { startNewThreadFromContext } from "../lib/chatThreadActions";
import { useClientSettings } from "../hooks/useSettings";
import { useCopyToClipboard } from "../hooks/useCopyToClipboard";
import { useLocalStorage } from "../hooks/useLocalStorage";
+import { SidebarCompletedTime } from "./sidebar/SidebarCompletedTime";
import { useNowMinute } from "../hooks/useNowMinute";
import { useEnvironments, usePrimaryEnvironmentId } from "../state/environments";
import {
@@ -1031,6 +1032,7 @@ const dropVerbBadge: Record<SidebarDropVerb, ReactNode> = {
const SidebarThreadRow = memo(function SidebarThreadRow(props: {
thread: SidebarThreadSummary;
variant: "card" | "slim";
+ compact: boolean;
// Slim rows are either settled (action: un-settle) or merely quiet
// (seen Ready threads — action: settle).
variantAction: "settle" | "unsettle" | "unsnooze";
@@ -1292,7 +1294,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
terminalStatus={terminalStatus}
terminalProcessCount={terminalProcessCount}
compactStatus={
- compact
+ compact || (props.compact && variant === "card")
? (topStatus?.label ??
(variantAction === "unsnooze"
? "Snoozed"
@@ -1878,6 +1880,22 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
);
}
+ const compactRows = props.compact;
+ const CompactStatusIcon = topStatus
+ ? {
+ working: CircleDashedIcon,
+ monitoring: EyeIcon,
+ approval: ShieldQuestionIcon,
+ input: MessageCircleQuestionIcon,
+ failed: CircleAlertIcon,
+ woke: AlarmClockIcon,
+ done: CircleCheckIcon,
+ }[topStatus.icon]
+ : null;
+ const compactCompletedAt =
+ compactRows && status === "ready" && !isWokeStatus
+ ? (thread.latestTurn?.completedAt ?? null)
+ : null;
const diff = latestTurnDiff(thread);
return (
@@ -1886,8 +1904,10 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
{...sortableRootProps}
{...(fileDropHandlers ?? {})}
className={cn(
- // Matches the h-[4.875rem] content box; the py-0.5 padding is added on top.
- "list-none py-0.5 [content-visibility:auto] [contain-intrinsic-size:auto_78px]",
+ "list-none [content-visibility:auto]",
+ compactRows
+ ? "[contain-intrinsic-size:auto_36px]"
+ : "py-0.5 [contain-intrinsic-size:auto_78px]",
sortable?.isDragging && "relative z-20",
)}
>
@@ -1902,7 +1922,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
ref={rowRef}
role="button"
tabIndex={0}
- data-testid="sidebar-row-card"
+ data-testid={compactRows ? "sidebar-row-compact" : "sidebar-row-card"}
aria-busy={isRegeneratingTitle || undefined}
className={rowSurfaceClassName}
onClick={handleClick}
@@ -1912,13 +1932,22 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
/>
}
>
- <div className="relative z-10 h-[4.875rem] px-[var(--sidebar-row-content-inset)] py-[var(--sidebar-content-inset)]">
- <div className="flex h-5 min-w-0 items-center gap-1.5">
+ <div
+ className={cn(
+ "relative z-10",
+ compactRows
+ ? "flex h-9 items-center px-2.5"
+ : "h-[4.875rem] px-[var(--sidebar-row-content-inset)] py-[var(--sidebar-content-inset)]",
+ )}
+ >
+ <div className="flex h-5 w-full min-w-0 items-center gap-1.5">
{draftIndicator}
{props.project ? (
<ProjectFavicon project={props.project} className="size-4 shrink-0" />
) : null}
- {props.projectDisplayName ? (
+ {compactRows ? (
+ title
+ ) : props.projectDisplayName ? (
<span
className={cn(
"min-w-0 flex-1 truncate text-secondary-label text-xs",
@@ -1931,6 +1960,50 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
<span className="flex-1" />
)}
{pinIndicator}
+ {compactRows ? (
+ <>
+ {isRemote ? (
+ <span
+ role="img"
+ aria-label={props.environmentLabel ?? "Remote environment"}
+ className="inline-flex shrink-0 text-sidebar-muted-foreground/70"
+ >
+ <EnvironmentMachineIcon
+ kind={props.environmentMachine}
+ className="size-3.5"
+ />
+ </span>
+ ) : null}
+ {terminalStatusIcon}
+ {topStatus && CompactStatusIcon ? (
+ isWokeStatus ? (
+ <button
+ type="button"
+ aria-label="Dismiss Woke notification"
+ onClick={handleAcknowledgeWokeClick}
+ className={cn(
+ "shrink-0 rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ topStatus.className,
+ )}
+ >
+ <CompactStatusIcon aria-hidden className="size-3.5" />
+ <span role="status" className="sr-only">
+ {topStatus.label}
+ </span>
+ </button>
+ ) : (
+ <span
+ role="status"
+ className={cn("inline-flex shrink-0", topStatus.className)}
+ >
+ <CompactStatusIcon aria-hidden className="size-3.5" />
+ <span className="sr-only">{topStatus.label}</span>
+ </span>
+ )
+ ) : null}
+ {prBadge}
+ </>
+ ) : null}
{/* The visible state owns this slot's width: status at rest,
actions on hover/keyboard focus or while the popover is open. Keeping
the hidden state out of flow lets the project label reclaim
@@ -1938,20 +2011,33 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
{sortable?.isDragging ? (
dragDestination
) : (
- <span className="group/sidebar-status-slot relative ml-auto flex h-5 min-w-8 shrink-0 items-stretch justify-end text-xs">
+ <span
+ className={cn(
+ "group/sidebar-status-slot relative ml-auto flex h-5 shrink-0 items-stretch justify-end text-xs",
+ !compactRows && "min-w-8",
+ )}
+ >
{/* Read-only status labels yield to the hover actions. Woke is
itself an action, so it stays pointer-enabled and visible
while the other controls appear beside it. */}
<span
className={cn(
- isWokeStatus
+ isWokeStatus && !compactRows
? "pointer-events-auto"
: "pointer-events-none group-has-[:focus-visible]/sidebar-status-slot:absolute group-has-[:focus-visible]/sidebar-status-slot:right-0 group-has-[:focus-visible]/sidebar-status-slot:opacity-0 group-hover/sidebar-row:absolute group-hover/sidebar-row:right-0 group-hover/sidebar-row:opacity-0",
"flex items-center self-center justify-self-end tabular-nums text-secondary-label transition-opacity",
snoozeMenuOpen && "pointer-events-none absolute right-0 opacity-0",
)}
>
- {topStatus ? (
+ {compactRows ? (
+ status === "working" ? (
+ <WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />
+ ) : compactCompletedAt ? (
+ <SidebarCompletedTime completedAt={compactCompletedAt} />
+ ) : (
+ threadTimeLabel(thread)
+ )
+ ) : topStatus ? (
isWokeStatus ? (
<Tooltip>
<TooltipTrigger
@@ -2057,7 +2143,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
}
>
<CheckIcon className="size-3.5" />
- Settle
+ {compactRows ? null : "Settle"}
</TooltipTrigger>
<TooltipPopup>Settle thread</TooltipPopup>
</Tooltip>
@@ -2067,68 +2153,70 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
</span>
)}
</div>
- <div className="mt-1 flex min-w-0">
- {title}
- {isRegeneratingTitle ? (
- <span role="status" className="sr-only">
- Regenerating title
- </span>
- ) : null}
- </div>
- <div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-secondary-label text-xs">
- {/* Always the branch. The plan step used to take this slot while
+ {isRegeneratingTitle ? (
+ <span role="status" className="sr-only">
+ Regenerating title
+ </span>
+ ) : null}
+ {compactRows ? null : (
+ <>
+ <div className="mt-1 flex min-w-0">{title}</div>
+ <div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-secondary-label text-xs">
+ {/* Always the branch. The plan step used to take this slot while
working, but it truncated to a half-sentence and dropped the
branch, so the row lost its most stable identifier. */}
- {thread.branch ? (
- <>
- <ThreadWorktreeIndicator thread={thread} />
- <span className="min-w-0 flex-1 truncate whitespace-nowrap text-muted-foreground/40">
- {thread.branch}
- </span>
- </>
- ) : (
- <span className="flex-1" />
- )}
- {terminalStatusIcon}
- {prBadge}
- {diff ? (
- <span className="shrink-0 font-mono">
- <span className="text-diff-addition-foreground">+{diff.insertions}</span>{" "}
- <span className="text-diff-deletion-foreground">−{diff.deletions}</span>
- </span>
- ) : null}
- <span
- aria-hidden
- className="pointer-events-none ml-auto inline-flex shrink-0 items-center gap-1"
- >
- {isRemote ? (
- <span className="inline-flex shrink-0 items-center text-sidebar-muted-foreground/70">
- <EnvironmentMachineIcon
- aria-hidden
- kind={props.environmentMachine}
- className="size-3.5"
- />
- </span>
- ) : null}
- {driverKind ? (
- <span className="inline-flex shrink-0 items-center">
- <ProviderInstanceIcon
- driverKind={driverKind}
- displayName={
- providerEntry?.displayName ??
- thread.session?.providerName ??
- modelInstanceId
- }
- accentColor={providerEntry?.accentColor}
- showBadge={showInstanceBadge}
- // Glyph dims, badge stays saturated; offset matches the composer trigger.
- iconClassName="size-3.5 opacity-60"
- badgeClassName="right-[-0.1875rem] bottom-[-0.1875rem] h-3 min-w-3 px-0.5 text-[7px]"
- />
+ {thread.branch ? (
+ <>
+ <ThreadWorktreeIndicator thread={thread} />
+ <span className="min-w-0 flex-1 truncate whitespace-nowrap text-muted-foreground/40">
+ {thread.branch}
+ </span>
+ </>
+ ) : (
+ <span className="flex-1" />
+ )}
+ {terminalStatusIcon}
+ {prBadge}
+ {diff ? (
+ <span className="shrink-0 font-mono">
+ <span className="text-diff-addition-foreground">+{diff.insertions}</span>{" "}
+ <span className="text-diff-deletion-foreground">−{diff.deletions}</span>
+ </span>
+ ) : null}
+ <span
+ aria-hidden
+ className="pointer-events-none ml-auto inline-flex shrink-0 items-center gap-1"
+ >
+ {isRemote ? (
+ <span className="inline-flex shrink-0 items-center text-sidebar-muted-foreground/70">
+ <EnvironmentMachineIcon
+ aria-hidden
+ kind={props.environmentMachine}
+ className="size-3.5"
+ />
+ </span>
+ ) : null}
+ {driverKind ? (
+ <span className="inline-flex shrink-0 items-center">
+ <ProviderInstanceIcon
+ driverKind={driverKind}
+ displayName={
+ providerEntry?.displayName ??
+ thread.session?.providerName ??
+ modelInstanceId
+ }
+ accentColor={providerEntry?.accentColor}
+ showBadge={showInstanceBadge}
+ // Glyph dims, badge stays saturated; offset matches the composer trigger.
+ iconClassName="size-3.5 opacity-60"
+ badgeClassName="right-[-0.1875rem] bottom-[-0.1875rem] h-3 min-w-3 px-0.5 text-[7px]"
+ />
+ </span>
+ ) : null}
</span>
- ) : null}
- </span>
- </div>
+ </div>
+ </>
+ )}
</div>
{props.jumpLabel ? <JumpHintBadge label={props.jumpLabel} /> : null}
</TooltipTrigger>
@@ -2303,6 +2391,7 @@ export default function Sidebar() {
const compact = compactEnabled && sidebarState === "collapsed" && !isMobile;
const [snoozedFooter, setSnoozedFooter] = useState<HTMLUListElement | null>(null);
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
+ const compactThreadRows = useClientSettings((s) => s.sidebarCompactThreadRows);
const confirmThreadDelete = useClientSettings((s) => s.confirmThreadDelete);
const confirmThreadArchive = useClientSettings((s) => s.confirmThreadArchive);
const sidebarProjectSortOrder = useClientSettings((s) => s.sidebarProjectSortOrder);
@@ -4829,10 +4918,9 @@ export default function Sidebar() {
const threadKey = scopedThreadKey(
scopeThreadRef(thread.environmentId, thread.id),
);
- // Settled and snoozed are the ONLY things that collapse a
- // row: every other thread is a full card. Density comes
- // from users (or the auto rules) actually parking work,
- // not from the sidebar second-guessing what still matters.
+ // Settled and snoozed always use slim rows. Active and
+ // pinned threads use cards unless the user has explicitly
+ // enabled the compact thread-list preference.
const isCard = section === "active" || section === "pinned";
const rowVariant = isCard ? "card" : "slim";
return (
@@ -4842,6 +4930,7 @@ export default function Sidebar() {
key={`${threadKey}:${rowVariant}`}
thread={thread}
variant={rowVariant}
+ compact={compactThreadRows}
// Snoozed rows wake, settled rows un-settle, and cards settle.
variantAction={
section === "snoozed"
diff --git a/apps/web/src/components/settings/CompactSidebarPreview.tsx b/apps/web/src/components/settings/CompactSidebarPreview.tsx
index 49fb0754e01..4d1e861d14e 100644
--- a/apps/web/src/components/settings/CompactSidebarPreview.tsx
+++ b/apps/web/src/components/settings/CompactSidebarPreview.tsx
@@ -1,9 +1,30 @@
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { cn } from "~/lib/utils";
-export function CompactSidebarPreview() {
+export function CompactSidebarPreview({
+ railEnabled,
+ compactRows,
+}: {
+ railEnabled: boolean;
+ compactRows: boolean;
+}) {
const [collapsed, setCollapsed] = useState(false);
+ const sidebarRef = useRef<HTMLSpanElement>(null);
+
+ useEffect(() => {
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
+ const animation = sidebarRef.current?.animate(
+ [
+ { width: "36px", offset: 0 },
+ { width: railEnabled ? "12px" : "0px", offset: 0.45 },
+ { width: railEnabled ? "12px" : "0px", offset: 0.6 },
+ { width: "36px", offset: 1 },
+ ],
+ { duration: 800, easing: "ease-in-out" },
+ );
+ return () => animation?.cancel();
+ }, [railEnabled, compactRows]);
return (
<button
@@ -11,24 +32,31 @@ export function CompactSidebarPreview() {
aria-label="Toggle compact sidebar preview"
aria-pressed={collapsed}
className="group/compact-preview relative flex h-10 w-full cursor-pointer overflow-hidden rounded-lg border border-border bg-background p-1 shadow-xs/5 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background"
- onClick={() => setCollapsed((value) => !value)}
+ onClick={() => {
+ sidebarRef.current?.getAnimations().forEach((animation) => animation.cancel());
+ setCollapsed((value) => !value);
+ }}
>
<span
+ ref={sidebarRef}
aria-hidden
className={cn(
- "flex h-full shrink-0 flex-col justify-center gap-1 overflow-hidden rounded-md bg-sidebar px-1 transition-[width] duration-250 ease-out motion-reduce:transition-none",
- collapsed ? "w-3" : "w-9",
+ "flex h-full shrink-0 flex-col justify-center gap-1 overflow-hidden rounded-md bg-sidebar transition-[width] duration-250 ease-out motion-reduce:transition-none",
+ collapsed ? (railEnabled ? "w-3" : "w-0") : "w-9",
)}
>
- {[0, 1, 2].map((row) => (
- <span key={row} className="flex h-1 shrink-0 items-center gap-1">
+ {(compactRows ? [0, 1, 2, 3] : [0, 1, 2]).map((row) => (
+ <span key={row} className="flex shrink-0 items-start gap-1 px-1">
<span className="size-1 shrink-0 rounded-[1px] bg-muted-foreground/50" />
<span
className={cn(
- "h-0.5 w-4 shrink-0 rounded-full bg-muted-foreground/25 transition-opacity duration-250 ease-out motion-reduce:transition-none",
+ "flex shrink-0 flex-col gap-0.5 transition-opacity duration-250 ease-out motion-reduce:transition-none",
collapsed && "opacity-0",
)}
- />
+ >
+ <span className="h-0.5 w-4 rounded-full bg-muted-foreground/25" />
+ {!compactRows && <span className="h-0.5 w-2 rounded-full bg-muted-foreground/15" />}
+ </span>
</span>
))}
</span>
@@ -42,6 +70,7 @@ export function CompactSidebarPreview() {
className={cn(
"pointer-events-none absolute top-3 left-5 flex w-9 flex-col gap-1 rounded-sm border border-border bg-popover p-1 opacity-0 shadow-xs transition-opacity duration-150 ease-out motion-reduce:transition-none",
collapsed &&
+ railEnabled &&
"group-hover/compact-preview:opacity-100 group-focus-visible/compact-preview:opacity-100",
)}
>
diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx
index 92a6e437d66..67a20b31ecd 100644
--- a/apps/web/src/components/settings/SettingsPanels.tsx
+++ b/apps/web/src/components/settings/SettingsPanels.tsx
@@ -502,7 +502,8 @@ export function useSettingsRestore(onRestored?: () => void) {
...(theme !== "system" ? ["Theme"] : []),
...(!followSystem ? ["Follow system"] : []),
...(themeHalves !== null ? ["Theme mix"] : []),
- ...(settings.compactSidebarEnabled !== DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled
+ ...(settings.compactSidebarEnabled !== DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled ||
+ settings.sidebarCompactThreadRows !== DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows
? ["Compact sidebar"]
: []),
...(settings.appearanceContrast !== DEFAULT_UNIFIED_SETTINGS.appearanceContrast
@@ -644,6 +645,7 @@ export function useSettingsRestore(onRestored?: () => void) {
settings.continueThreadsAfterServerUpdate,
settings.sidebarAutoSettleAfterDays,
settings.sidebarAutoSettleOnMerge,
+ settings.sidebarCompactThreadRows,
settings.sidebarProjectGroupingMode,
settings.sidebarThreadPreviewCount,
settings.showSkillsInSlashMenu,
@@ -739,6 +741,7 @@ export function useSettingsRestore(onRestored?: () => void) {
panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,
sidebarThreadPreviewCount: DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount,
sidebarProjectGroupingMode: DEFAULT_UNIFIED_SETTINGS.sidebarProjectGroupingMode,
+ sidebarCompactThreadRows: DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows,
sidebarAutoSettleAfterDays: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays,
sidebarAutoSettleOnMerge: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge,
enableLegacyTokenStreaming: DEFAULT_UNIFIED_SETTINGS.enableLegacyTokenStreaming,
@@ -1081,6 +1084,19 @@ export function AppearanceSettingsPanel() {
const [isImportThemeOpen, setIsImportThemeOpen] = useState(false);
const settings = useScopedSettings();
const updateSettings = useUpdateScopedSettings();
+ const compactSidebarMode = settings.compactSidebarEnabled
+ ? settings.sidebarCompactThreadRows
+ ? "both"
+ : "rail"
+ : settings.sidebarCompactThreadRows
+ ? "threads"
+ : "off";
+ const compactSidebarModes = {
+ off: "Off",
+ rail: "Rail only",
+ threads: "Threads only",
+ both: "Both",
+ };
const environmentStageLabel = useEnvironmentStageLabel();
const showEnvironmentIdentification =
resolveEnvironmentIdentificationPillLabel(environmentStageLabel) !== null;
@@ -1370,19 +1386,56 @@ export function AppearanceSettingsPanel() {
<SettingsSection id="appearance-sidebar" title="Sidebar">
<SettingsRow
{...searchableSetting("compact-sidebar")}
- description="Keep an icon rail when the sidebar is collapsed. Click the preview to try it."
+ description="Choose a collapsed icon rail, denser thread rows, or both. Click the preview to collapse or expand."
+ resetAction={
+ settings.compactSidebarEnabled !== DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled ||
+ settings.sidebarCompactThreadRows !==
+ DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows ? (
+ <SettingResetButton
+ label="compact sidebar"
+ onClick={() =>
+ updateSettings({
+ compactSidebarEnabled: DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled,
+ sidebarCompactThreadRows: DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows,
+ })
+ }
+ />
+ ) : null
+ }
control={
- <div className="grid w-full grid-cols-[5rem_auto] items-center justify-end gap-3 sm:w-auto sm:grid-cols-[7rem_auto] sm:gap-4">
- <CompactSidebarPreview />
- <div className="flex justify-end">
- <Switch
- checked={settings.compactSidebarEnabled}
- onCheckedChange={(checked) =>
- updateSettings({ compactSidebarEnabled: Boolean(checked) })
- }
- aria-label="Compact sidebar"
- />
- </div>
+ <div className="grid w-full grid-cols-[5rem_1fr] items-center gap-3 sm:w-auto sm:grid-cols-[7rem_10rem] sm:gap-4">
+ <CompactSidebarPreview
+ key={compactSidebarMode}
+ railEnabled={settings.compactSidebarEnabled}
+ compactRows={settings.sidebarCompactThreadRows}
+ />
+ <Select
+ value={compactSidebarMode}
+ onValueChange={(value) => {
+ if (
+ value !== "off" &&
+ value !== "rail" &&
+ value !== "threads" &&
+ value !== "both"
+ )
+ return;
+ updateSettings({
+ compactSidebarEnabled: value === "rail" || value === "both",
+ sidebarCompactThreadRows: value === "threads" || value === "both",
+ });
+ }}
+ >
+ <SelectTrigger size="sm" className="w-full" aria-label="Compact sidebar">
+ <SelectValue>{compactSidebarModes[compactSidebarMode]}</SelectValue>
+ </SelectTrigger>
+ <SelectPopup align="end" alignItemWithTrigger={false}>
+ {Object.entries(compactSidebarModes).map(([value, label]) => (
+ <SelectItem key={value} hideIndicator value={value}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectPopup>
+ </Select>
</div>
}
/>
diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts
index d599f1c6152..373ab7885c4 100644
--- a/apps/web/src/components/settings/settingsSearch.ts
+++ b/apps/web/src/components/settings/settingsSearch.ts
@@ -163,7 +163,9 @@ export const SETTINGS_SEARCH_ITEMS = [
id: "compact-sidebar",
title: "Compact sidebar",
to: "/settings/appearance",
- searchTerms: ["collapsed icons rail hover navigation preview"],
+ searchTerms: [
+ "collapsed icons rail hover navigation preview expanded dense density one line rows chats threads compact thread list",
+ ],
},
{
id: "environment-identification",
diff --git a/apps/web/src/components/sidebar/SidebarCompletedTime.test.tsx b/apps/web/src/components/sidebar/SidebarCompletedTime.test.tsx
new file mode 100644
index 00000000000..7327af79e79
--- /dev/null
+++ b/apps/web/src/components/sidebar/SidebarCompletedTime.test.tsx
@@ -0,0 +1,56 @@
+import { act, memo } from "react";
+import { create, type ReactTestRenderer } from "react-test-renderer";
+import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
+
+import { SidebarCompletedTime } from "./SidebarCompletedTime";
+
+let renderer: ReactTestRenderer | undefined;
+
+beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-09-07T01:01:00Z"));
+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
+ vi.stubGlobal("window", {
+ setTimeout,
+ clearTimeout,
+ setInterval,
+ clearInterval,
+ });
+});
+
+afterEach(async () => {
+ await act(() => renderer?.unmount());
+ renderer = undefined;
+ vi.unstubAllGlobals();
+ vi.useRealTimers();
+});
+
+it("advances visible and accessible completion times without rerendering its memoized row", async () => {
+ const rowRender = vi.fn();
+ const Row = memo(function Row() {
+ rowRender();
+ return <SidebarCompletedTime completedAt="2026-09-07T01:00:00Z" />;
+ });
+ await act(() => {
+ renderer = create(<Row />);
+ });
+ expect(renderer!.root.findByType("time").props.dateTime).toBe("2026-09-07T01:00:00Z");
+ expect(renderer!.root.findByProps({ className: "sr-only" }).children).toEqual(["Completed "]);
+ expect(
+ renderer!.root.findAll((node) => node.props.role === "status" || node.props["aria-live"]),
+ ).toHaveLength(0);
+ expect(renderer!.root.findByProps({ className: "text-secondary-label" }).children).toEqual([
+ "1m",
+ ]);
+
+ await act(() => vi.advanceTimersByTime(60_000));
+
+ expect(renderer!.root.findByProps({ className: "sr-only" }).children).toEqual(["Completed "]);
+ expect(renderer!.root.findByProps({ className: "text-secondary-label" }).children).toEqual([
+ "2m",
+ ]);
+ expect(rowRender).toHaveBeenCalledTimes(1);
+ await act(() => renderer!.unmount());
+ renderer = undefined;
+ expect(vi.getTimerCount()).toBe(0);
+});
diff --git a/apps/web/src/components/sidebar/SidebarCompletedTime.tsx b/apps/web/src/components/sidebar/SidebarCompletedTime.tsx
new file mode 100644
index 00000000000..785b8d9459d
--- /dev/null
+++ b/apps/web/src/components/sidebar/SidebarCompletedTime.tsx
@@ -0,0 +1,16 @@
+import { useNowMinute } from "../../hooks/useNowMinute";
+import { formatRelativeTimeLabel } from "../../timestampFormat";
+
+export function SidebarCompletedTime({ completedAt }: { completedAt: string }) {
+ // Subscribe inside the label so time advances even when the row is memoized.
+ const nowMinute = useNowMinute();
+ const relativeTime = formatRelativeTimeLabel(completedAt, Date.parse(`${nowMinute}:00Z`));
+ const label = relativeTime === "just now" ? "now" : relativeTime.replace(/ ago$/, "");
+
+ return (
+ <time dateTime={completedAt} className="inline-flex items-center">
+ <span className="sr-only">Completed </span>
+ <span className="text-secondary-label">{label}</span>
+ </time>
+ );
+}
diff --git a/apps/web/src/timestampFormat.test.ts b/apps/web/src/timestampFormat.test.ts
index 8c6287010d8..5169e438bb2 100644
--- a/apps/web/src/timestampFormat.test.ts
+++ b/apps/web/src/timestampFormat.test.ts
@@ -228,3 +228,15 @@ describe("formatElapsedDurationLabel", () => {
expect(formatElapsedDurationLabel("2026-04-03T12:00:00.000Z")).toBe("4d");
});
});
+
+describe("explicit relative-time clock", () => {
+ it("uses the supplied minute instead of the wall clock", () => {
+ const completedAt = "2026-09-07T01:00:00Z";
+ expect(formatRelativeTimeLabel(completedAt, Date.parse("2026-09-07T01:01:00Z"))).toBe("1m ago");
+ expect(formatRelativeTimeLabel(completedAt, Date.parse("2026-09-07T01:02:00Z"))).toBe("2m ago");
+ expect(formatRelativeTime(completedAt, Date.parse("2026-09-07T01:02:00Z"))).toEqual({
+ value: "2m",
+ suffix: "ago",
+ });
+ });
+});
diff --git a/apps/web/src/timestampFormat.ts b/apps/web/src/timestampFormat.ts
index 9dd463bb50f..983a9bb8b23 100644
--- a/apps/web/src/timestampFormat.ts
+++ b/apps/web/src/timestampFormat.ts
@@ -196,10 +196,10 @@ export type RelativeTimeState =
| { status: "invalid" }
| { status: "relative"; value: string; suffix: string | null };
-export function formatRelativeTime(isoDate: string): RelativeTimeParts | null {
+export function formatRelativeTime(isoDate: string, nowMs = Date.now()): RelativeTimeParts | null {
const date = parseTimestampDate(isoDate);
if (!date) return null;
- const diffMs = Date.now() - date.getTime();
+ const diffMs = nowMs - date.getTime();
if (diffMs < 0) return { value: "just now", suffix: null };
const seconds = Math.floor(diffMs / 1000);
if (seconds < 60) return { value: "just now", suffix: null };
@@ -211,8 +211,8 @@ export function formatRelativeTime(isoDate: string): RelativeTimeParts | null {
return { value: `${days}d`, suffix: "ago" };
}
-export function formatRelativeTimeLabel(isoDate: string) {
- const relative = formatRelativeTime(isoDate);
+export function formatRelativeTimeLabel(isoDate: string, nowMs = Date.now()) {
+ const relative = formatRelativeTime(isoDate, nowMs);
if (!relative) return "";
return relative.suffix ? `${relative.value} ${relative.suffix}` : relative.value;
}
diff --git a/packages/contracts/src/settings.test.ts b/packages/contracts/src/settings.test.ts
index 3579bb29379..c8c6922ec02 100644
--- a/packages/contracts/src/settings.test.ts
+++ b/packages/contracts/src/settings.test.ts
@@ -482,7 +482,18 @@ describe("ClientSettings environment identification", () => {
describe("ClientSettings sidebar", () => {
it("defaults to the current sidebar", () => {
- expect(decodeClientSettings({}).legacySidebarEnabled).toBe(false);
+ const settings = decodeClientSettings({});
+ expect(settings.legacySidebarEnabled).toBe(false);
+ expect(settings.sidebarCompactThreadRows).toBe(false);
+ });
+
+ it("preserves an explicit compact thread row preference", () => {
+ expect(decodeClientSettings({ sidebarCompactThreadRows: true }).sidebarCompactThreadRows).toBe(
+ true,
+ );
+ expect(
+ decodeClientSettingsPatch({ sidebarCompactThreadRows: true }).sidebarCompactThreadRows,
+ ).toBe(true);
});
it("drops the retired sidebar v2 beta keys, resetting everyone to the default", () => {
diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts
index 0625d8c7afb..9d3eaf877af 100644
--- a/packages/contracts/src/settings.ts
+++ b/packages/contracts/src/settings.ts
@@ -451,6 +451,7 @@ export const ClientSettingsSchema = Schema.Struct({
sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
),
+ sidebarCompactThreadRows: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
sidebarThreadPreviewCount: SidebarThreadPreviewCount.pipe(
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT)),
),
@@ -1500,6 +1501,7 @@ export const ClientSettingsPatch = Schema.Struct({
),
sidebarProjectSortOrder: Schema.optionalKey(SidebarProjectSortOrder),
sidebarThreadSortOrder: Schema.optionalKey(SidebarThreadSortOrder),
+ sidebarCompactThreadRows: Schema.optionalKey(Schema.Boolean),
sidebarThreadPreviewCount: Schema.optionalKey(SidebarThreadPreviewCount),
timestampFormat: Schema.optionalKey(TimestampFormat),
snapShotEnabled: Schema.optionalKey(Schema.Boolean),