Repository navigation
feat(ui): open sessions in real browser tabs and keep sidebar visibility per-tab - #128474
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Visual proofCaptured from the mocked-gateway Control UI E2E lane at 1280x900 via the repo's own 1. Bare 2. Tab opened directly on one conversation — sidebar collapsed, conversation full-width. This is the Cmd-click-into-a-new-tab result: title, transcript area, and composer span the full window, with the expand control top-left. 3. Same tab after Worth noting how the first capture attempt failed, since it is the reason the test asserts what it does: the initial version waited only for the sidebar to disappear and captured a completely blank pane, because the collapsed chrome paints before the chat pane does. The test now waits on the composer, so it cannot pass against an empty page. |
|
Codex review: found issues before merge. Reviewed August 24, 2026, 3:29 AM ET / 07:29 UTC. ClawSweeper reviewWhat this changesThis PR enables native browser tabs for sidebar sessions, remaps multi-selection to Alt/Option-click, and keeps sidebar visibility only in each tab’s in-memory navigation state. Merge readinessKeep open: the prior P2 remains unresolved because Home’s Cmd/Ctrl-click opens an unmarked main-session URL, so that browser tab stays expanded despite the stated sidebar-tab contract. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe Control UI sidebar produces session links that the browser may open in a new tab; application bootstrap consumes a one-time URL marker to initialize that tab’s sidebar state. The resulting tab-local navigation state controls whether the chat session renders full width or alongside the sidebar. flowchart LR
A[Sidebar session links] --> B[Browser click handling]
B --> C[Native new browser tab]
C --> D[Marked session URL]
D --> E[Control UI bootstrap]
E --> F[Tab-local sidebar state]
F --> G[Full-width chat or visible sidebar]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +72, Tests +309, Docs +2. Total +383 across 21 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the existing collapse-intent helper for Home’s main-session href and prove the native modified-click path collapses once while ordinary Home navigation remains unchanged. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible with high confidence: Cmd/Ctrl-click Home, then observe that its unmarked main-session URL bypasses the collapse initialization path. Is this the best way to solve the issue? No. The shared helper is the right mechanism, but the Home anchor must also use it and receive browser-boundary coverage. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e6915d099adb. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Visual proof (updated for the narrowed trigger)Captured from the mocked-gateway Control UI E2E lane via the repo's own 1. Bare 2. Session opened in a new tab from the sidebar — collapsed, conversation full-width. This is the Cmd-click result: title, transcript area, and composer span the full window, expand control top-left. Reached via the explicit marker; an unmarked deep link to the same session keeps the sidebar. 3. Same tab after 4. After a reload — visibility not persisted, width preserved. The single most useful frame: the sidebar is back (visibility did not survive the reload) and noticeably wider than default, because Note on how these were verified: the first capture attempt asserted only that the sidebar had disappeared, and passed against a completely blank pane — the collapsed chrome paints before the chat pane does. The test now waits on the composer, so it cannot pass against an empty page. |
…tabs Sidebar visibility was persisted in localStorage, which is shared origin-wide, so collapsing it in one tab leaked into every other tab and window on reload. Visibility is view state, not a preference: stop persisting it and keep it in the tab-local navigation snapshot. Width stays persisted. A tab whose first load targets one specific conversation now starts collapsed, seeded once at bootstrap from the canonical session-URL contract so bare /chat and dashboards are unaffected and SPA navigation never re-collapses. Cmd-B, the toggle, hover-peek, and the remote UiCommand path all still work. Cmd/Ctrl-click on a sidebar session row now falls through to the browser so sessions open in a real new tab or window; multi-select moves to Alt/Option- click, which previously fell through to the browser's link-download behavior. Shift-click range selection is unchanged.
Covers the two states that matter: a bare /chat first load keeps the sidebar, and a tab opened directly on one conversation renders that conversation full-width with the sidebar collapsed and Cmd-B restoring it. Waits on the composer, not just the missing sidebar, so the capture cannot pass against a blank pane.
f30ec21 to
9fbbed8
Compare
Rank-up moves: both applied1. Apply the URL intent to catalog-backed sidebar rows. Done — the finding was real. Catalog rows built their chat href through Rather than copy the ordinary row's inline Three sidebar surfaces stay deliberately unmarked, since the question of why siblings are unaffected deserves an answer rather than silence: the Home link ( 2. Add browser coverage for a catalog session opened in a native tab. Done — Also since the last reviewThe branch was rebased onto latest Unrelated but adjacent: Exact-head CI is green on 9fbbed8 (run 32701278397). |
|
Merged via squash.
|
* test(ui): split settings node suite by concern ui/src/app/settings.node.test.ts sat at 999 oxlint-counted lines against the 1000-line max-lines cap, so any added assertion failed the core lint shard — and, as in #128474, could pass locally while only the merge ref tripped the cap. Split the 42-test monolith along the surfaces it actually covers: the base file keeps gateway URL derivation, tab-local token handling, and per-gateway session scoping; preference persistence and layout persistence move to dotted siblings, matching the existing settings.sidebar-prefs.node.test.ts precedent. Test names and count are unchanged (47 across the settings node suites, before and after). The location/base-path/settings-fixture helpers and the storage lifecycle hooks are now shared from ui/src/test-helpers/settings-node.ts instead of being copy-pasted per file; sidebar-prefs drops its duplicate copies too. * test(node-host): write fake container-engine state atomically checks-node-compact-large-3 failed twice on this branch in different tests of node-worker-supervisor.container.test.ts, most recently with "SyntaxError: Unexpected end of JSON input" raised from the fake engine's load() while the supervisor ran `docker rm --force`. The shim saved container state with a truncating fs.writeFileSync while sibling shim invocations (rm, inspect, wait, ps) read the same path, so a reader could observe the zero-length window and exit 1. Write to a ".pending" sibling and rename over the target instead; rename is atomic, so readers always see a complete previous or next state. The ps handler filters on the ".container.json" suffix, so pending files are ignored. A concurrent write/read probe over the old pattern produced 2014 partial reads in 212900; the same probe over write-then-rename produced 0 in 203468. Not reproducible end-to-end on macOS, where the truncation window is far narrower than on the loaded Linux shard.
…ity per-tab (openclaw#128474) * feat(ui): make sidebar visibility per-tab and free Cmd-click for new tabs Sidebar visibility was persisted in localStorage, which is shared origin-wide, so collapsing it in one tab leaked into every other tab and window on reload. Visibility is view state, not a preference: stop persisting it and keep it in the tab-local navigation snapshot. Width stays persisted. A tab whose first load targets one specific conversation now starts collapsed, seeded once at bootstrap from the canonical session-URL contract so bare /chat and dashboards are unaffected and SPA navigation never re-collapses. Cmd-B, the toggle, hover-peek, and the remote UiCommand path all still work. Cmd/Ctrl-click on a sidebar session row now falls through to the browser so sessions open in a real new tab or window; multi-select moves to Alt/Option- click, which previously fell through to the browser's link-download behavior. Shift-click range selection is unchanged. * test(ui): prove per-tab sidebar visibility at the browser boundary Covers the two states that matter: a bare /chat first load keeps the sidebar, and a tab opened directly on one conversation renders that conversation full-width with the sidebar collapsed and Cmd-B restoring it. Waits on the composer, not just the missing sidebar, so the capture cannot pass against a blank pane. * fix(ui): narrow new-tab sidebar collapse intent * fix(ui): collapse sidebar for catalog sessions opened in new tabs * test(ui): split bootstrap navigation visibility coverage
* test(ui): split settings node suite by concern ui/src/app/settings.node.test.ts sat at 999 oxlint-counted lines against the 1000-line max-lines cap, so any added assertion failed the core lint shard — and, as in openclaw#128474, could pass locally while only the merge ref tripped the cap. Split the 42-test monolith along the surfaces it actually covers: the base file keeps gateway URL derivation, tab-local token handling, and per-gateway session scoping; preference persistence and layout persistence move to dotted siblings, matching the existing settings.sidebar-prefs.node.test.ts precedent. Test names and count are unchanged (47 across the settings node suites, before and after). The location/base-path/settings-fixture helpers and the storage lifecycle hooks are now shared from ui/src/test-helpers/settings-node.ts instead of being copy-pasted per file; sidebar-prefs drops its duplicate copies too. * test(node-host): write fake container-engine state atomically checks-node-compact-large-3 failed twice on this branch in different tests of node-worker-supervisor.container.test.ts, most recently with "SyntaxError: Unexpected end of JSON input" raised from the fake engine's load() while the supervisor ran `docker rm --force`. The shim saved container state with a truncating fs.writeFileSync while sibling shim invocations (rm, inspect, wait, ps) read the same path, so a reader could observe the zero-length window and exit 1. Write to a ".pending" sibling and rename over the target instead; rename is atomic, so readers always see a complete previous or next state. The ps handler filters on the ".container.json" suffix, so pending files are ignored. A concurrent write/read probe over the old pattern produced 2014 partial reads in 212900; the same probe over write-then-rename produced 0 in 203468. Not reproducible end-to-end on macOS, where the truncation window is far narrower than on the loaded Linux shard.







What Problem This Solves
Operators who want one conversation per browser tab or window could not get there. Cmd-clicking a session in the sidebar did not open a new tab — the click was captured for multi-selection — so the browser's own tab, window, and virtual-desktop workflow was unreachable even though every session already has a stable deep-linkable URL.
Sidebar visibility also leaked between tabs. It was stored in
localStorage, which is shared origin-wide, so collapsing the sidebar in one tab silently collapsed it in every other tab and window on their next load.Why This Change Was Made
Three coupled changes.
Cmd/Ctrl-click reaches the browser. The sidebar row's real
<a href>now handles the click, so a session opens in a native tab or window. Multi-selection moves to Alt/Option-click, which previously fell through to the browser's link-download behavior; Shift-click range selection is unchanged.Sidebar visibility is per-tab and no longer persisted. Visibility is view state, not a preference, so it lives in the tab-local navigation snapshot. Width stays persisted — persist the size, not the visibility, since re-dragging a sidebar is expensive while re-showing it is one keystroke.
A tab opened on a conversation from the sidebar starts collapsed. This is gated on explicit new-tab intent, not on the URL alone: the row href carries a marker (
SIDEBAR_SESSION_NAV_COLLAPSE_QUERY, defined once inui/src/app-session-route-paths.tsand read by bootstrap), which only the browser's own new-tab paths use verbatim — ordinary left-clicks are already intercepted for SPA routing and never see it. Bootstrap seeds the collapse once, then strips the marker withreplaceStateso the address bar, copied links, and bookmarks stay canonical and a reload does not re-collapse.An earlier revision of this PR collapsed on any first load of a session URL. That was too broad: direct session-URL loads are a common entry path (deep links, notifications, bookmarks), and combined with non-persistence a user whose habitual entry is a bookmarked session would have been collapsed on every visit with no way to make it stick. The E2E lane caught it, and the trigger was narrowed to explicit intent.
Non-goals: no in-app tab strip, and no macOS app changes.
Cmd-Tcannot be bound on the web at all — browsers reserve it — so native window/tab work is tracked separately.User Impact
Cmd-click a session in the sidebar and it opens in a real browser tab; drag it to another window or desktop and it behaves like any other page. Those tabs start with the sidebar collapsed for full width, and
Cmd-Bbrings it back. Ordinary session links and bookmarks are unaffected and keep the sidebar visible. Collapsing the sidebar in one tab no longer affects your other tabs or windows.Multi-select in the sidebar is now Alt/Option-click instead of Cmd-click. Shift-click still extends a range, and the right-click menu still exposes the batch actions.
Evidence
Production diff stays small: production +46/-20 across the branch, with growth in tests (+281/-49) and docs (+4/-2).
f249f7d49c6(run 32691071503).node scripts/check-changed.mjsgreen acrosscoreTests,ui, anddocslanes (format, typecheck, lint, Knip dead-code).bootstrap.test.ts,settings.node.test.ts,settings.sidebar-prefs.node.test.ts,app-sidebar.test.ts.keeps the sidebar expanded for an unmarked chat-session deep link(the narrowing) and the bare-/chatseeding case (the main-surface default path).Two tests were updated rather than preserved because they asserted behavior this PR intentionally removes: the reload segment of
sidebar-customization.e2e.test.tsasserted persisted visibility (its capture is renamed04-visibility-not-persisted.pngand now proves the opposite), anddevice-scope-upgrade.e2e.test.tsnow reaches its collapsed layout through the shared marker constant.