Skip to content

Commit bfe3d68

Browse files
committed
feat(ui): sidebar project grouping and truly flat None mode
Group by: None now renders one flat session list — no Other/Groups/Coding zone headers — matching what None promises. New Group by: Project buckets sessions by their resolved repo/workspace checkout, folding .claude/worktrees checkouts into their origin repo via the same rule the harness catalogs already use; checkout-less rows keep their smart zones, mirroring Person mode.
1 parent d4c1acb commit bfe3d68

9 files changed

Lines changed: 185 additions & 39 deletions

‎docs/web/control-ui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ and [Linux](/platforms/linux) desktop apps, the
250250

251251
## Sidebar navigation
252252

253-
The sidebar organizes everything around the agent. The identity row at the top is the active agent; below it, the **Pages** section starts with **Home** — the agent's rolling main session, badged with its unread or running state — followed by the pinned destinations (**Automations** and **Plugins** by default). The customize control on the Pages header opens a menu with every other destination, including **Usage** and plugin-provided tabs, plus **Edit pinned items**; right-clicking the navigation area opens the pin editor directly. The session list below splits into zones: **Other** for the agent's ungrouped chat sessions (the main session stays behind Home; sessions it spawned appear here as top-level threads, and named threads show without a type prefix), **Groups** for group and room conversations, and **Coding** for sessions bound to a managed worktree or exec node (rows show a `repo ⎇ branch` line plus the node host), ACP-backed harness sessions, and the Codex/Claude CLI catalogs. The **Other** heading is omitted when it is the only section. Coding starts collapsed on first run and remembers your choice; its collapsed header keeps the true count and shows a running indicator while contained sessions work. Custom groups (the session `category`) and **Pinned** rows sit above Other, and assigning a session to a custom group always wins over the automatic zone classification. The global **Sessions** toolbar holds the filter and sort control (Created, Last updated, or Owners when the loaded session roster contains multiple owners), Group by, a persisted **Status** filter for Active, Archived, or All, and the **+** that opens the New session page. The Owners sort mode orders owner groups by name and keeps Created order within each group. On multi-user gateways the same menu adds an **Owners** filter: **All owners**, one specific person or agent, or **Involving me** — sessions you own plus sessions you have prompted, evaluated by the Gateway against the full participant history (see [Multi-user mode](/concepts/multi-user#finding-sessions-by-owner)). Archived rows stay inline, dimmed with an archive glyph; they do not contribute unread or attention state and stay outside lineage promotion. Opening a session moves the selection highlight without reordering rows. Parent sessions with recent child runs show a disclosure and child count; expand it to inspect nested child sessions, live or terminal status, and runtime without leaving the sidebar. Selecting a child opens its chat and automatically reveals its ancestor path. Child rows stay outside root grouping, pinning, dragging, multi-select, and pagination; collapsed zones do not consume the visible page budget. Sessions with new activity since they were last read show an unread dot, and opening one marks it read. Admitted work that has not started shows **Queued** with an hourglass until execution starts. This state does not by itself mean every concurrency slot is occupied. A session holding composer text you typed but never sent shows a pencil badge until the draft is sent or cleared; the active session hides it because its composer is already in view. An agent can also publish a short expiring status line and optionally request attention with a curated amber icon; that declaration clears when you open the session, send the next message, clear it explicitly, or its TTL expires. Cloud-worker lifecycle states use a globe badge; local and reclaimed sessions omit a placement badge because local execution is the default. Each root session row has a context menu (kebab button or right-click) with Pin/Unpin, Mark as unread/read, Rename, Assign to me and Assign to… on multi-user gateways ([session ownership](/concepts/multi-user#assigning-an-owner)), Set icon, Fork, Copy session ID, Move to group (including New group and Remove from group), Archive or Unarchive, and Delete; touch layouts keep the direct pin and menu controls visible. The chat header composes the same single-session management actions with its pane-specific **Panels**, **Layout**, **View**, and **Continue in terminal** actions. Cmd/Ctrl-click opens a session in a new browser tab. Alt/Option-click toggles root rows into a multi-select and Shift-click extends it across the visible order; opening the menu on a selected row then offers batch actions (Mark N as unread/read, Move N to group, Archive N, Delete N) that apply to every selected session, with a single confirmation for batch delete. Drag a root session onto **Pinned** to pin it, or onto a custom group to move it. Custom group headers can be collapsed, expanded, or dragged to reorder them; group names, order, and New Session defaults live in the gateway (`sessions.groups.*`), so they follow you across browsers, while collapsed state stays in the browser profile. Each custom group header has a **+** that opens the normal New Session page and assigns the created session to that group. **New session defaults** in the group menu sets its working directory and Local or Worktree preference; the page prefills those values but leaves them editable. Leaving the directory empty uses the selected agent's workspace. The menu also has Rename group, New group, and Delete group; renaming or deleting a group updates every member session server-side, including archived ones, and deleting a group keeps its sessions and moves them back to Other.
253+
The sidebar organizes everything around the agent. The identity row at the top is the active agent; below it, the **Pages** section starts with **Home** — the agent's rolling main session, badged with its unread or running state — followed by the pinned destinations (**Automations** and **Plugins** by default). The customize control on the Pages header opens a menu with every other destination, including **Usage** and plugin-provided tabs, plus **Edit pinned items**; right-clicking the navigation area opens the pin editor directly. The session list below splits into zones: **Other** for the agent's ungrouped chat sessions (the main session stays behind Home; sessions it spawned appear here as top-level threads, and named threads show without a type prefix), **Groups** for group and room conversations, and **Coding** for sessions bound to a managed worktree or exec node (rows show a `repo ⎇ branch` line plus the node host), ACP-backed harness sessions, and the Codex/Claude CLI catalogs. The **Other** heading is omitted when it is the only section. Coding starts collapsed on first run and remembers your choice; its collapsed header keeps the true count and shows a running indicator while contained sessions work. Custom groups (the session `category`) and **Pinned** rows sit above Other, and assigning a session to a custom group always wins over the automatic zone classification. The global **Sessions** toolbar holds the filter and sort control (Created, Last updated, or Owners when the loaded session roster contains multiple owners), **Group by** — **Custom groups** (the default zone layout above), **Project** to bucket sessions by their repo or workspace checkout (sessions without one keep their zones), **Person** to bucket by owner when the loaded roster has several, or **None** for a single flat list with no zone headers — a persisted **Status** filter for Active, Archived, or All, and the **+** that opens the New session page. The Owners sort mode orders owner groups by name and keeps Created order within each group. On multi-user gateways the same menu adds an **Owners** filter: **All owners**, one specific person or agent, or **Involving me** — sessions you own plus sessions you have prompted, evaluated by the Gateway against the full participant history (see [Multi-user mode](/concepts/multi-user#finding-sessions-by-owner)). Archived rows stay inline, dimmed with an archive glyph; they do not contribute unread or attention state and stay outside lineage promotion. Opening a session moves the selection highlight without reordering rows. Parent sessions with recent child runs show a disclosure and child count; expand it to inspect nested child sessions, live or terminal status, and runtime without leaving the sidebar. Selecting a child opens its chat and automatically reveals its ancestor path. Child rows stay outside root grouping, pinning, dragging, multi-select, and pagination; collapsed zones do not consume the visible page budget. Sessions with new activity since they were last read show an unread dot, and opening one marks it read. Admitted work that has not started shows **Queued** with an hourglass until execution starts. This state does not by itself mean every concurrency slot is occupied. A session holding composer text you typed but never sent shows a pencil badge until the draft is sent or cleared; the active session hides it because its composer is already in view. An agent can also publish a short expiring status line and optionally request attention with a curated amber icon; that declaration clears when you open the session, send the next message, clear it explicitly, or its TTL expires. Cloud-worker lifecycle states use a globe badge; local and reclaimed sessions omit a placement badge because local execution is the default. Each root session row has a context menu (kebab button or right-click) with Pin/Unpin, Mark as unread/read, Rename, Assign to me and Assign to… on multi-user gateways ([session ownership](/concepts/multi-user#assigning-an-owner)), Set icon, Fork, Copy session ID, Move to group (including New group and Remove from group), Archive or Unarchive, and Delete; touch layouts keep the direct pin and menu controls visible. The chat header composes the same single-session management actions with its pane-specific **Panels**, **Layout**, **View**, and **Continue in terminal** actions. Cmd/Ctrl-click opens a session in a new browser tab. Alt/Option-click toggles root rows into a multi-select and Shift-click extends it across the visible order; opening the menu on a selected row then offers batch actions (Mark N as unread/read, Move N to group, Archive N, Delete N) that apply to every selected session, with a single confirmation for batch delete. Drag a root session onto **Pinned** to pin it, or onto a custom group to move it. Custom group headers can be collapsed, expanded, or dragged to reorder them; group names, order, and New Session defaults live in the gateway (`sessions.groups.*`), so they follow you across browsers, while collapsed state stays in the browser profile. Each custom group header has a **+** that opens the normal New Session page and assigns the created session to that group. **New session defaults** in the group menu sets its working directory and Local or Worktree preference; the page prefills those values but leaves them editable. Leaving the directory empty uses the selected agent's workspace. The menu also has Rename group, New group, and Delete group; renaming or deleting a group updates every member session server-side, including archived ones, and deleting a group keeps its sessions and moves them back to Other.
254254

255255
Session previews are hidden by default for compact, single-line rows. Enable **Show message preview** in the **Sessions** filter menu to restore routine status text and message previews. The browser remembers your choice. Errors and requests for attention remain visible with previews off.
256256

‎scripts/control-ui-mock-dev.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,18 @@ async function createChatPickerScenario(
18001800
repoRoot: "~/Projects/openclaw",
18011801
},
18021802
}),
1803+
// Second repo plus a spawned worktree checkout so the sidebar's
1804+
// Project grouping shows several sections and the worktree fold.
1805+
sessionRow("agent:main:clawdbot-vite", "Vite upgrade spike", baseTime - 160_000, {
1806+
worktree: {
1807+
id: "wt-clawdbot-vite",
1808+
branch: "openclaw/vite-upgrade",
1809+
repoRoot: "~/Projects/clawdbot",
1810+
},
1811+
}),
1812+
sessionRow("agent:main:project-grouping", "Sidebar project grouping", baseTime - 170_000, {
1813+
spawnedCwd: "~/Projects/openclaw/.claude/worktrees/groups-c7c338",
1814+
}),
18031815
...buildSessionRows({
18041816
baseTime: baseTime - 400_000,
18051817
count: 3,

‎ui/src/components/app-sidebar-session-list-render.ts‎

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,26 @@ function renderSessionSection(params: {
6666
const collapsed = section.renderHeader && host.collapsedSessionSections.has(section.id);
6767
const label = personOwner
6868
? personOwner.label || personOwner.id
69-
: section.groups
70-
? t("chat.sidebar.groups")
71-
: section.work
72-
? t("chat.sidebar.coding")
73-
: group
74-
? group
75-
: t("chat.sidebar.otherSessions");
69+
: section.project
70+
? section.project.name
71+
: section.groups
72+
? t("chat.sidebar.groups")
73+
: section.work
74+
? t("chat.sidebar.coding")
75+
: group
76+
? group
77+
: t("chat.sidebar.otherSessions");
7678
const zone = personOwner
7779
? "person"
78-
: section.groups
79-
? "groups"
80-
: section.work
81-
? "coding"
82-
: group
83-
? "category"
84-
: "threads";
80+
: section.project
81+
? "project"
82+
: section.groups
83+
? "groups"
84+
: section.work
85+
? "coding"
86+
: group
87+
? "category"
88+
: "threads";
8589
// Collapsed Coding still signals live runs so background work stays visible.
8690
const collapsedRunningDot =
8791
collapsed &&
@@ -95,7 +99,10 @@ function renderSessionSection(params: {
9599
method: "sessions.groups.put",
96100
requiredScope: "operator.write",
97101
});
98-
const sectionDropEnabled = groupWriteAccess.allowed && !personOwner;
102+
// Person/project sections are derived, not stored: dropping a session on
103+
// them cannot persist anything, so they take no drags at all.
104+
const derivedSection = Boolean(personOwner || section.project);
105+
const sectionDropEnabled = groupWriteAccess.allowed && !derivedSection;
99106
const sectionClass = [
100107
"sidebar-recent-sessions__group",
101108
`sidebar-recent-sessions__group--zone-${zone}`,
@@ -130,7 +137,7 @@ function renderSessionSection(params: {
130137
${section.renderHeader
131138
? renderSidebarSessionSectionHeader({
132139
sectionId: section.id,
133-
draggable: !personOwner,
140+
draggable: !derivedSection,
134141
disabledReason: groupWriteAccess.allowed ? undefined : groupWriteAccess.reason,
135142
onStartDrag: (sectionId) => host.startSidebarSectionDrag(sectionId),
136143
onFinishDrag: () => host.finishSidebarSectionDrag(),
@@ -146,6 +153,7 @@ function renderSessionSection(params: {
146153
class="sidebar-session-group-toggle"
147154
aria-expanded=${String(!collapsed)}
148155
aria-label=${label}
156+
title=${section.project?.path ?? nothing}
149157
@click=${() => host.toggleSection(section.id)}
150158
>
151159
<span class="sidebar-session-group-toggle__lead" aria-hidden="true">

‎ui/src/components/app-sidebar-session-menu-renderers.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ export function renderSidebarSessionSortMenu(params: {
288288
}
289289
const groupingOptions = [
290290
{ grouping: "category", label: t("sessionsView.groupByCategory") },
291+
{ grouping: "project", label: t("chat.sidebar.catalogGroupByProject") },
291292
{ grouping: "person", label: t("sessionsView.groupByPerson") },
292293
{ grouping: "none", label: t("sessionsView.groupByNone") },
293294
] as const satisfies ReadonlyArray<{ grouping: SidebarSessionsGrouping; label: string }>;

‎ui/src/components/app-sidebar-session-projection.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,23 @@ describe("SidebarSessionProjection sticky membership", () => {
132132
},
133133
);
134134

135+
it("keeps the flat list headerless beside catalog sections when grouping is none", () => {
136+
const projection = new SidebarSessionProjection();
137+
const flat = projection.project(
138+
projectionInput([sessionRow("a")], { grouping: "none", catalogIds: ["claude"] }),
139+
);
140+
expect(flat.sections.map((section) => [section.id, section.renderHeader])).toEqual([
141+
["ungrouped", false],
142+
["work", true],
143+
["catalog:claude", true],
144+
]);
145+
146+
const grouped = projection.project(
147+
projectionInput([sessionRow("a")], { catalogIds: ["claude"] }),
148+
);
149+
expect(grouped.sections.find((section) => section.id === "ungrouped")?.renderHeader).toBe(true);
150+
});
151+
135152
it("clears a section's sticky rows when its user collapses and reopens it", () => {
136153
const projection = new SidebarSessionProjection();
137154
const categorized = (active: boolean) =>

‎ui/src/components/app-sidebar-session-projection.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,14 @@ export class SidebarSessionProjection {
213213
// Coding does not render, while empty custom/Groups sections remain targets.
214214
// Headerless means no collapse control, so a stored ungrouped-collapsed
215215
// preference is deliberately inert here; it re-applies once a peer returns.
216-
const ungroupedHasPeerHeader = sections.some(
217-
(section) => section.id !== "ungrouped" && (section.id !== "work" || section.rows.length > 0),
218-
);
216+
// Flat mode ("none") holds every native row, so its "Other" label would
217+
// lie; it stays headerless even beside catalog sections.
218+
const ungroupedHasPeerHeader =
219+
input.grouping !== "none" &&
220+
sections.some(
221+
(section) =>
222+
section.id !== "ungrouped" && (section.id !== "work" || section.rows.length > 0),
223+
);
219224
const expandedRows: SidebarRecentSession[] = [];
220225
const visibleRows: SidebarRecentSession[] = [];
221226
const limitedSections: SidebarVisibleSections["sections"] = [];

‎ui/src/lib/sessions/catalog-project-grouping.ts‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ export function normalizeCatalogProjectGrouping(raw: unknown): CatalogProjectGro
66
return raw === "none" || raw === "person" ? raw : "project";
77
}
88

9+
// Mirror Claude Code desktop: any cwd at or under `.claude/worktrees/<name>`
10+
// folds into the origin repo; the lazy prefix picks the outermost repo root.
11+
// Returns null for a filesystem-root worktree parent, which is not a real
12+
// project root.
13+
export function foldWorktreeCheckoutPath(path: string): string | null {
14+
const match = path.match(/^(.*?)[\\/]\.claude[\\/]worktrees[\\/][^\\/]/);
15+
return match ? match[1] || null : path;
16+
}
17+
18+
/** Basename shown for a checkout path in project sections. */
19+
export function checkoutDisplayName(path: string): string {
20+
return path.split(/[\\/]/).findLast(Boolean) ?? path;
21+
}
22+
923
type CatalogProjectGroup = {
1024
kind: "custom" | "project" | "person";
1125
key: string;
@@ -52,15 +66,8 @@ export function groupCatalogSessionsByProject(sessions: readonly SessionCatalogS
5266
}
5367
// Accepted tradeoff: filesystem-root cwds ("/", "C:\") are not real harness
5468
// session roots; after trimming they fall to the ungrouped flat tail by design.
55-
let projectPath = session.cwd?.trim().replace(/[\\/]+$/, "");
56-
if (!projectPath) {
57-
ungrouped.push(session);
58-
continue;
59-
}
60-
// Mirror Claude Code desktop: any cwd at or under `.claude/worktrees/<name>`
61-
// folds into the origin repo; the lazy prefix picks the outermost repo root.
62-
const worktreeMatch = projectPath.match(/^(.*?)[\\/]\.claude[\\/]worktrees[\\/][^\\/]/);
63-
projectPath = worktreeMatch?.[1] ?? projectPath;
69+
const trimmedPath = session.cwd?.trim().replace(/[\\/]+$/, "");
70+
const projectPath = trimmedPath ? foldWorktreeCheckoutPath(trimmedPath) : null;
6471
if (!projectPath) {
6572
ungrouped.push(session);
6673
continue;
@@ -71,7 +78,7 @@ export function groupCatalogSessionsByProject(sessions: readonly SessionCatalogS
7178
kind: "project",
7279
key: `project:${projectPath}`,
7380
legacySectionKey: projectPath,
74-
label: projectPath.split(/[\\/]/).at(-1) || projectPath,
81+
label: checkoutDisplayName(projectPath),
7582
title: projectPath,
7683
sessions: [],
7784
};

0 commit comments

Comments
 (0)