Repository navigation
fix(ui): sidebar sort selection is forgotten after a reload - #124277
Conversation
The sessions sidebar held its sort mode in component state only, so a reload silently reverted the user's Created/Last updated/People choice back to Created while every sibling sidebar preference persisted. Store the mode under openclaw:sidebar:sessions:sort-mode alongside the existing sidebar preference keys and read it back at init. Resolution of a gateway-denied People sort now lives in one helper shared by the render path and the setter, keeping the element net-neutral in lines.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 4:50 PM ET / 20:50 UTC. ClawSweeper reviewWhat this changesThe PR saves the Control UI sidebar session-sort choice in browser storage and restores it when the sidebar is mounted again. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open: current main still resets the sidebar sort on remount, and the focused owner-boundary repair appears correct; required real Control UI proof is still absent. Likely related people: steipete (feature history, high confidence) and Ayaan Zaidi (current-line provenance, medium confidence). Priority: P3 Review scores
Verification
How this fits togetherThe Control UI sidebar receives session rows from the gateway, applies the selected sort mode, and renders the session list. This change makes that UI-only preference survive a reload without changing session ordering or gateway data. flowchart LR
A[User chooses session sort] --> B[Sidebar menu]
B --> C[Sidebar navigation state]
C --> D[Browser preference storage]
D --> E[Sidebar remount]
E --> F[Sorted session list]
Decision needed
Why: The patch is source-correct, but the protected maintainer item and repository UI-proof policy require a human maintainer to assess the real running surface. Before merge
Agent review detailsSecurityNone. PR surfaceSource +57, Tests +22. Total +79 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep persistence in the existing sidebar preference owner, retain Created as the absent-key default, and land after a sanitized real Control UI selection-and-reload proof. Do we have a high-confidence way to reproduce the issue? Yes—current main initializes the mode to Created and only mutates memory, while the menu delegates directly to that setter. The proposed remount regression test is source-reproducible but was not executed in this read-only review. Is this the best way to solve the issue? Yes—the patch uses the existing sidebar browser-preference boundary, validates stored values, keeps the current default, and centralizes the pre-existing People capability rule without changing ordering behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 37763e4d7ef8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
The sessions sidebar held its sort mode in component state only, so a reload silently reverted the user's Created/Last updated/People choice back to Created while every sibling sidebar preference persisted. Store the mode under openclaw:sidebar:sessions:sort-mode alongside the existing sidebar preference keys and read it back at init. Resolution of a gateway-denied People sort now lives in one helper shared by the render path and the setter, keeping the element net-neutral in lines.
Fixes #124273
What Problem This Solves
Fixes an issue where users who pick a sessions-sidebar sort order would silently lose that choice on the next page load. Selecting "Last updated" (or People) in the sidebar's "Sort sessions" menu reorders rows immediately, but the selection is dropped on reload and the sidebar returns to "Created" ordering.
Every other preference in the same sidebar — grouping, Show cron, Show system, the archived/active filter, collapsed sections, and hidden catalogs — already survives a reload, so the sort control was the one odd surface that forgot what the user asked for. Because the revert is silent, the sidebar can look like it is ignoring recent activity when the user believes they already opted into activity-first ordering.
Why This Change Was Made
The sort mode is now stored under
openclaw:sidebar:sessions:sort-modeand read back when the sidebar initializes, using the samelocalStorageload/store pair andopenclaw:sidebar:sessions:*key namespace the sibling preferences already use. No new persistence path was introduced, and no migration is needed: the key is new, and its absence resolves to the existing default.The default is deliberately unchanged. A fresh profile still starts on "Created", which remains the intended stable ordering; this change only makes an explicit user choice durable.
Two smaller decisions worth calling out for reviewers:
resolveSidebarSessionSortModehelper, so a reconnect that temporarily hides the capability still cannot persist a downgrade the user never asked for.Consolidating that duplicated resolution is what kept
app-sidebar-session-navigation.tsnet-neutral in lines; it sits exactly at the 700-line lint ceiling, and nomax-linessuppression was added.Non-goal: this PR does not change how sessions are ordered, and does not touch the recency machinery. That path already works —
updatedAtis stamped at turn admission insrc/gateway/server-methods/agent-session-patch.ts, projected insrc/gateway/session-utils-row.ts, carried on the live change event, and consumed bycompareSessionRowsByUpdatedAt. When "Last updated" is selected, a session that receives a new turn already moves to the top. The only gap being closed here is that the user's choice did not survive a reload.User Impact
Pick a sidebar sort order once and it stays. Users who prefer activity-first ordering can select "Last updated" and keep it across reloads and restarts instead of re-applying it every session.
Existing users are unaffected until they change the setting: with no stored value, the sidebar behaves exactly as it does today.
Evidence
Regression test fails before the fix and passes after. Verified by stashing only the two production files and re-running the same test:
The component-level case mounts the sidebar, selects "Last updated", tears the element down, and remounts it — the remount is what a reload does to this element — then asserts the mode stuck. Store-layer coverage in
app-sidebar-session-types.test.tsadds the default-on-unknown-value case and the gateway-denied People case:Changed-files gate green, including UI typecheck, core test typecheck, lint, formatting, and the max-lines ratchet:
Pre-commit review (
autoreview --mode uncommitted) reported no accepted or actionable findings.LOC delta: production is +32 in
app-sidebar-session-types.ts(storage key, load, resolve, and store helpers, including doc comments) and net 0 inapp-sidebar-session-navigation.ts, where the deduplicated resolution paid for the new wiring. Tests are +47 across two files.