Repository navigation
feat(ui): group native session catalog rows by project in the sidebar - #109575
Conversation
b4e1ec5 to
4760799
Compare
|
Two follow-up commits since the original push:
The red |
def3ac5 to
fa0fafb
Compare
|
One more opportunistic main-CI fix carried on this branch after rebasing onto current
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa0fafb791
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| liveRows: [ | ||
| ...(this.sessionsResult?.sessions ?? []), | ||
| ...Object.values(this.sessionRowsByAgent).flat(), | ||
| ], | ||
| renderLiveRow: (row, display) => | ||
| this.renderRecentSession(navigationState.toSidebarSession(row), display), | ||
| onToggleSection: (sectionId) => this.toggleSessionSection(sectionId), | ||
| onToggleProjectGrouping: () => { | ||
| const next = this.catalogProjectGrouping === "project" ? "none" : "project"; | ||
| storeSidebarCatalogGrouping(next); |
There was a problem hiding this comment.
Keep grouping toggle working without localStorage
When localStorage.setItem throws (for example in private/blocked storage or quota-exceeded contexts), this handler throws before assigning catalogProjectGrouping, so the new folder button does nothing and leaves an uncaught UI error. The existing sidebar preference setters catch persistence failures and keep the in-memory preference usable; this new store call needs the same treatment.
Useful? React with 👍 / 👎.
Codex and Claude session catalogs in the Control UI sidebar now group each host's sessions by project folder, mirroring Claude Code desktop: any cwd at or under <repo>/.claude/worktrees/<name> folds into the origin repo. A folder toggle icon in the catalog header flattens the list; grouping defaults to on and persists via localStorage (openclaw:sidebar:sessions:catalog-grouping).
Post-rebase main forbids catalog fallback metadata in source PRs; the post-merge locale-refresh workflow reconciles foreign catalog parity.
knip dead-export gate: no external importers; callers rely on the inferred return shape of groupCatalogSessionsByProject.
Opportunistic CI fix: b6535fb/905395a3ff5 retired workspace-state seeding from scripts/e2e/parallels/agent-workspace.ts but the smoke-model test still asserted the removed string, breaking checks-node-compact-small-2 on every branch.
Rebase conflict resolution wrongly kept this branch's older removal; main's 2256387 comment plus not.toContain assertion is the canonical fix.
fa0fafb to
79bd3d3
Compare
|
Merged via squash.
|
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.
…openclaw#109575) * feat(ui): group native session catalog rows by project in the sidebar Codex and Claude session catalogs in the Control UI sidebar now group each host's sessions by project folder, mirroring Claude Code desktop: any cwd at or under <repo>/.claude/worktrees/<name> folds into the origin repo. A folder toggle icon in the catalog header flattens the list; grouping defaults to on and persists via localStorage (openclaw:sidebar:sessions:catalog-grouping). * chore(ui): drop generated i18n fallback metadata from source PR Post-rebase main forbids catalog fallback metadata in source PRs; the post-merge locale-refresh workflow reconciles foreign catalog parity. * chore(ui): keep CatalogProjectGroup type module-local knip dead-export gate: no external importers; callers rely on the inferred return shape of groupCatalogSessionsByProject. * test(scripts): drop retired workspace-state.json expectation Opportunistic CI fix: 2ee33ac/e214bf1a53f retired workspace-state seeding from scripts/e2e/parallels/agent-workspace.ts but the smoke-model test still asserted the removed string, breaking checks-node-compact-small-2 on every branch. * test(scripts): restore mainline retired-state regression guard Rebase conflict resolution wrongly kept this branch's older removal; main's b377d55 comment plus not.toContain assertion is the canonical fix.
…09648) 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 openclaw#109575.
…openclaw#109575) * feat(ui): group native session catalog rows by project in the sidebar Codex and Claude session catalogs in the Control UI sidebar now group each host's sessions by project folder, mirroring Claude Code desktop: any cwd at or under <repo>/.claude/worktrees/<name> folds into the origin repo. A folder toggle icon in the catalog header flattens the list; grouping defaults to on and persists via localStorage (openclaw:sidebar:sessions:catalog-grouping). * chore(ui): drop generated i18n fallback metadata from source PR Post-rebase main forbids catalog fallback metadata in source PRs; the post-merge locale-refresh workflow reconciles foreign catalog parity. * chore(ui): keep CatalogProjectGroup type module-local knip dead-export gate: no external importers; callers rely on the inferred return shape of groupCatalogSessionsByProject. * test(scripts): drop retired workspace-state.json expectation Opportunistic CI fix: b6535fb/905395a3ff5 retired workspace-state seeding from scripts/e2e/parallels/agent-workspace.ts but the smoke-model test still asserted the removed string, breaking checks-node-compact-small-2 on every branch. * test(scripts): restore mainline retired-state regression guard Rebase conflict resolution wrongly kept this branch's older removal; main's 2256387 comment plus not.toContain assertion is the canonical fix.
…09648) 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 openclaw#109575.
What Problem This Solves
The sidebar's native session catalogs (Codex CLI and Claude Code sessions discovered on the Gateway and paired nodes) render each host's sessions as one flat list. Claude Code's own desktop app groups its session sidebar by project — sessions started in a
.claude/worktrees/<name>worktree fold into their origin repository — so operators with many sessions across several repos lose that structure the moment they view the same sessions through OpenClaw. Codex has no native grouping at all.Why This Change Was Made
Mirror Claude Code's project grouping for both catalogs, purely client-side. Every catalog session already carries
cwdover the existingsessions.catalog.listwire shape (Codex rollouts require it:codex-rs/protocol/src/protocol.rsSessionMeta.cwd; the Anthropic catalog emitscwd/originCwdfrom the Claude project index), so no protocol, gateway, or plugin changes are needed:ui/src/lib/sessions/catalog-project-grouping.tsgroups a host's sessions by normalizedcwd; any cwd at or under<repo>/.claude/worktrees/<name>folds into<repo>. Group order follows recency (first occurrence in the host's recency-sorted list); sessions without acwdstay in a flat tail.renderCatalogHostGrouprenders project subheaders (folder basename, count, full path tooltip) under each host.localStorage(openclaw:sidebar:sessions:catalog-grouping). Grouping is on by default.Accepted tradeoff (named per repo pragmatism policy): a session whose cwd is exactly a filesystem root (
/,C:\) lands in the ungrouped flat tail instead of its own group — harness sessions are not started from the filesystem root in practice, and the row stays visible and clickable.User Impact
Codex and Claude session catalogs in the sidebar now show the same project groups under each node/host that Claude Code's desktop sidebar shows, including worktree sessions folded into their origin repo. A new folder toggle icon in the catalog header flattens the list for anyone who prefers the old rendering; default is grouped. Docs updated in
docs/nodes/index.md.(Screenshots from the Playwright e2e fixture with
OPENCLAW_CAPTURE_UI_PROOF=1; fixture data only.)Evidence
ui/src/lib/sessions/catalog-project-grouping.test.ts(12 tests: cwd grouping, worktree root + descendant folding, Windows separators, trailing-slash normalization, missing-cwd tail, first-occurrence ordering, preference normalization) — green locally vianode scripts/run-vitest.mjs.ui/src/e2e/codex-sessions.e2e.test.tsextended — asserts project heads/labels/counts under the host, worktree folding, toggle flattening,localStoragepersistence, and restore. Green on Blacksmith Testbox (tbx_01kxpxk8hcgg528cztht3xxn44).pnpm check:changedon Blacksmith Testbox: format, Control UI i18n catalog, typecheck core tests, typecheck UI green. The singlelint corefailure (max-linesinapp-sidebar-session-data.ts) was caused by this diff's original state placement and fixed by moving the preference state toapp-sidebar-session-list.ts; scopedrun-oxlint+tsgo:ui+tsgo:test:ui+ e2e re-proven remotely after the move.chat.sidebar.groupCatalogSessionsByProjectkey inen.tsonly; per the current contributor flow, generated catalog fallback metadata is excluded from this source PR and the post-mergecontrol-ui-locale-refreshworkflow reconciles foreign catalog parity.gpt-5.6-sol): one accepted finding (worktree descendant cwds must also fold — fixed + regression test row added), one rejected finding (filesystem-root cwd edge case — named tradeoff above). Final run clean.