Skip to content

fix(ui): order sidebar child sessions by the selected sidebar sort - #172189

Merged
vyctorbrzezowski merged 4 commits into
openclaw:mainfrom
holgergruenhagen:fix/sidebar-child-session-order
Oct 22, 2026
Merged

vyctorbrzezowski merged 4 commits into
openclaw:mainfrom
holgergruenhagen:fix/sidebar-child-session-order

Conversation

@holgergruenhagen

@holgergruenhagen holgergruenhagen commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: nested child sessions in the Control UI sidebar appear in session-key order instead of the selected Sort by order (Created / Last updated), so when a parent has many children the newest or most recently active ones often end up behind Show N more.

User Impact

User impact: expanded children now follow the same sort as the session list. With Last updated, the most recently active children lead the list, and the 4 children shown before Show N more are the most recent ones. With Created, the newest children come first. With Owners, children use the same order as roots (owner name, then Created).

Example from a real installation with Last updated selected: a parent with 10 visible child sessions (keys agent:main:dashboard:<uuid>) listed them in UUID order. The child started most recently (15:14) was 9th and the oldest (02:50) was 10th. The first four rows, the ones shown before Show N more, were children started at 14:42, 09:47, 15:04 and 13:59.

Why This Change Was Made

Roots are already sorted with the sidebar comparator (createSidebarSessionRowsComparator). Children are not: projectSessionTree keeps link order, which is the Gateway's childSessions order (sorted by key) followed by child backrefs. Dashboard child keys end in random UUIDs, so that order is effectively arbitrary.

projectSidebarAgentSessionRows now passes its existing comparator to projectSessionTree, which sorts each parent's children after hidden subagent runs are folded in. Children reached through a run therefore sort with their siblings. Without a comparator, the old link order is kept, so the Home projection and other callers do not change. The visible-child cap (SIDEBAR_VISIBLE_CHILD_SESSION_LIMIT, with running and attention-bearing children always shown) is unchanged. It now applies to the sorted list. Children reorder when their activity changes, exactly like roots do with Last updated. Pin state counts for children exactly as it does for roots, because they share the comparator.

A fixture in session-indicators.ts needed explicit createdAt values: it relied on declaration order to place the quiet child behind the cap, and the rows had no creation time.

Production Tests Docs
Lines +13 / −2 +77 / −3 +1 / −1

Evidence

Isolated real Gateway on loopback with its own state directory, built from the merge base 7234914d5db (this PR changes no Gateway code). The Control UI was served from two builds through gateway.controlUi.root: base (7234914d5db) and fix (2bc3d2eaea9). The PR head 545a6ecfe82 adds only the docs sentence. Each run started from fresh state. The script created a parent "Release coordinator" and 7 children with sessions.create (parentSessionKey, spawnDepth: 1, about 1.1 s apart). It then renamed the children through sessions.patch in a different order to set updatedAt. Labels encode both orders: "Child N" is the creation order (7 = newest), and "updated N" is the recency rank (1 = most recently updated). Chromium opened the parent with the sort mode preset in localStorage, expanded the children, and read the rendered rows.

Run (UTC, 2026-10-14) Sort First 4 children (before Show 3 more) All 7 children
Base 14:00:31 Created 3, 4, 7, 1 3, 4, 7, 1, 6, 5, 2 (key order)
Base 14:00:38 Last updated 3, 4, 7, 1 3, 4, 7, 1, 6, 5, 2 (key order)
Fix 14:01:45 Created 7, 6, 5, 4 7, 6, 5, 4, 3, 2, 1
Fix 14:01:53 Last updated 5, 3, 7, 2 (updated 1–4) 5, 3, 7, 2, 6, 1, 4 (updated 1–7)

Keys were random UUIDs in both runs, so key order differed from both sort orders (fix run key order: 5, 3, 1, 2, 4, 6, 7).

Before After
base-compare fix-compare

Tests (--maxWorkers=1, wall time):

  • pnpm test ui/src/components/app-sidebar-session-tree.test.ts ui/src/components/app-sidebar.sessions.test.ts --maxWorkers=1: 2 files, 109 tests passed, 26.2 s. New cases: the rendered sidebar orders capped children by Created, then by Last updated after setSessionSortMode("updated"), and shows "Show 2 more" (child-sessions-cap.ts); projectSessionTree sorts run-folded children with their siblings and keeps link order without a comparator.
  • Counter-check: with the production files reset to the base, both new cases fail (expected [ 'child-1', 'child-2', … ] to deeply equal [ 'child-2', 'child-4', … ] and expected [ '1f0f', '4f1f', 'a392', 'd517' ] to deeply equal [ 'd517', 'a392', '1f0f', '4f1f' ]).
  • All non-browser sidebar suites (ui/src/components/app-sidebar*, sidebar-*, and tests using the session tree): 53 files passed, 123 s (--maxWorkers=2).
  • pnpm tsgo:ui clean; oxfmt --check and oxlint --type-aware on the changed files: 0 warnings, 0 errors.

Merged current main (b61b0809c63) to resolve conflicts; no behavior change. The docs sentence now follows main's reworded child-disclosure text. Current main auto-expands a parent when a child is added, so the new sort case asserts the expanded state instead of clicking the toggle (6b65f1743a4). Re-run on head 6b65f1743a4: pnpm test on app-sidebar-session-tree, app-sidebar.sessions, app-sidebar-session-navigation-logic, app-sidebar.child-snapshot-freshness, app-sidebar.projection-memo (--maxWorkers=1): 5 files, 171 tests passed, 20.9 s; oxfmt --check and oxlint --type-aware on the changed files clean.

Gaps: the live runs cover Created and Last updated in Chromium. Owners needs a roster with several owners and is covered only by the shared comparator. Team (roster) mode uses the same projection and was not run live. Browser (Playwright) suites and WebKit were not run locally.

Maintainer verification (2026-10-22)

Inspected current-main versus exact-head screenshots and rendered-order proof confirm Created and Last updated sorting before the four-child cap in Chromium with a simulated Gateway. Fresh independent review found no actionable P0–P2 issues; existing exact-head required CI passed. Contributor implementation and authorship are preserved.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S labels Oct 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR applies the selected sidebar sort to nested sessions before the existing Show more cap.

Example: Release coordinator has seven children and Created sorting is selected.

  • Before: The first four children are 3, 4, 7, and 1 in session-key order.
  • After: The first four children are 7, 6, 5, and 4, newest first.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A useful, focused fix with inspected browser proof, distinct regression coverage, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots and rendered-row results exercise Created and Last updated ordering in Chromium against an isolated real Gateway. The sorting implementation remains unchanged from the demonstrated fix; the current head adjusts its regression for main's automatic child expansion. Owners and team mode were not exercised live but reuse the same comparator and projection.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Nested conversations ignore the selected sidebar sort, leaving recent children behind Show more.
Reason: Applying the existing sorting contract to persistent children provides clear user value with a focused change.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current sidebar sorting bug with convincing browser evidence and no actionable correctness or security findings; exact-head CI remains pending.

Priority: P2
Reviewed head: 6b65f1743a4a02e16313f37455ce41fbc4b20cf5

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI projects Gateway session rows and parent links into a navigation tree, folds hidden runs, and renders persistent children through visibility rules and a four-child cap.

flowchart LR
  A[Gateway session rows] --> B[Sidebar projection]
  C[Selected sort comparator] --> B
  B --> D[Tree and hidden run folding]
  D --> E[Sorted persistent children]
  E --> F[Visibility rules and child cap]
  F --> G[Rendered sidebar]
Loading

Technical review

Best possible solution:

Land the existing shared-comparator fix once the required checks pass.

Do we have a high-confidence way to reproduce the issue?

Current main preserves child-link order while roots use the selected comparator, matching the contributor's inspected before screenshots; no target code was executed during this review.

Is this the best way to solve the issue?

Sorting persistent children after hidden-run folding uses the existing ordering owner and fixes the mismatch without changing the cap or duplicating policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 50520de188dd.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 173c467 adds ui/src/components/app-sidebar-session-tree.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 173c46790594; files: ui/src/components/app-sidebar-session-tree.ts)
  • Holger Gruenhagen: Raw commit bff90d6 adds ui/src/components/app-sidebar-session-tree.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: bff90d69144c; files: ui/src/components/app-sidebar-session-tree.ts)

PR surface

Source +8, Tests +172, Docs 0, Other +1. Total +181 across 19 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 44 36 +8
Tests 7 175 3 +172
Docs 2 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 19 222 41 +181

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Incorrect ordering hides recent child conversations behind Show more, but users can still expand and navigate them.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-14T14:16:36.254Z sha 545a6ec :: needs maintainer review before merge. :: none

Reviewed October 19, 2026, 6:46 PM ET / 22:46 UTC (Revision 2).

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts agents Agent runtime and tooling size: M and removed size: S labels Oct 19, 2026
@vyctorbrzezowski vyctorbrzezowski self-assigned this Oct 19, 2026
@holgergruenhagen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
…sion-order

# Conflicts:
#	ui/src/components/app-sidebar-session-tree.test.ts
#	ui/src/test-helpers/app-sidebar-cases/child-sessions-cap.ts
@openclaw-barnacle openclaw-barnacle Bot removed scripts Repository scripts agents Agent runtime and tooling labels Oct 21, 2026

@vyctorbrzezowski vyctorbrzezowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the child-session ordering change, including the shared Created/Updated/Owners comparator, sorting after hidden-run folding, the visible-child cap, retained grouping and Home behavior, and the regression cases. No actionable issue was found in the reviewed diff.

Automated code review complete. No further changes are requested from the author at this stage. Final product and design review will be handled by the responsible maintainer before the PR is considered for merge.

@vyctorbrzezowski

Copy link
Copy Markdown
Member

Current-source visual verification

Verified in Chromium with the production Control UI source and an isolated simulated Gateway. Before: main b90f49b11fcde5f994de83c8b4874a98a83c44ad. After: PR head c7725c72c040f79e07c852bf9b8236add16f17f3.

The same six synthetic children have distinct creation and update ranks (6 is newest). Both main modes show children 1, 2, 3, 4. The PR shows 2, 4, 6, 1 for Created and 1, 3, 5, 6 for Last updated, before Show 2 more. Screenshots were inspected and cropped to omit the composer. This is browser boundary proof using the source server, not a live Gateway or production-bundle run.

Sort Before After
Created Main Created PR Created
Last updated Main Last updated PR Last updated

@vyctorbrzezowski
vyctorbrzezowski merged commit f4e3844 into openclaw:main Oct 22, 2026
101 of 103 checks passed
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…penclaw#172189)

* fix(ui): order sidebar child sessions by the selected sidebar sort

* test(ui): rely on auto-expanded child sessions in sort order case
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 P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants