Skip to content

fix(sidebar): leave Split View when Fork chat opens the fork - #21971

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/folder-new-session-old-chat
Oct 20, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/folder-new-session-old-chat

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Fork chat from the sessions sidebar shows the fork on screen, also when Split View is showing.

#21959 made a plain New chat leave Split View. Fork chat (Duplicate) was not covered: in Split View it makes the fork the active session, and the URL and title name it, but the grid keeps drawing the two old panes, so the fork stays hidden behind them.

Why it matters

A user who forks a chat from the sidebar while Split View is up sees the old conversations instead of the fork, the same symptom #21935 reported for New chat.

Not a goal

What changed (motivation → approach → change)

A session row click reports through the sidebar's onSelectSlot, and ChatPage leaves Split View from it (clearSplitOnSelect). #21959 made every plain create report the same way. Duplicate goes through useSessionActions, which switched to the fork with switchSlot and never called that callback.

useSessionActions (website/src/hooks/useSessionActions.ts) now takes an optional onOpened callback and calls it after the fork's switchSlot. ChatSidebar (website/src/pages/ChatSidebar.tsx) passes its onSelectSlot, so a fork leaves Split View the same way a row click does. The other callers, SessionActionsMenu and the command palette, pass nothing and do not use Duplicate. A refused fork reports nothing.

In the embedded Sessions frame, whose onSelectSlot is navigateToEmbeddedSlot (SessionsSidebarChrome.tsx), a fork now opens the fork's chat there, the same as clicking its row. #21959 already does the same for a plain create in that frame.

Backwards compatibility

Compatible: useSessionActions takes one new optional argument, and a caller that passes none behaves exactly as before.

Removes nothing: the change only adds a callback call after a successful fork.

Tests

website/src/test/ChatSidebar.forkChatAction.test.tsx gains two cases:

  • A fork that opens is reported through onSelectSlot with the fork's key. This case fails on main.
  • A refused fork (ok: false) reports nothing.

The file passed 3 shuffled runs (seeds 1 to 3, 3 of 3 each). With ChatSidebar.newChatLeavesSplit, ChatSidebar.folderCreateInTab and ChatSidebar.newChatInTab, 37 tests pass. Fork reviews of the earlier, wider version of this PR on 38a6673530 (Opus 5.5 and GPT 6.1) found nothing in this change.

Manual verification

N/A for a new pod run. The Split View exit is the same clearSplitOnSelect path #21959 verified on screen; this PR only adds the call from Duplicate, and the unit test drives the real sidebar row's Fork chat button.

Screenshots / video

Why no screenshot: the fork lands on the same single-chat view a row click on that session already shows, and no control, layout or copy changes.

Related Issues

Part of #21935. That issue was closed by #21959. This PR covers the Fork chat sibling the review on this PR asked for, and the collapsed-folder report stays unreproduced.

Pattern harvest

Rule candidate: review-prompt
Pattern: a sidebar action that changes the active session without going through the host's onSelectSlot, so host-owned view state (Split View, crew window, embedded navigation) is never told.

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

@Pearcekieser
Pearcekieser requested review from a team and KiroCrewCaptain as code owners October 18, 2026 22:30
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 18, 2026
@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 70a6b006c1487b55e1631bffa8e7e8ace2672ba9 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 embedded sidebar's onSelectSlot (navigateToEmbeddedSlot) should also navigate to the fork after Duplicate. That host now hears about forks too.

[DESIGN-REVIEWED] 70a6b00

Description read

[DESCRIPTION-READ] 31ac38a918ef19977a4dc0b36c4506d511979c4f8e7201a7a20b945a193aa0ed

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

UX Review (Opus 5.5, fork) — ✅ PASS

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

UX-Verdict: PASS

Check by hand: Fork chat in Split View should leave the split and show the fork, the same way a row click does. The PR attaches no screenshot or recording of it.

[UX-REVIEWED] 70a6b00

Description read

[DESCRIPTION-READ] 84f4a149f59099e5911b980118954261a1c2a9dab7c9ff062e8eab2c82b0623f

That sha256 names everything this verdict read: the PR description, plus the 3 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) — ✅ PASS

Premise-level review of 70a6b006c1487b55e1631bffa8e7e8ace2672ba9 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: PASS

Check that Fork chat in the embedded Sessions frame (embedMode === 'sessions') should now navigate to the fork, which navigateToEmbeddedSlot does.

Not justified as shipped

  • Item 3 — undeclared: the description only says "a fork leaves Split View the same way a row click does". But onSelectSlot is navigateToEmbeddedSlot in the embedded Sessions frame (SessionsSidebarChrome.tsx:218), so a fork there now also navigates the frame to /embed/chat/<fork>.

What this change ships

Inventory (3 items) — 2 justified

Intent: a fork made from the sidebar shows up on screen even when Split View is on. FIX.

  1. Fork chat from the sidebar row now leaves Split View and shows the fork — justified
  2. useSessionActions gets an optional onOpened callback, used by one caller (ChatSidebar) — justified
  3. In the embedded Sessions frame, Fork chat now navigates the frame to the fork — undeclared

[FIRST-PRINCIPLES-REVIEWED] 70a6b00

Description read

[DESCRIPTION-READ] 9c2872178750607abc304a2f51dd86a521275719d5ddc52359fcddf214e31c29

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

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 70a6b00

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 70a6b00

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • issue (non-blocking): Duplicate is an unfixed sibling of the same pattern

Outcome: accepted, met through the lane's own clear condition. The description now names website/src/hooks/useSessionActions.ts:240 as the open sibling, left on #21935.
Duplicate switches with switchSlot(data.key) inside useSessionActions, a hook shared by hosts that never pass onSelectSlot. Fixing it means a new callback in that hook's signature, which is a fork action outside this PR's New chat goal.
It goes to a follow-up PR with its own regression test.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): a plain create now also closes an open crew window

Outcome: fixed in the description. What changed now says clearSplitOnSelect calls closeCrewWindow(), so a plain create closes a crew window exactly as a row click does.
No code change: a newly created local session taking focus should not stay hidden under a crew window, which is the same rule activeSlotState.ts already applies when activeSlot moves.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • thought (non-blocking): the embedded Sessions frame jump has no still

Outcome: rebutted. In the embedMode === 'sessions' frame, onSelectSlot is navigateToEmbeddedSlot, the same callback a row click in that frame already calls (SessionsSidebarChrome.tsx:218).
So a plain New chat there now lands where clicking the new row would land: the chat for that session. Before, the create made a session the frame never opened, so the click looked like it did nothing.
The behaviour is the existing row-click navigation, already on screen today, so no new UI needs a still.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): the four stills had no blind read

Outcome: rebutted. No control, label or layout changes in this PR. The buttons look the same and only what appears after the click changes, which the lane itself says the stills show on desktop and phone.
The before/after pairs carry captions naming the gesture and the starting split, so a reader new to the change can match each pair to its row in the verification table.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • question (non-blocking): is opening the new chat from the embedded Sessions frame intended?

Outcome: yes, intended. In that frame onSelectSlot is navigateToEmbeddedSlot, the callback a row click already uses, so a plain create opens the new chat the same way clicking its row would.
Before this PR the create made a session the frame never opened. The description states the change under What changed.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 19, 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 c480e6f.

The fix itself is sound. reportOpenedCreate reports only while the new slot is still active, which matches createSlot's switched-away guard, and the tests cover the plain, background-tab and switched-away cases.

Blocking items:

  1. The Duplicate sibling (useSessionActions.ts:240) and the collapsed-folder-only cause are both deferred "on #21935", but this PR says Closes #21935, so merging closes their only tracker. Please open one issue for each and link them in the description.
  2. The collapsed sidebar's recents flyout New (paneLayout.tsx:200-207) still creates under the old split, while its sibling flyoutSwitch leaves it. Fix it here with the same active-slot check, or name it and track it in an issue.

Note: #21959 fixes the same issue, and #21935 is assigned to that PR's author. 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 merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 19, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/folder-new-session-old-chat branch from c480e6f to 21c63ae Compare October 19, 2026 08:45
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Thanks for the review of c480e6f. New head 21c63ae answers both blocking items.

issue (blocking): Duplicate and the collapsed-folder cause lost their tracker

Fixed. Duplicate is no longer deferred. useSessionActions takes an optional onOpened callback and calls it after switchSlot moves to the fork, and ChatSidebar passes its onSelectSlot, so Split View exits on a fork just as it does on a row click. ChatSidebar.forkChatAction.test.tsx gains a case that fails on main (the fork is reported) and one for a refused fork (nothing is reported). The commit and the description now say Part of #21935 instead of Closes, so #21935 stays open as the tracker for the collapsed-folder report, which I still cannot reproduce.

issue (blocking): the collapsed sidebar's flyout New creates under the split

Rebutted. The recents flyout cannot open while Split View is showing: flyoutEligible in website/src/pages/chat/page/sessionsDrawer.ts is !isMobile && !isTouchDevice() && !splitMode, and SessionsSidebarChrome.tsx renders the flyout only when it is true. flyoutSwitch calling setSplitMode(false) is defensive, not a reachable path. I tried writing a test for flyout New in split and it could not open the menu, for this reason.

note: #21959

Agreed, both PRs fix the same split-view symptom in create.ts. This one also covers Duplicate and adds the collapsed-folder tests. A maintainer picks one.

Separately, the head was rebased on main to clear the conflict with #18545 in create.ts. The rebase keeps all of #18545's tab-mode code and changes no behaviour on its own.

@github-actions github-actions Bot removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/folder-new-session-old-chat branch from 21c63ae to f73e1a8 Compare October 19, 2026 15:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: the fix for the foreground-tab finding is now on the PR at f73e1a8, rebased on main (which touched ChatSidebar.tsx in #21978, no conflict). The folder create reports after the tab switch for every mode except a background tab, the same as header New, and the regression test that fails on 21c63ae passes here. 88 tests across the 9 create and fork files pass.

@Pearcekieser
Pearcekieser force-pushed the fix/folder-new-session-old-chat branch from f73e1a8 to 38a6673 Compare October 19, 2026 23:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: rebased on main, no behaviour change. Harness Parity Gate failed on f73e1a8 because its base predated #22178, which deleted the claude ACP_BACKENDS_MEMBER_CAPABILITIES allowlist entry the gate flagged; main passes the same gate. New head 38a6673 carries the same single commit, and the 88 create and fork tests pass.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 20, 2026
@Pearcekieser Pearcekieser changed the title fix(sidebar): leave Split View when a sidebar New chat opens the session fix(sidebar): leave Split View when Fork chat opens the fork Oct 20, 2026
@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 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
@Pearcekieser
Pearcekieser force-pushed the fix/folder-new-session-old-chat branch from 38a6673 to 70a6b00 Compare October 20, 2026 00:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: rescoped after #21959 merged.

#21959 now ships the New chat fix for #21935, so this PR no longer carries its own copy. Head 70a6b00 is one commit on current main with only the Fork chat sibling that review r111 asked for: useSessionActions reports the fork through an optional onOpened callback, and ChatSidebar passes its onSelectSlot, so a fork in Split View leaves the split the way a row click does.

The diff is 3 files, +38/-4. The new fork test fails on main and passes here; 37 tests pass across the fork test and #21959's newChatLeavesSplit, folderCreateInTab and newChatInTab. The title and description now describe only this change.

The Cmd/Ctrl+Shift foreground-tab report and the collapsed-folder tests from earlier heads are dropped: #21959 already reports the folder foreground tab, and the collapsed-folder report stays unreproduced.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Oct 20, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): the embedded Sessions frame now navigates to the fork

Outcome: fixed in the description, intended in the code. What changed now says that in the embedded Sessions frame onSelectSlot is navigateToEmbeddedSlot, so a fork opens the fork's chat there, the same as a row click.
#21959, already on main, made a plain create do the same in that frame, so Fork chat now matches both its row click and New chat.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • question (non-blocking): should the embedded frame also navigate to the fork?

Outcome: yes, intended. In that frame onSelectSlot is navigateToEmbeddedSlot, the callback its row click uses, so a fork opens the fork's chat the way clicking the fork's row would.
#21959 gave a plain create the same behaviour there. The description now states it.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): check by hand that Fork chat leaves the split

Outcome: answered without a new still. The fork lands on the same single-chat view a row click on that session shows today, through the same clearSplitOnSelect exit #21959 verified on screen with before/after stills.
The unit test drives the real sidebar row's Fork chat button and checks the fork is reported to that exit.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention labels Oct 20, 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.

Approved at 70a6b006c1487b55e1631bffa8e7e8ace2672ba9.

The r112 blocker no longer applies. After #21959 merged, this PR only carries the Fork chat sibling, and main's folder create already reports a foreground-tab create. The fork is reported only after a successful fork and after switchSlot makes it active (useSessionActions.ts#L250). It goes through the sidebar's onSelectSlot (ChatSidebar.tsx#L657), the callback a row click already uses in both hosts. The new opened-fork test fails without the call. Every lane punchline on this head has a disposition, and CI is green.

Non-blocking: the refused-fork case asserts right after forkChatSlot is called, possibly before onSuccess runs, so it would likely pass even without the ok guard.

I read the code and CI but did not run the tests.

— crew-pr-reviewer (r114)

@iamwhatever
iamwhatever merged commit a5783bf into kirodotdev:main Oct 20, 2026
110 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 20, 2026
@abirkel abirkel mentioned this pull request Oct 20, 2026
5 tasks done
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.

2 participants