Skip to content

feat(chat): add option to open sidebar sessions in a session tab - #17544

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
Huiwen-Zuo:feat/sidebar-click-opens-tab
Oct 22, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
Huiwen-Zuo:feat/sidebar-click-opens-tab

Conversation

@Huiwen-Zuo

@Huiwen-Zuo Huiwen-Zuo commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let a user choose that a plain click on a sidebar session opens it in its own tab, instead of replacing the session in the active tab.

A plain click on a sidebar session replaces the session in the active tab, as #4477 specified. A user who keeps several sessions open as tabs loses one of them on every click, and must find it in the sidebar again. Cmd/Ctrl-click, middle-click and the row menu's Open in a session tab keep the tab, but each costs an extra click or a modifier every time.

Why it matters

A user who works in tabs switches sessions all day, and the only one-click way to open a session consumes a tab they kept on purpose. The setting gives them the one-click open that tabbed editors offer (VS Code workbench.editor.enablePreview: false). Nothing changes for anyone who leaves it off.

Not a goal

  • Changing the default. The setting is off, and a plain click still replaces the session in the active tab.
  • Other ways to open a session: keyboard session jumps, the command palette, notifications, links in messages, New chat and Older Sessions rows keep their current behaviour.
  • Changing Cmd/Ctrl-click, middle-click or the row menu's Open in a session tab.

What changed (motivation → approach → change)

Plain click on a sidebar session Setting off (default) Setting on
The session has no tab Replaces the session in the active tab Opens it in its own session tab, beside the active one
The session has a tab Switches to that tab Switches to that tab
Where What
website/src/pages/chat/ChatSettings.tsx ChatConfig.sidebarClickOpensTab, default false
website/src/pages/settings/ChatPanel.tsx the toggle under Sessions
website/src/pages/ChatPage.tsx, website/src/pages/chat/useChatPageSessionController.ts the sidebar and flyout handlers call ensureSlotTab
website/src/hooks/useSessionTabs.ts openInNewTab places the tab beside the active one
website/src/i18n locales the label and hint in all 12 shipped languages
src/kiro_crew/docs/settings-registry.generated.json, website/src/components/commandPalette/settingsRegistry.gen.ts regenerated settings registry, so search finds the toggle
docs/feature-map/README.md a row for the setting, and the session controller's entry in the Sessions row

The setting is Settings > Chat > Sessions > Open Sidebar Sessions in a Session Tab. It is browser-local, like the toggles around it (ChatConfig.sidebarClickOpensTab, default false). The label says "session tab", the row menu's own term, so it does not read as a browser tab. It uses Title Case, like the other rows in the card.

The sidebar calls onSelectSlot after each plain activation of a row: a click, Enter/Space and a source chip. ChatPage's handler gives the session a tab when the setting is on (ensureSlotTab in the session controller), and so does a pick from the collapsed sidebar's recents flyout. The tab goes beside the active tab, where the row menu puts it. A session that already has a tab is only selected, with no outline cue: the switch is the response. ChatSidebar.tsx does not change.

useSessionTabs.openInNewTab reads the active session when it is called, not inside its state updater. This caller dispatches the switch first, and an updater that runs after the next render sees the new session as active and puts the tab at the end of the strip.

Backwards compatibility

Compatible: the setting defaults to off, and a stored config without the key loads as off, so every client keeps today's click behaviour.

Removes nothing: the change adds a setting and one branch behind it.

Tests

  • ChatPage.sessionTabs.test.tsx: setting off, a sidebar click still replaces the active tab's session. Setting on, in the sidebar's own order (switch, then onSelectSlot): the session opens beside the active tab, the first click brings up the strip, a session that has a tab is only selected and gets no cue, and a pick from the collapsed sidebar's flyout opens a tab.
  • ChatSettings.test.tsx: the setting defaults to off, keeps a stored true and repairs a non-boolean to off.
  • SettingsChatPanelCoverage.test.tsx: the toggle stores the setting.

The setting-on tests fail without the change. The no-cue test fails when ensureSlotTab drops its tab check.

Manual verification

On an isolated gateway (dev-backend.sh --seed rich, standalone profile, loopback), I clicked sidebar sessions with the setting off and on. Off: the strip stays hidden and the click replaces the session. On: the strip grows to two and then three tabs, and a click on a session that has a tab selects it. On the same gateway, I turned the toggle on in Settings and opened its hint.

Screenshots / video

Settings > Chat > Sessions, off and on:

The new toggle, off

The new toggle, on

The hint behind the ⓘ icon:

The toggle's hint

Setting on: three sidebar clicks give three tabs, and a click on a session that has a tab selects it.

sidebar-click-opens-tab.webm
Frames

Setting off: a click replaces the session, no strip

Setting on: second session opens in a second tab

Setting on: third session opens in a third tab

Setting on: a session that has a tab is selected

Related Issues

Fixes #17543

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

Contribution License Agreement

@Huiwen-Zuo
Huiwen-Zuo requested a review from a team as a code owner October 6, 2026 22:02
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 5a32057d71d4ccaedd87cbb175a3af84864d9f42 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

The setting is opt-in, stored only in the browser and off by default, so it is easy to revert. Rendered evidence is attached, and the change takes nothing away.

Notes

  • selectFromSidebar calls ensureSlotTab without checking ownsSessionTabs. That differs from onOpenSlotInNewTab, which is only passed when ownsSessionTabs is set. In embedded or popout surfaces with no tab strip, the setting may then write a tab list that nothing shows.

[DESIGN-REVIEWED] 5a32057

Description read

[DESCRIPTION-READ] 28a800d6d94e82a2212c089714146bad99d540dbe052dc5e318bd366cf4cdd59

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 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 5a32057d71d4ccaedd87cbb175a3af84864d9f42 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 does not.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (6 items) — 6 justified

Intent: let someone who works in session tabs open a sidebar session in its own tab with one plain click, instead of losing the tab they are on. ADDITION.

  1. New Settings → Chat → Sessions toggle, off by default: a plain sidebar click opens the session in its own tab — justified
  2. With the toggle on, a pick from the collapsed sidebar's flyout also opens a tab — justified
  3. A newly opened tab lands beside the active tab, not at the end of the strip, when the switch is dispatched first — justified
  4. The toggle can be found from settings search and find_ui (regenerated registries) — justified
  5. The label and hint in all 12 shipped languages — justified
  6. A feature-map row for the setting — justified

[FIRST-PRINCIPLES-REVIEWED] 5a32057

Description read

[DESCRIPTION-READ] e687868a6096fee4e846b41dfe857639c39830ed7b32052c830fcdc65c18cfeb

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 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 5a32057d71d4ccaedd87cbb175a3af84864d9f42 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The screenshots show the toggle off and on, its hint, and the three-tab result, and a recording is attached. Because this is a fork, no first-time reader has seen them; pushing the branch to this repository runs that blind read.

[UX-REVIEWED] 5a32057

Description read

[DESCRIPTION-READ] 6704a194b8caa57522ffef45ccaba09bbfd642b9186be4c4273af1478141f8c1

That sha256 names everything this verdict read: the PR description, plus the 10 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 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 5a32057

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

I checked both candidates against the code, and neither holds up, so this review passes.

  • Candidate 1 (the tab setting also affecting New chat, Duplicate and the create menus): the outcome isn't racy. Duplicate switches sessions and then calls onSelectSlot right away, before React re-renders. That makes ensureSlotTab reliably add a tab beside the old one. That matches the setting's intent, so it isn't clearly wrong. The create paths wait on an awaited promise. React's own render and effects run first, so the active tab is already replaced and ensureSlotTab does nothing. New chat therefore behaves exactly as it did before this PR.
  • Candidate 2 (offline flyout pick adds a tab): the flyout row only calls onSwitch when connected (SessionFlyout.tsx:306), and that is its only call site. The offline path the candidate describes can't happen.

No findings.

[OPUS-REVIEWED] 5a32057

@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: checking Automated validation is still running labels Oct 7, 2026
@Huiwen-Zuo Huiwen-Zuo changed the title feat(chat): add option to open sidebar sessions in a new tab feat(chat): add option to open sidebar sessions in a session tab Oct 7, 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 7, 2026
@Huiwen-Zuo
Huiwen-Zuo force-pushed the feat/sidebar-click-opens-tab branch 2 times, most recently from 179c4d7 to e001ad6 Compare October 7, 2026 18:26
@Huiwen-Zuo

Copy link
Copy Markdown
Contributor Author
  • Two terms for one result (span=1baf4a6e7d63): fixed in e001ad6

The label is now "Open Sidebar Sessions in a Session Tab" and the hint is "A click opens the session in its own session tab instead of replacing the active tab's session."
"Session tab" is the row menu's own term for the same result (components.sessionActionsMenu.open_in_new_tab: "Open in a session tab").
Each of the 11 translated locales uses the term its own row menu already uses for that item.

@Huiwen-Zuo

Copy link
Copy Markdown
Contributor Author
  • Casing doesn't match its neighbours (span=701683c38147): fixed in e001ad6

The English label is now in Title Case, like the rows around it in Settings > Chat > Sessions ("Confirm Before Closing Session", "Compact Empty Folders").
The 11 translated locales keep sentence case, which is the case their neighbouring rows use.

@Huiwen-Zuo

Copy link
Copy Markdown
Contributor Author
  • Suggested label and hint text (span=8c5b64810ddd): fixed in e001ad6

The English label and hint use the suggested text verbatim.
All 12 locales are updated, the settings-search registry is regenerated, and the description's screenshots show the new label and hint.

@Huiwen-Zuo

Copy link
Copy Markdown
Contributor Author

Re the First Principles note on ensureSlotTab (head 00d0857): kept as is.

openSlotInNewTab(key, {background: true}) calls openInNewTab, which flashes the outline cue when the session already has a tab. A plain sidebar click on such a session should only switch to it, as it does with the setting off, so ensureSlotTab skips that call when the tab exists. The no-cue test in ChatPage.sessionTabs.test.tsx fails if ensureSlotTab drops its tab check.

@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 7, 2026
@Huiwen-Zuo
Huiwen-Zuo force-pushed the feat/sidebar-click-opens-tab branch from e001ad6 to f8f3fb5 Compare October 7, 2026 20:38
@Huiwen-Zuo

Copy link
Copy Markdown
Contributor Author

Rebased onto main (acc08092d -> 896b87c6c) to clear a conflict in docs/feature-map/README.md with #17662 and #17794. I kept main's rows and re-applied this PR's two edits in that file. The rest of the diff is unchanged.

The three red checks on e001ad6aa have one cause, a known flake. Frontend Tests (4) passed all 669 files and 11,156 tests, then exited 1 on [vitest-pool]: Worker forks emitted error / Worker exited unexpectedly. Frontend Coverage Merge replays that shard's error, and Coverage Gate fails closed behind both. That shard ran none of this PR's test files. #15412 tracks this error.

CI on the new head needs workflow approval again.

@Huiwen-Zuo

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Screenshots exist, but nobody new has read them (span=4e943f84630b): needs-a-decision

The lane says this is not an author gap: the blind newcomer read runs only on a branch in this repository.
This account can only read this repository, so it cannot push the branch here.
Maintainers: to get the blind read, push feat/sidebar-click-opens-tab to this repository. Otherwise the attached screenshots and recording are the evidence.

@Huiwen-Zuo

Copy link
Copy Markdown
Contributor Author

self-added: no

  • The first click with the setting on shifts the whole chat down (span=dff45ae19498): rebutted

The shift comes from the existing tab strip rule: components/SessionTabStrip.tsx renders the strip only at two or more tabs (if (tabs.length < 2) return null).
Every way to open a second tab triggers the same shift: the row menu's "Open in a session tab", Cmd/Ctrl-click and middle-click.
To remove it, the strip must also show at one tab. That changes all of those entry points, which this PR's "Not a goal" section excludes.
The shift happens once, when the second tab appears. Later clicks add tabs to a strip that is already on screen.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 7, 2026
@iamwhatever
iamwhatever force-pushed the feat/sidebar-click-opens-tab branch from 4963427 to 320f990 Compare October 22, 2026 01:22
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision 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 22, 2026
@iamwhatever
iamwhatever force-pushed the feat/sidebar-click-opens-tab branch from 320f990 to 911e797 Compare October 22, 2026 02:08
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 22, 2026
A plain click on a sidebar session replaces the session in the active
tab, so a user who keeps several sessions open as tabs loses one on
every click. Add an opt-in Settings > Chat > Sessions toggle that opens
the session in its own session tab instead, or switches to its tab
when it has one. A tab opened right after a session switch now lands
next to the active tab instead of at the end of the strip.
@iamwhatever
iamwhatever force-pushed the feat/sidebar-click-opens-tab branch from 911e797 to 5a32057 Compare October 22, 2026 04:04
@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: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 22, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 5a32057. The change looks sound, and two review items are still open.

This head is a rebase of the head our r114 read, and only regenerated docs rows changed. First Principles now has nothing to check, which clears that item. Every lane passes and CI is green.

To clear the hold:

  • Reply on this head to the Design note that selectFromSidebar calls ensureSlotTab without checking ownsSessionTabs. We checked it, and it does not hold. useSessionTabs gets enabled = !embedded (useChatPageSessionController.ts#L177-L182), and openInNewTab returns early when it is not enabled (useSessionTabs.ts#L145-L146). Posting that as a rebuttal answers it.
  • A maintainer still has to settle the UX blind first-time read you marked needs-a-decision (comment). They can push the branch to this repository for the read, or accept the attached screenshots and recording.

— crew-pr-reviewer (r119)

@iamwhatever iamwhatever self-assigned this Oct 22, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) October 22, 2026 07:20

@buluoray buluoray 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.

Approve at 5a32057.

The setting is opt-in and browser-local, and the click path does what the description says. selectFromSidebar and the flyout pick both gate ensureSlotTab on sidebarClickOpensTab (website/src/pages/ChatPage.tsx:917-926), a session that already has a tab is only selected (useChatPageSessionController.ts:222-223), and openInNewTab now captures besideKey at call time (useSessionTabs.ts:155), so the tab lands beside the one the user was on.

On the Design note about ownsSessionTabs: it does not hold. useSessionTabs receives enabled = !embedded (useChatPageSessionController.ts:177,182) and openInNewTab returns early when not enabled (useSessionTabs.ts:146), so embedded and popout hosts write nothing.

Checked locally: ChatPage.sessionTabs, ChatSettings, SettingsChatPanelCoverage (147 passed) and tsc -p tsconfig.app.json. Each guard was mutated one at a time and turned a named test red: the setting gate (both directions), the flyout call, the has-tab check, the besideKey capture, and the boolean repair in loadChatConfig. CI on this head: 88 success, 11 skipped.

Non-blocking follow-up: onSelectSlot also fires after Duplicate (useSessionActions.ts:257-258) and after a sidebar New chat (pages/chat-sidebar/create.ts:150,329,392). With the setting on, a duplicated session gets its own tab, and whether a new chat does depends on render timing. The description says New chat keeps today's behaviour, so a test pinning those paths (or a note that Duplicate now opens a tab) would make that explicit.

@iamwhatever
iamwhatever merged commit 1d9920c into kirodotdev:main Oct 22, 2026
102 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 22, 2026
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.

Setting to open sidebar sessions in a new tab on plain click

3 participants