Repository navigation
fix(sidebar): leave Split View on a plain New chat (#21935) - #21959
Conversation
UX Review (Opus 5.5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS No first-time user has looked at this: the three committed screenshots cover the before split, the after single pane and the flyout error notice, but this lane has no blind read. Watch
[UX-REVIEWED] cb9a1c4 Description read[DESCRIPTION-READ] 2498052a5788431daad7d9b7fa750d8c2efb2afdcbbf6cfb2af89242fa95c647 That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the #22060 follow-up reuses this same active-slot-guarded [DESIGN-REVIEWED] cb9a1c4 Description read[DESCRIPTION-READ] 6fee79567bffc4566b26fe7222277956d0dff6bf5d5226433bfb7bb75c0364a4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The flyout error notice is outside the Goal and maps errors differently from its own file; the split exit is patched per call site while the cause sits in one place. Not justified as shipped
What this change shipsInventory (6 items) — 4 justifiedIntent: FIX. Creating a chat from the sidebar while Split View is on shows the new chat.
[FIRST-PRINCIPLES-REVIEWED] cb9a1c4 Description read[DESCRIPTION-READ] 11cf37172804a97934ac383e38fe386e023deb984ce860952f26ec4eba34a4a7 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
iamwhatever
left a comment
There was a problem hiding this comment.
Changes requested. Reviewed head 82752ec.
- Defect: the creates call
onSelectSlot(slot.key)whenever the create returns a key (create.ts:105, also L263 and L323). ButcreateSlot.fulfilleddeclines to activate when the user moved to another session while the create was pending. In that case ChatPage still leaves Split View and closes the crew window, and the embedded Sessions frame navigates to a session the user did not open. Smallest fix: call the callback only whenstore.getState().chat.activeSlot === slot.key, and add a switched-away test. - The UX and Design CONCERNS on this head have no dispositions. Design names the collapsed sidebar's flyout New (paneLayout.tsx:200-207), which still keeps the old split. Please fix it or answer it, and answer each UX Watch item.
Note: #21971 fixes the same issue and already has the active-slot guard. A maintainer has to choose one PR.
— crew-pr-reviewer (r111)
…w leaves split Address the CHANGES_REQUESTED review on kirodotdev#21959. - The create paths fired onSelectSlot whenever the create returned a key, but createSlot.fulfilled declines to activate when the user switched to another session while the create was pending. Firing the callback then left Split View and navigated the embedded Sessions frame onto a session the user never opened. Gate all three sidebar call sites (header New, folder New, incognito/temporary) on store.getState().chat.activeSlot === slot.key, so the host only leaves the split when the new slot is active. - The collapsed sidebar's flyout New activated a new slot without leaving the split, unlike its row switch (flyoutSwitch, which calls setSplitMode(false)). Make flyoutNew leave the split too, gated by the same active-slot check. - Tests: switched-away cases for header and folder New (new slot not activated, onSelectSlot not fired); flyout New leaves the split on activation and keeps it when switched away.
|
Re: review of 82752ec — addressed in 498b49a. Point 1 (defect — the callback fired even when the create declined to activate). Fixed in 498b49a. All three sidebar create paths in Point 2 (flyout New had no disposition / still kept the old split). Fixed in 498b49a. Point 2 (the other create paths). The shortcut and command-palette creates — The active-slot guard is now present in this PR as well. |
|
UX review dispositions (for the CONCERNS on 82752ec; fixed head 498b49a). Watch 1 — the split closes without notice. No code change, as suggested. This matches the existing session-row click behaviour (a plain selection leaves the split), so it is consistent rather than surprising. Ctrl/Cmd-click and middle-click still create in a background tab and keep the split (covered by the existing background-tab tests). And reopening the split's anchor session restores the saved split automatically — verified on this branch: when the active slot is a live split anchor, Watch 2 — only the header New is captured. A real New-incognito-from-inside-a-split capture could not be produced in this environment: there is no committed capture entry that renders the split-view grid with the create menu, so photographing the New-incognito "after" state would require standing up new capture scaffolding that is itself untested code outside this PR's scope. The create path New incognito takes is identical to the header New already captured ( |
|
Design review dispositions (for the CONCERNS on 82752ec; fixed head 498b49a). Took the first of the two options you listed ("either
accepted and deferred to #22060 |
498b49a to
bfcee43
Compare
…w leaves split Address the CHANGES_REQUESTED review on kirodotdev#21959. - The create paths fired onSelectSlot whenever the create returned a key, but createSlot.fulfilled declines to activate when the user switched to another session while the create was pending. Firing the callback then left Split View and navigated the embedded Sessions frame onto a session the user never opened. Gate all three sidebar call sites (header New, folder New, incognito/temporary) on store.getState().chat.activeSlot === slot.key, so the host only leaves the split when the new slot is active. - The collapsed sidebar's flyout New activated a new slot without leaving the split, unlike its row switch (flyoutSwitch, which calls setSplitMode(false)). Make flyoutNew leave the split too, gated by the same active-slot check. - Tests: switched-away cases for header and folder New (new slot not activated, onSelectSlot not fired); flyout New leaves the split on activation and keeps it when switched away.
|
Fixed in bfcee43.
|
|
Note after rebase: the branch was rebased onto current main (origin/main |
A session-row click reports through onSelectSlot, which the chat page answers by leaving Split View and showing the clicked session. The sidebar create paths (header New, folder New chat, New incognito/ temporary, phone drawer) activated the new session but never fired onSelectSlot, so the grid kept drawing the old split over a session that was already active. Thread onSelectSlot into the create hooks and fire it on every plain create. The open-as-a-background-tab gesture (Cmd/Ctrl/middle-click) deliberately does not fire it, so it keeps the split as before. Adds a vitest regression (plain creates leave the split, tab-gesture creates keep it) and a real before/after capture harness.
…w leaves split Address the CHANGES_REQUESTED review on kirodotdev#21959. - The create paths fired onSelectSlot whenever the create returned a key, but createSlot.fulfilled declines to activate when the user switched to another session while the create was pending. Firing the callback then left Split View and navigated the embedded Sessions frame onto a session the user never opened. Gate all three sidebar call sites (header New, folder New, incognito/temporary) on store.getState().chat.activeSlot === slot.key, so the host only leaves the split when the new slot is active. - The collapsed sidebar's flyout New activated a new slot without leaving the split, unlike its row switch (flyoutSwitch, which calls setSplitMode(false)). Make flyoutNew leave the split too, gated by the same active-slot check. - Tests: switched-away cases for header and folder New (new slot not activated, onSelectSlot not fired); flyout New leaves the split on activation and keeps it when switched away.
799a0b3 to
0d5cda0
Compare
0d5cda0 to
ac9b7bb
Compare
|
First Principles review (comment 6254750490), on head ac9b7bb. Fixed in ac9b7bb. You're right that the flyout can't open while Split View is on — Removed exactly that dead path on this head:
The |
|
UX review (comment 6254748135), on head ac9b7bb. On the two Watch points:
|
- The create paths fired onSelectSlot whenever the create returned a key, but createSlot.fulfilled declines to activate when the user switched to another session while the create was pending. Firing the callback then left Split View and navigated the embedded Sessions frame onto a session the user never opened. Gate all three sidebar call sites (header New, folder New, incognito/temporary) on store.getState().chat.activeSlot === slot.key, so the host only leaves the split when the new slot is active. - The collapsed sidebar's flyout New surfaces a readable notice when its create rejects: createSlot.rejected only clears the pending flag and focusComposerAfter swallows the rejection, so the create would otherwise fail silently. Only an ApiError's message is user-facing copy (apiFailure builds it with friendlyErrText); a raw thrown exception falls back to a readable sentence rather than leaking developer text. - Tests: switched-away cases for header and folder New (new slot not activated, onSelectSlot not fired); flyout New shows an ApiError's message and falls back for a raw exception.
ac9b7bb to
cb9a1c4
Compare
|
UX review (comment 6254748135), on head cb9a1c4. Added a real screenshot of the collapsed-sidebar flyout New failure, and tightened the notice copy:
Could you take another look (UX re-review)? Thanks. |
|
Design review (comment 6254748905): Design passed. The shared leave-split suggestion (other create paths that activate a new slot under the old Split View) is tracked as a follow-up in #22060. |
kirodotdev#21959 made every plain sidebar create report the new session through the host's onSelectSlot, so ChatPage leaves Split View. Duplicate (Fork chat) still switched to the fork with switchSlot and never told the host, so in Split View the fork became the active session behind the two old panes. useSessionActions now takes an optional onOpened callback and calls it after the fork's switchSlot. ChatSidebar passes its onSelectSlot. Callers that pass nothing (SessionActionsMenu, the command palette) do not use Duplicate and are unchanged. A refused fork reports nothing. Part of kirodotdev#21935
#21959 made every plain sidebar create report the new session through the host's onSelectSlot, so ChatPage leaves Split View. Duplicate (Fork chat) still switched to the fork with switchSlot and never told the host, so in Split View the fork became the active session behind the two old panes. useSessionActions now takes an optional onOpened callback and calls it after the fork's switchSlot. ChatSidebar passes its onSelectSlot. Callers that pass nothing (SessionActionsMenu, the command palette) do not use Duplicate and are unchanged. A refused fork reports nothing. Part of #21935
Problem / Motivation
Goal: Creating a chat from the sessions sidebar while Split View is open now shows that new chat, instead of leaving the old split on screen.
With Split View (Session Grid) on, every plain New chat from the sessions sidebar activates the new session — the URL and window title name it — but the grid keeps drawing the old split, so the user sees two old conversations where a blank one was expected. It happens for every plain create: the folder header
+, an empty folder's "New chat in " row, the New menu's folder entry, the header New button, New incognito / New temporary, and the phone sessions drawer. A session-row click does not have the problem.Why it matters
A session that anchors a saved split opens straight into that split, so anyone working from such a session gets the old panes back every time they create a chat from the sidebar — easy to hit without ever pressing Ctrl+D. It affects every Split View user; single-chat users (desktop and phone) are unaffected.
Not a goal
What changed (motivation → approach → change)
Root cause: a session-row click reports through the sidebar's
onSelectSlotcallback, which the chat page answers by leaving Split View (clearSplitOnSelect→setSplitMode(false)). The create paths inwebsite/src/pages/chat-sidebar/create.tsnever called that callback, so the split stayed drawn over a session that was already active.Change: thread the sidebar's existing
onSelectSlotinto the two create hooks (useFolderChatCreate,useSessionCreate) and fire it on every plain create (header New, folder New chat, New incognito / New temporary, and the phone drawer — all share the sameChatSidebarinstance), guarded on the live active slot so a create the user switched away from mid-flight does not strand them. The background-tab gesture deliberately does not fire it, mirroring the session rows' own tab gesture, so it keeps the split as before.Foreground tab (Cmd/Ctrl+Shift): a foreground-tab create switches the view onto the new session, so it must leave Split View too. The header New already fired the guarded callback after its foreground switch; the folder create path did not — the folder foreground-tab branch now fires the same active-slot-guarded
onSelectSlotafteronOpenSlotInNewTabfor every mode exceptbackground, matching the header New.backgroundstill keeps the split. (The other create paths were checked: header New already handles this; incognito/temporary have no tab gesture; the remote-crew create never firesonSelectSlotby design.)Flyout New (collapsed-sidebar flyout,
website/src/pages/chat/page/paneLayout.tsx): a failed flyout create used to fail silently; it now shows the same error notice the other create paths show (showActionError). The flyout New is never a split-exit case — it cannot open while Split View is on, becauseflyoutEligibleis false there (website/src/pages/chat/page/sessionsDrawer.ts), so it has no split to leave.In the embedded sessions-only view (
/embed/sessions),onSelectSlotisnavigateToEmbeddedSlot, so a plain create there now opens the new chat exactly as a row click does — the correct outcome, since that view has no tab strip and every create is plain.Backwards compatibility
Compatible: the change only adds a call to an already-wired optional callback on code paths that previously made none, plus a failure notice where a create used to fail silently; no field, type, validator, or key changes.
Removes nothing: no capability, path, record, or key is removed, hidden, or renamed — the background-tab gesture and single-chat behaviour are unchanged.
Tests
website/src/test/ChatSidebar.newChatLeavesSplit.test.tsxdrives the realcreateSlotthunk through the sidebar's New button, caret menu (incognito/temporary) and folder create, and locks in: a plain create firesonSelectSlotwith the new key (so the host leaves Split View) and activates it; the background-tab gesture (Ctrl/middle-click) does not fire it and keeps the user on the origin session; the switched-away guard (header and folder) does not activate or fire the callback when the user moved mid-create; and a foreground-tab folder create (Cmd/Ctrl+Shift) firesonSelectSlotand leaves the split while a background-tab folder create keeps it.website/src/test/paneLayout.flyoutNewLeavesSplit.test.tsxcovers the flyout New path: a failed create surfaces the error notice, and a create closes the flyout and activates the new session.Manual verification
Real before/after capture via
website/scripts/capture-21935-split-view-new-chat.mjs(drives the built SPA): enter Split View on session A, fill the second pane with session B, then click the sidebar's New button — the split collapses to the single new session. The harness also asserts the split is gone afterward.Screenshots / video
Related Issues
Fixes #21935
Follow-up: #22060 (keyboard-shortcut, command-palette and quick-actions create paths)
Pattern harvest
Not generalizable: create-path sites that omitted the leave-split callback the row-click path already fires; the new tests pin the parity for the sidebar and flyout surfaces.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)