Skip to content

fix(sidebar): leave Split View on a plain New chat (#21935) - #21959

Merged
iamwhatever merged 2 commits into
kirodotdev:mainfrom
chenmingwei23:fix/21935-split-view-new-chat
Oct 20, 2026
Merged

iamwhatever merged 2 commits into
kirodotdev:mainfrom
chenmingwei23:fix/21935-split-view-new-chat

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Changing the open-as-a-background-tab gesture (Cmd/Ctrl-click, middle-click), which should keep the split because the user asked to stay where they are.
  • Any change to single-chat behaviour or to the session-row click path (which already leaves the split).
  • Fixing the keyboard-shortcut, command-palette, and quick-actions create paths, which activate a new slot the same way but reach the split through different wiring. Tracked as a follow-up in Other create paths still activate a new slot under the old Split View (follow-up to #21959) #22060.

What changed (motivation → approach → change)

Root cause: a session-row click reports through the sidebar's onSelectSlot callback, which the chat page answers by leaving Split View (clearSplitOnSelect → setSplitMode(false)). The create paths in website/src/pages/chat-sidebar/create.ts never called that callback, so the split stayed drawn over a session that was already active.

Change: thread the sidebar's existing onSelectSlot into 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 same ChatSidebar instance), 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 onSelectSlot after onOpenSlotInNewTab for every mode except background, matching the header New. background still 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 fires onSelectSlot by 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, because flyoutEligible is false there (website/src/pages/chat/page/sessionsDrawer.ts), so it has no split to leave.

In the embedded sessions-only view (/embed/sessions), onSelectSlot is navigateToEmbeddedSlot, 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.tsx drives the real createSlot thunk through the sidebar's New button, caret menu (incognito/temporary) and folder create, and locks in: a plain create fires onSelectSlot with 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) fires onSelectSlot and leaves the split while a background-tab folder create keeps it.

website/src/test/paneLayout.flyoutNewLeavesSplit.test.tsx covers 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

  • Before — Split View on, two panes: temp-screenshots/21935-split-view-new-chat/01-split-view-two-panes-before.png
  • After — plain New chat leaves the split, new session shown: temp-screenshots/21935-split-view-new-chat/02-split-left-new-session-after.png
  • Flyout New, create failed — clicking New closes the flyout, so the failure lands in the page's error banner above the chat pane (shown over the collapsed sessions sidebar). The notice shows a readable message, not raw error text: temp-screenshots/21935-split-view-new-chat/03-flyout-new-create-failed-notice.png

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — 🟡 CONCERNS

UX-level review of cb9a1c432bc6e75dcb2a9a66b972bde23b5270df via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • The split closes with no recording. onSelectSlot?.(slot.key) turns two panes (attachment-01) into one new session (attachment-02) as soon as New is clicked. The PR reuses the switch a session-row click already makes. It adds no new layout swap, so this isn't a lens-13 block. Severity is low: every Split View user sees it on each plain create, but the layout comes back when they reopen the session that anchors the split. A human should check that the split doesn't simply vanish. A short recording of the New click in Split View would settle it.
  • The other create paths have no screenshots. The folder +, the "New chat in " row, New incognito / New temporary and the phone drawer are only covered by tests. They call the same callback, so the risk is low. One phone-drawer still would confirm the drawer closes onto the new chat.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of cb9a1c432bc6e75dcb2a9a66b972bde23b5270df via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that the #22060 follow-up reuses this same active-slot-guarded onSelectSlot call, so the keyboard, palette and quick-actions create paths leave Split View the same way.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of cb9a1c432bc6e75dcb2a9a66b972bde23b5270df via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • Item 4 — oversized, rides along: the Goal is "shows that new chat, instead of leaving the old split on screen", and the description itself says the flyout "is never a split-exit case". The diff adds a second error mapping (name === 'ApiError' duck-typing) beside paneLayout.tsx:298's fail, which deliberately keeps the raw text "the error journal matches".
    Subtraction: drop the created.catch(...) block from flyoutNew, or reduce it to the existing fail mapping (errMessage(error) || unknown_error).
    Clears when: the block is removed, or a human amends the Goal.
  • Item 1 — symptom-level: the PR adds 4 onSelectSlot?.(slot.key) calls in create.ts, and the description defers 3 more paths to Other create paths still activate a new slot under the old Split View (follow-up to #21959) #22060 (shellKeyboard.ts:52, paletteActions.ts:110, actionsProvider.ts:194; EmbedTabStrip.tsx:100 also creates). The cause is that split mode never follows a change of activeSlot. activeSlotState.ts:207-211 already reacts to activeSlot moves to close the crew window, so one rule there ("leave split when the active slot is not in the grid") would replace every per-site call.
    Clears when: the description says why the per-site form was chosen over the activeSlotState.ts effect (for example, split-anchor restore conflicts), or the calls are replaced by that one effect.

What this change ships

Inventory (6 items) — 4 justified

Intent: FIX. Creating a chat from the sidebar while Split View is on shows the new chat.

  1. A plain New chat (header, folder, incognito/temporary, phone drawer) leaves Split View — symptom-level
  2. A foreground-tab folder create leaves Split View; a background-tab create keeps it — justified
  3. A create the user switched away from mid-flight no longer leaves the split — justified
  4. A failed flyout New now shows an error notice — rides along, oversized
  5. In the embedded sessions view, a plain create navigates to the new chat — justified
  6. A capture harness script plus review screenshots — justified

[FIRST-PRINCIPLES-REVIEWED] cb9a1c4

Description read

[DESCRIPTION-READ] 11cf37172804a97934ac383e38fe386e023deb984ce860952f26ec4eba34a4a7

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed cb9a1c432bc6e75dcb2a9a66b972bde23b5270df via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] cb9a1c4

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed cb9a1c432bc6e75dcb2a9a66b972bde23b5270df via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] cb9a1c4

@chenmingwei23
chenmingwei23 marked this pull request as ready for review October 18, 2026 21:38
@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 18, 2026 21:38
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 18, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. Reviewed head 82752ec.

  1. Defect: the creates call onSelectSlot(slot.key) whenever the create returns a key (create.ts:105, also L263 and L323). But createSlot.fulfilled declines 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 when store.getState().chat.activeSlot === slot.key, and add a switched-away test.
  2. 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)

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 19, 2026
chenmingwei23 pushed a commit to chenmingwei23/KiroCrew that referenced this pull request Oct 19, 2026
…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.
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

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 website/src/pages/chat-sidebar/create.ts (header New, folder New, New incognito/temporary) now call the leave-split callback only when store.getState().chat.activeSlot === slot.key. So when createSlot.fulfilled takes its switched-away path (the user moved to another session while the create was pending) and leaves activeSlot on the old session, the callback no longer fires, Split View stays, and the embedded Sessions frame does not navigate onto a session the user never opened. Added a switched-away test for the header and folder paths (website/src/test/ChatSidebar.newChatLeavesSplit.test.tsx): create held pending, active slot moved, create resolved → the new slot is not activated and the callback is not fired.

Point 2 (flyout New had no disposition / still kept the old split). Fixed in 498b49a. flyoutNew (website/src/pages/chat/page/paneLayout.tsx) now leaves Split View the same way the flyout's row switch flyoutSwitch already does (setSplitMode(false)), gated on the same active-slot check as point 1. New test website/src/test/paneLayout.flyoutNewLeavesSplit.test.tsx: flyout New leaves the split on activation, and keeps it when the user switched away mid-create.

Point 2 (the other create paths). The shortcut and command-palette creates — website/src/shell/shortcuts/shellKeyboard.ts, website/src/components/commandPalette/paletteActions.ts, website/src/components/commandPalette/providers/actionsProvider.ts — are deferred to #22060 (with both the per-caller and the page-level-invariant options written up), to keep this PR scoped to the sidebar and flyout.

The active-slot guard is now present in this PR as well.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

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, paneLayout.tsx auto-enters split (activeIsSplitAnchor → enterSplit), and SessionGridView restores that anchor's saved layout from splitLayoutStore. So the close is recoverable in one click.

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 (02-split-left-new-session-after.png) — same onSelectSlot call, now gated on the active slot — and that equivalence is additionally pinned by the unit tests (New incognito fires the callback with the new key; switched-away paths do not). So the behaviour is covered even though a second screenshot is not included here.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Design review dispositions (for the CONCERNS on 82752ec; fixed head 498b49a).

Took the first of the two options you listed ("either flyoutNew also leaves the split … with the shortcut and command-palette creates listed as known follow-ups"):

  • flyoutNew — fixed in 498b49a. The collapsed sidebar's own New now leaves Split View like its row switch flyoutSwitch (setSplitMode(false)), gated on the new slot being the active one (same guard as the sidebar create paths), so it does not leave Split View when the user switched away mid-create. Test: website/src/test/paneLayout.flyoutNewLeavesSplit.test.tsx.

  • shellKeyboard.ts, paletteActions.ts, actionsProvider.ts — filed as known follow-ups in Other create paths still activate a new slot under the old Split View (follow-up to #21959) #22060, which also writes up the page-level-invariant option (a newly activated non-grid slot leaves Split View, placed next to the activeSlotState.ts active-slot check, preserving saved-split anchors with a test for an outside-the-sidebar create). We kept the page-level move out of this PR because it is larger and touches the saved-split anchor paths; this PR stays scoped to the sidebar and flyout.

accepted and deferred to #22060

@chenmingwei23
chenmingwei23 force-pushed the fix/21935-split-view-new-chat branch from 498b49a to bfcee43 Compare October 19, 2026 04:52
chenmingwei23 pushed a commit to chenmingwei23/KiroCrew that referenced this pull request Oct 19, 2026
…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.
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Fixed in bfcee43.

flyoutNew in website/src/pages/chat/page/paneLayout.tsx no longer swallows a failed create. Its rejection handler now calls showActionError(errMessage(error) || i18nT('pages.chatPage.unknown_error')), and showActionError is in the useCallback dependency list. Confirmed there is no double notice: createSlot.rejected only clears the pending flags and focusComposerAfter swallows the rejection (it governs focus only), so this is the sole surface for a flyout-create failure. Added a test (website/src/test/paneLayout.flyoutNewLeavesSplit.test.tsx): a rejected flyout New shows the error notice and does not leave the split.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Note after rebase: the branch was rebased onto current main (origin/main 1862203b8c) because a recent main change added a const store to the same hook, which broke the merged build. The fixes described in my earlier per-point replies — point 1 (active-slot guard on the three sidebar create paths) and point 2 (flyout New leaves the split) — now live at bfcee43187, together with the GPT 6.1 error-notice fix. Nothing in those earlier replies changed in substance; only the sha moved.

@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Oct 19, 2026
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.
chenmingwei23 pushed a commit to chenmingwei23/KiroCrew that referenced this pull request Oct 19, 2026
…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.
@chenmingwei23
chenmingwei23 force-pushed the fix/21935-split-view-new-chat branch from 799a0b3 to 0d5cda0 Compare October 19, 2026 17:33
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 19, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/21935-split-view-new-chat branch from 0d5cda0 to ac9b7bb Compare October 19, 2026 18:38
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

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 — flyoutEligible is !isMobile && !isTouchDevice() && !splitMode (website/src/pages/chat/page/sessionsDrawer.ts), so the flyout New had no split to leave and the setSplitMode(false) call changed nothing.

Removed exactly that dead path on this head:

  • the .then(... setSplitMode(false)) branch in flyoutNew (website/src/pages/chat/page/paneLayout.tsx),
  • the setSplitMode field on PanelLayoutOptions,
  • the setSplitMode argument passed from ChatPage.tsx,
  • the two flyout "leaves split" tests.

The .catch → showActionError error notice stays (and its test), since a failed flyout create would otherwise be a silent no-op.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

UX review (comment 6254748135), on head ac9b7bb.

On the two Watch points:

  • The failure notice uses the same copy path as the other create paths — showActionError(errMessage(error) || 'unknown error') — so a failed flyout New reads identically to a failed header/folder/mobile New, no new wording.
  • Leaving Split View on a plain New chat is the same answer a session-row click already gives (the row click goes through onSelectSlot → clearSplitOnSelect → setSplitMode(false)). Sidebar New chat in Split View leaves the old sessions on screen #21935 asks for the sidebar's New to show the new chat rather than keep the old split on screen, so matching the row-click behaviour is the fix, not a new behaviour.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 19, 2026
- 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.
@chenmingwei23
chenmingwei23 force-pushed the fix/21935-split-view-new-chat branch from ac9b7bb to cb9a1c4 Compare October 19, 2026 20:30
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

UX review (comment 6254748135), on head cb9a1c4.

Added a real screenshot of the collapsed-sidebar flyout New failure, and tightened the notice copy:

  • Screenshot: temp-screenshots/21935-split-view-new-chat/03-flyout-new-create-failed-notice.png. Clicking New closes the flyout, so the failure lands in the page's error banner above the chat pane (shown over the collapsed sessions sidebar).
  • Shown text: "The agent runtime is unavailable. Try again." (from a stubbed 500).
  • Mapping (Watch point: raw error text): flyoutNew now shows only user-facing copy. An ApiError's message is already friendly (built by friendlyErrText, which unwraps the backend's { error | detail | message }), so it is shown as-is; anything else — a raw thrown exception — falls back to "Could not start a new session" instead of leaking developer text.

Could you take another look (UX re-review)? Thanks.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 19, 2026
@iamwhatever
iamwhatever merged commit efa4936 into kirodotdev:main Oct 20, 2026
101 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 20, 2026
Pearcekieser added a commit to Pearcekieser/KiroCrew that referenced this pull request Oct 20, 2026
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
iamwhatever pushed a commit that referenced this pull request Oct 20, 2026
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sidebar New chat in Split View leaves the old sessions on screen

2 participants