Skip to content

Commit ae20ae5

Browse files
committed
feat(ui): make sidebar catalog project groups collapsible
Project group heads in the native session catalogs (Codex + Claude) are now collapse toggles: chevron + aria-expanded, rows hidden while the head and count stay visible. State persists per catalog+host+project through the existing collapsed-sections localStorage set. Follow-up to #109575.
1 parent 5f56a54 commit ae20ae5

4 files changed

Lines changed: 87 additions & 14 deletions

File tree

‎docs/nodes/index.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,10 @@ normal plugin node policy and isolates failures by host.
305305

306306
Paired-node rows appear as a **Codex** group in the normal sessions sidebar.
307307
Within each host, rows group by project folder by default; a working directory
308-
under `.claude/worktrees/<name>` folds into its origin repository. Use the
309-
folder icon in the catalog header to flatten or restore the project groups.
310-
The same grouping applies to the Claude sessions catalog.
308+
under `.claude/worktrees/<name>` folds into its origin repository, and project
309+
groups collapse like other sidebar sections. Use the folder icon in the catalog
310+
header to flatten or restore the project groups. The same grouping applies to
311+
the Claude sessions catalog.
311312
By default, selecting a row opens the normal Chat pane and reads its persisted transcript
312313
through bounded, cursor-paginated
313314
`thread/turns/list` calls with full item projection. Use the row menu, the viewer header, or the **Open Codex/Claude sessions in** preference to start `codex resume <thread-id>` in the operator terminal on the computer that owns the session. The paired-node terminal path is an allowlisted PTY relay owned by the Codex plugin, not arbitrary node command execution.

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

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,23 +292,33 @@ function renderCatalogHostGroup(
292292
</div>
293293
<div class="sidebar-session-catalog-host__sessions" role="list" aria-label=${host.label}>
294294
${projectGroups
295-
? html`${projectGroups.groups.map(
296-
(group) => html`
297-
<div
295+
? html`${projectGroups.groups.map((group) => {
296+
const sectionId = `catalog-project:${catalog.id}:${host.hostId}:${group.key}`;
297+
const collapsed = params.collapsedSections.has(sectionId);
298+
return html`
299+
<button
300+
type="button"
298301
class="sidebar-session-catalog-project__head"
299302
data-session-catalog-project=${group.key}
303+
aria-expanded=${String(!collapsed)}
300304
title=${group.title}
305+
@click=${() => params.onToggleSection(sectionId)}
301306
>
307+
<span class="sidebar-session-catalog-project__icon" aria-hidden="true"
308+
>${collapsed ? icons.chevronRight : icons.chevronDown}</span
309+
>
302310
<span class="sidebar-session-catalog-project__label">${group.label}</span>
303311
<span class="sidebar-session-catalog-project__count" aria-hidden="true"
304312
>${group.sessions.length}</span
305313
>
306-
</div>
307-
${group.sessions.map((session) =>
308-
renderCatalogSessionRow(catalog, host, session, liveRowsByKey, params),
309-
)}
310-
`,
311-
)}
314+
</button>
315+
${collapsed
316+
? nothing
317+
: group.sessions.map((session) =>
318+
renderCatalogSessionRow(catalog, host, session, liveRowsByKey, params),
319+
)}
320+
`;
321+
})}
312322
${projectGroups.ungrouped.map((session) =>
313323
renderCatalogSessionRow(catalog, host, session, liveRowsByKey, params),
314324
)}`

‎ui/src/e2e/codex-sessions.e2e.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ let browser: Browser;
1919
let server: ControlUiE2eServer;
2020
const captureUiProofEnabled = process.env.OPENCLAW_CAPTURE_UI_PROOF === "1";
2121
const catalogGroupingStorageKey = "openclaw:sidebar:sessions:catalog-grouping";
22+
const collapsedSessionSectionsStorageKey = "openclaw:sidebar:sessions:collapsed-sections";
2223
const uiProofArtifactDir = path.join(
2324
process.cwd(),
2425
".artifacts",
@@ -92,6 +93,10 @@ suite("Codex native session catalog", () => {
9293
it("groups sessions by host and hides empty offline nodes", async () => {
9394
const page = await browser.newPage({ viewport: { height: 1100, width: 1440 } });
9495
await page.addInitScript((key) => localStorage.removeItem(key), catalogGroupingStorageKey);
96+
await page.addInitScript(
97+
(key) => localStorage.removeItem(key),
98+
collapsedSessionSectionsStorageKey,
99+
);
95100
await installMockGateway(page, {
96101
featureMethods: ["chat.metadata", "chat.startup", "sessions.catalog.list"],
97102
methodResponses: {
@@ -230,6 +235,33 @@ suite("Codex native session catalog", () => {
230235
await page.evaluate((key) => localStorage.getItem(key), catalogGroupingStorageKey),
231236
).toBe("project");
232237

238+
await openclawProject.click();
239+
await expect.poll(() => openclawProject.getAttribute("aria-expanded")).toBe("false");
240+
expect(await section.getByText("Local planning session", { exact: true }).count()).toBe(0);
241+
expect(await section.getByText("Worktree fix session", { exact: true }).count()).toBe(0);
242+
expect(await section.getByText("Other project session", { exact: true }).count()).toBe(1);
243+
expect(await openclawProject.count()).toBe(1);
244+
expect(
245+
await openclawProject.locator(".sidebar-session-catalog-project__count").textContent(),
246+
).toBe("2");
247+
expect(
248+
await page.evaluate(
249+
(key) => JSON.parse(localStorage.getItem(key) ?? "[]"),
250+
collapsedSessionSectionsStorageKey,
251+
),
252+
).toContain("catalog-project:codex:gateway:local:/Users/dev/openclaw");
253+
254+
await openclawProject.click();
255+
await expect.poll(() => openclawProject.getAttribute("aria-expanded")).toBe("true");
256+
expect(await section.getByText("Local planning session", { exact: true }).count()).toBe(1);
257+
expect(await section.getByText("Worktree fix session", { exact: true }).count()).toBe(1);
258+
expect(
259+
await page.evaluate(
260+
(key) => JSON.parse(localStorage.getItem(key) ?? "[]"),
261+
collapsedSessionSectionsStorageKey,
262+
),
263+
).not.toContain("catalog-project:codex:gateway:local:/Users/dev/openclaw");
264+
233265
if (captureUiProofEnabled) {
234266
await mkdir(uiProofArtifactDir, { recursive: true });
235267
await section.screenshot({

‎ui/src/styles/layout.css‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,10 +1630,40 @@ html.openclaw-native-macos
16301630
.sidebar-session-catalog-project__head {
16311631
display: flex;
16321632
align-items: center;
1633-
gap: 8px;
1633+
gap: 5px;
1634+
width: 100%;
16341635
min-height: 18px;
1635-
padding: 2px 12px 0 28px;
1636+
padding: 2px 12px 0 20px;
1637+
border: 0;
1638+
border-radius: var(--radius-sm);
1639+
background: transparent;
16361640
color: color-mix(in srgb, var(--muted) 90%, var(--text) 10%);
1641+
font: inherit;
1642+
cursor: pointer;
1643+
text-align: left;
1644+
transition:
1645+
background var(--duration-fast) ease,
1646+
color var(--duration-fast) ease;
1647+
}
1648+
1649+
.sidebar-session-catalog-project__head:hover,
1650+
.sidebar-session-catalog-project__head:focus-visible {
1651+
background: color-mix(in srgb, var(--bg-hover) 78%, transparent);
1652+
color: var(--text);
1653+
}
1654+
1655+
.sidebar-session-catalog-project__icon {
1656+
display: inline-flex;
1657+
flex: 0 0 auto;
1658+
opacity: 0.75;
1659+
}
1660+
1661+
.sidebar-session-catalog-project__icon svg {
1662+
width: 10px;
1663+
height: 10px;
1664+
stroke: currentColor;
1665+
fill: none;
1666+
stroke-width: 1.8px;
16371667
}
16381668

16391669
.sidebar-session-catalog-project__label {

0 commit comments

Comments
 (0)