Skip to content

feat(sidebar): add pinning and close to the right to chat tabs - #14446

Merged
marius-kilocode merged 4 commits into
mainfrom
feat/sidebar-pin-close-to-right
Sep 22, 2026
Merged

marius-kilocode merged 4 commits into
mainfrom
feat/sidebar-pin-close-to-right

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The Agent Manager tab bar has Pin and Close to the Right, but the sidebar chat tab strip still only offers Close and Close Others. With several sidebar sessions open there is no way to keep a reference tab in place or clear the trailing tabs in one action.

Why This Change Was Made

Port both actions to the sidebar by reusing the existing Agent Manager logic instead of duplicating the tab components:

  • Move the pure pin helpers (applyPinnedTabs, togglePinnedTab) and a new group-aware reorder helper (reorderPinnedTabs) into the shared webview-ui/src/utils/tab-order.ts, and re-export them from the Agent Manager module so existing callers and tests are unchanged.
  • Add webview-ui/src/utils/session-close.ts, a small adapter that maps the shared Agent Manager close-to-right helpers onto a session-only tab bar (the sidebar has no terminal or review tabs).
  • Add pins and rendered order to LocalTabsProvider, persisted next to the existing tab order as sidebarPinnedSessionTabIDs.
  • Wire SessionTabStrip to the existing shared SessionTab and SessionTabMenu, so the sidebar reuses the same components and the existing agentManager.tab.pin / unpin / pinned / closeToRight translations. No new strings were added.

This follows #14444, which added Close to the Right to the Agent Manager tab bar. That PR has merged into main, so this branch is based on main and reuses its helpers directly.

User Impact

  • Pinned sidebar tabs render at the front with a pin marker and no close button.
  • Close Others and Close to the Right keep pinned tabs open.
  • Close to the Right closes only the tabs after the target, hides when nothing closable sits to the right, and keeps the current selection unless the visible tab was closed.
  • Pins persist across webview reloads, the same way tab order already does.

Evidence

Automated, from packages/kilo-vscode/: bun run lint, bun run typecheck, bun run knip, and bun run test:unit (6363 pass, 2 skip, 0 fail). New focused coverage for the sidebar lives in tests/unit/session-close.test.ts, plus pin cases in tests/unit/tab-order.test.ts, tests/unit/local-tabs.test.ts, and tests/unit/sidebar-tab-dnd.test.ts.

Manual self-test in an isolated VS Code instance (dev build, real sidebar UI, real sessions created through the backend API so no model requests were sent):

  • Pinned a sidebar tab: it moved to the front and showed the pin marker, with a Pinned aria label and no close button.
  • Right-clicked a tab: the menu showed Fork Session, Pin, Close, Close Others, Close to the Right in that order.
  • Close to the Right on a pinned tab: only the trailing unpinned tab closed, the pinned neighbor survived, and the selection stayed on the visible tab.
  • Close to the Right from a tab that was left of the visible tab: the visible tab closed and selection moved to the target.
  • The last tab and a tab with only pinned tabs to its right both hid Close to the Right.
  • Unpinned a tab and confirmed it dropped out of the pinned group, and pins survived a webview reload.

Pinned tabs at the front, with the trailing unpinned tab still open:

Sidebar tab strip with pinned Beta and Alpha tabs at the front

Context menu on a sidebar tab, Close to the Right after Close Others:

Sidebar tab context menu showing Close to the Right after Close Others

After Close to the Right: the trailing tab is gone and both pinned tabs remain:

Sidebar tab strip after Close to the Right with both pinned tabs remaining

Close to the Right is absent on the last tab:

Sidebar tab context menu without Close to the Right on the last tab

Comment thread packages/kilo-vscode/webview-ui/src/context/local-tabs.tsx Outdated
Comment thread packages/kilo-vscode/webview-ui/src/utils/session-close.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The two prior suggestions are resolved at e6c48ac:

  • local-tabs.tsx now bounds persisted pins with pinned().filter((id) => real().includes(id)).
  • session-close.ts now passes isPending through SessionTabBar instead of hardcoding false.
Files Reviewed (4 files)
  • packages/kilo-vscode/webview-ui/src/context/local-tabs.tsx
  • packages/kilo-vscode/webview-ui/src/utils/session-close.ts
  • packages/kilo-vscode/tests/unit/session-close.test.ts
  • packages/kilo-vscode/tests/unit/sidebar-tab-dnd.test.ts
Previous Review Summaries (2 snapshots, latest commit 06fad00)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 06fad00)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/src/context/local-tabs.tsx 199 Persisted pin list is never pruned, so closed sessions leave dead ids in sidebarPinnedSessionTabIDs.
packages/kilo-vscode/webview-ui/src/utils/session-close.ts 26 isPending: () => false does not describe the sidebar, which does have pending draft tabs.
Files Reviewed (6 files)
  • packages/kilo-vscode/webview-ui/agent-manager/close-others.ts
  • packages/kilo-vscode/webview-ui/agent-manager/close-to-right.ts
  • packages/kilo-vscode/webview-ui/agent-manager/terminal/state.ts
  • packages/kilo-vscode/webview-ui/src/utils/session-close.ts
  • packages/kilo-vscode/webview-ui/src/utils/tab-close.ts
  • packages/kilo-vscode/webview-ui/src/utils/terminal-tab-id.ts

Fix these issues in Kilo Cloud

Previous review (commit f1e0744)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2

Pinning and Close to the Right reuse the Agent Manager helpers cleanly, and the ordering/close semantics check out against the tests. Both findings are state-hygiene nits, not blockers.

Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/src/context/local-tabs.tsx 199 Persisted pin list is never pruned, so closed sessions leave dead ids in sidebarPinnedSessionTabIDs (the Agent Manager prunes them in WorktreeStateManager.removeSession).
packages/kilo-vscode/webview-ui/src/utils/session-close.ts 26 isPending: () => false does not describe the sidebar, which does have pending draft tabs; harmless today only because selectSessionTab ignores the flag.
Files Reviewed (13 files)
  • .changeset/sidebar-tabs-pin-close-to-right.md
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/session-tabs/pinned-tabs-chromium-linux.png
  • packages/kilo-vscode/tests/unit/local-tabs.test.ts
  • packages/kilo-vscode/tests/unit/session-close.test.ts
  • packages/kilo-vscode/tests/unit/sidebar-tab-dnd.test.ts
  • packages/kilo-vscode/tests/unit/tab-order.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/tab-order.ts
  • packages/kilo-vscode/webview-ui/src/components/chat/SessionTabStrip.tsx
  • packages/kilo-vscode/webview-ui/src/context/local-tabs.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/src/styles/session-tabs.css
  • packages/kilo-vscode/webview-ui/src/utils/local-tabs.ts
  • packages/kilo-vscode/webview-ui/src/utils/session-close.ts - 1 issue
  • packages/kilo-vscode/webview-ui/src/utils/tab-order.ts

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo