Repository navigation
fix(ui): order sidebar child sessions by the selected sidebar sort - #172189
vyctorbrzezowski merged 4 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +8, Tests +172, Docs 0, Other +1. Total +181 across 19 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 19, 2026, 6:46 PM ET / 22:46 UTC (Revision 2). |
…sion-order # Conflicts: # docs/web/control-ui/sessions-and-sidebar.md
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…sion-order # Conflicts: # ui/src/components/app-sidebar-session-tree.test.ts # ui/src/test-helpers/app-sidebar-cases/child-sessions-cap.ts
vyctorbrzezowski
left a comment
There was a problem hiding this comment.
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.
|
Merged via squash.
|
…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




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:projectSessionTreekeeps link order, which is the Gateway'schildSessionsorder (sorted by key) followed by child backrefs. Dashboard child keys end in random UUIDs, so that order is effectively arbitrary.projectSidebarAgentSessionRowsnow passes its existing comparator toprojectSessionTree, 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.tsneeded explicitcreatedAtvalues: it relied on declaration order to place the quiet child behind the cap, and the rows had no creation time.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 throughgateway.controlUi.root: base (7234914d5db) and fix (2bc3d2eaea9). The PR head545a6ecfe82adds only the docs sentence. Each run started from fresh state. The script created a parent "Release coordinator" and 7 children withsessions.create(parentSessionKey,spawnDepth: 1, about 1.1 s apart). It then renamed the children throughsessions.patchin a different order to setupdatedAt. 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 inlocalStorage, expanded the children, and read the rendered rows.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).
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 aftersetSessionSortMode("updated"), and shows "Show 2 more" (child-sessions-cap.ts);projectSessionTreesorts run-folded children with their siblings and keeps link order without a comparator.expected [ 'child-1', 'child-2', … ] to deeply equal [ 'child-2', 'child-4', … ]andexpected [ '1f0f', '4f1f', 'a392', 'd517' ] to deeply equal [ 'd517', 'a392', '1f0f', '4f1f' ]).ui/src/components/app-sidebar*,sidebar-*, and tests using the session tree): 53 files passed, 123 s (--maxWorkers=2).pnpm tsgo:uiclean;oxfmt --checkandoxlint --type-awareon 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 head6b65f1743a4:pnpm testonapp-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 --checkandoxlint --type-awareon 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.