Skip to content

feat(ui): group native session catalog rows by project in the sidebar - #109575

Merged
steipete merged 5 commits into
mainfrom
claude/codec-grouping-sidebar-328e1c
Jul 17, 2026
Merged

steipete merged 5 commits into
mainfrom
claude/codec-grouping-sidebar-328e1c

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 cwd over the existing sessions.catalog.list wire shape (Codex rollouts require it: codex-rs/protocol/src/protocol.rs SessionMeta.cwd; the Anthropic catalog emits cwd/originCwd from the Claude project index), so no protocol, gateway, or plugin changes are needed:

  • New pure helper ui/src/lib/sessions/catalog-project-grouping.ts groups a host's sessions by normalized cwd; 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 a cwd stay in a flat tail.
  • renderCatalogHostGroup renders project subheaders (folder basename, count, full path tooltip) under each host.
  • A folder icon in each catalog header toggles grouping off/on for all catalogs; the preference persists in 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.

Grouped (default, new) Flat (toggle off = previous behavior)
grouped flat

(Screenshots from the Playwright e2e fixture with OPENCLAW_CAPTURE_UI_PROOF=1; fixture data only.)

Evidence

  • Unit tests: 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 via node scripts/run-vitest.mjs.
  • E2E: ui/src/e2e/codex-sessions.e2e.test.ts extended — asserts project heads/labels/counts under the host, worktree folding, toggle flattening, localStorage persistence, and restore. Green on Blacksmith Testbox (tbx_01kxpxk8hcgg528cztht3xxn44).
  • pnpm check:changed on Blacksmith Testbox: format, Control UI i18n catalog, typecheck core tests, typecheck UI green. The single lint core failure (max-lines in app-sidebar-session-data.ts) was caused by this diff's original state placement and fixed by moving the preference state to app-sidebar-session-list.ts; scoped run-oxlint + tsgo:ui + tsgo:test:ui + e2e re-proven remotely after the move.
  • i18n: new chat.sidebar.groupCatalogSessionsByProject key in en.ts only; per the current contributor flow, generated catalog fallback metadata is excluded from this source PR and the post-merge control-ui-locale-refresh workflow reconciles foreign catalog parity.
  • Autoreview (Codex 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui plugin: file-transfer size: M maintainer Maintainer-authored PR labels Jul 17, 2026
@steipete
steipete force-pushed the claude/codec-grouping-sidebar-328e1c branch from b4e1ec5 to 4760799 Compare July 17, 2026 03:19
@steipete

Copy link
Copy Markdown
Contributor Author

Two follow-up commits since the original push:

  • chore(ui): keep CatalogProjectGroup type module-local — knip dead-export gate (check-dependencies).
  • test(scripts): drop retired workspace-state.json expectation — opportunistic CI fix: b6535fb / 905395a retired workspace-state seeding from scripts/e2e/parallels/agent-workspace.ts but test/scripts/parallels-smoke-model.test.ts still asserted the removed string, breaking checks-node-compact-small-2 on every branch (verified failing on origin/main, passing locally after the one-line removal: 87/87).

The red control-ui-i18n check is the advisory source-PR drift lane (continue-on-error for non-generated PRs); the post-merge control-ui-locale-refresh workflow reconciles catalog fallback parity for the new key.

@steipete
steipete force-pushed the claude/codec-grouping-sidebar-328e1c branch from def3ac5 to fa0fafb Compare July 17, 2026 03:35
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

One more opportunistic main-CI fix carried on this branch after rebasing onto current main:

  • fix(scripts): drop redundant isDirectReleaseCandidateExecution declaration — fix(scripts): restore isDirectReleaseCandidateExecution declaration #109586 restored the declaration in scripts/release-candidate-checklist.d.mts while a second undocumented copy remained at the bottom of the file, so check-lint fails adjacent-overload-signatures on current main (and on every PR merge ref). Kept the single documented declaration; test/scripts/release-candidate-checklist.test.ts green locally.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

steipete added 5 commits July 17, 2026 03:46
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.
@steipete
steipete force-pushed the claude/codec-grouping-sidebar-328e1c branch from fa0fafb to 79bd3d3 Compare July 17, 2026 03:47
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Jul 17, 2026
@steipete
steipete merged commit dad377c into main Jul 17, 2026
94 of 96 checks passed
@steipete
steipete deleted the claude/codec-grouping-sidebar-328e1c branch July 17, 2026 03:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Jul 17, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…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.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…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.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR plugin: file-transfer size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant