Skip to content

feat(site): replace agents right panel pills with fixed tabs and sub-layers - #29692

Closed
tracyjohnsonux wants to merge 8 commits into
mainfrom
feat/agents-right-panel-static-tabs
Closed

tracyjohnsonux wants to merge 8 commits into
mainfrom
feat/agents-right-panel-static-tabs

Conversation

@tracyjohnsonux

@tracyjohnsonux tracyjohnsonux commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

The Agents right panel used small pill tabs with an attached x and a split + / v control that mixed "new terminal" with a checkbox menu for Browser, Desktop, and Debug. Every terminal, app preview, and port preview was its own top-level tab, so the strip grew without bound in a 360 to 480px panel, and the 24px pills were hard to hit and had no keyboard tab navigation.

The strip is now a fixed set of underline tabs built on the shared Tabs primitive: Summary, Git, Terminal, Browser, Desktop, Workspace, and Debug. Tabs appear when their content is available (same gating as before) and are never closed by the user. Each group tab owns its own sub-layer:

  • Terminal has three states: an "Add a terminal" button when none are open, chips (Terminal 1 x | Terminal 2 x | +) while they fit on one row, and a selector dropdown listing the terminals plus "New terminal" and "Close" actions once they do not. A hidden copy of the chip row measures the fit so the strip flips back to chips when a terminal closes or the panel widens.
  • Workspace is a selector: the trigger shows the preview currently displayed, and its menu lists every app with a checkbox for the ones open as previews, plus the ports submenu. Selecting an unchecked app opens it, selecting a checked one shows it, and selecting the one already shown closes it. Command apps open as terminals; external apps open in a new browser tab.

Each group remembers its active item per chat, and a badge on Git, Terminal, or Workspace shows the count only when there are two or more entries to choose between.

Tab bodies mount on first selection and stay mounted, so the Browser iframe is not loaded on every chat open (the reason #28370 hid those tabs behind the menu). Persisted terminal, app, and port tabs are reused as chips; a stored top-level tab id from the old strip maps onto the group that now holds it. RightPanelAddTabControl and the singleton show/hide state are removed. TabsTrigger merges a passed className instead of replacing its base classes; no existing caller passed one.

Storybook: SidebarTabView, TerminalTabPanel, and WorkspaceTabPanel stories cover the strip, chips, the collapsed terminal selector, empty states, overflow at 360px, and the workspace selector menu.

Implementation plan

Agents right panel: static tabs with sub-layers

Goal

Replace the pill-based, user-managed tab strip in the Agents right panel with a
fixed set of underline-style tabs. Dynamic content (terminals, app previews,
port previews) moves into a sub-layer inside its parent tab, so the top strip
never grows and needs no close controls or add-tab dropdown.

Top strip, fixed order:

[Summary] [Git] [Terminal] [Browser] [Desktop] [Workspace]        [expand] [close]

Debug is appended as a seventh tab only when debug logging is enabled for the
chat (it is a developer setting, not a workspace capability).

Decisions and defaults

These resolve the open questions from the discussion. Each is a reversible
default; flag any you want changed.

Topic Decision
Tab availability Same gating as today: a tab appears only when it is relevant. Summary and Git always; Terminal, Desktop, and Workspace when a workspace and agent are attached; Browser when the agent exposes the agent-browser app; Debug when debug logging is enabled. A chat without a workspace therefore shows only Summary and Git. Tabs that are shown are never closeable.
Lazy mounting Browser, Desktop, and Workspace previews mount on first activation and stay mounted afterwards (invisible, inert) so iframes and xterm canvases keep state. Preserves the #28370 goal of not loading the browser iframe on every chat load.
Terminal sub-layer Chip strip [Terminal 1 x] [Terminal 2 x] [+] above the terminal. The built-in terminal (reconnect token = chat id) is Terminal 1. Unlabeled terminals are numbered densely and renumber on close, as today. Command apps (Claude Code, Codex, ...) open here as a chip labelled with the app name, deduped by sourceAppId.
Zero terminals Closing the last chip shows an empty state with a "New terminal" button. + and the empty-state button are disabled when the workspace is not running.
Badges A badge shows the number of items in the tab's sub-selection, and only when there are two or more so it signals a choice rather than presence. Terminal and Workspace: open chips. Git: entries in the Git view selector (the PR view plus each dirty local repository), which is also where multiple PRs or drafts will surface once the model supports them.
Terminal activation Keep the pending/ready handshake: a new terminal chip becomes active once the PTY reports ready (or after the fallback timeout).
Workspace sub-layer Chip strip [File browser x] [code-server x] [+], mirroring Terminal. + opens a menu listing embeddable apps, command apps, external apps, and forwarded ports (moved out of the old add-tab dropdown). With nothing open, the tab body shows that same list so the first click reveals what is available. Opening an embeddable app or port adds a closeable preview chip and activates it. Command apps open as a Terminal chip and switch to the Terminal tab. External apps open in a new browser tab. Reopening an already open app or port activates the existing chip.
Header actions Expand/collapse (existing) plus a close-panel button on every viewport size, replacing the mobile-only back arrow. Expanded mode keeps the centered chat title.
Overflow Keep the scroll chevrons. The active tab scrolls into view when it changes.
Persisted state Per chat: active top tab, active Terminal chip, active Workspace chip, open terminal/app/port sub-tabs. Existing agents.right-panel-tabs.<chat> entries are reused as-is: terminal kinds feed the Terminal sub-layer, workspace_app and port kinds feed the Workspace sub-layer. agents.right-panel-singleton-tabs.<chat> and the default-terminal-hidden flag are no longer read; a persisted top tab id that points at a removed or sub-level tab falls back to Summary.
Read-only chats (archived or owned by another user) Same tabs, nothing persisted, matching current behaviour.
Tool actions DesktopPanelContext.onOpenDesktop just activates the Desktop tab.
Styling and accessibility Top strip uses the shared Tabs/TabsList/TabsTrigger primitives from site/src/components/Tabs (roving focus, arrow keys, single Tab stop) with a taller hit area than the current 24px pills. Sub-layer chips are at least 28px tall with a hover/active close control.

Files

Delete:

  • components/RightPanel/RightPanelAddTabControl.tsx and its stories. Its app
    and port listing logic moves into the Workspace launcher.

Change:

  • components/ChatsSidebar/tabs/SidebarTabView.tsx: underline tabs on the
    shared primitive, no per-tab close, no addTabControl, badge slot kept,
    close-panel button on all sizes, scroll active tab into view.
  • utils/rightPanelTabs.ts: remove singleton tab ids and their guards; add
    the static tab id list and helpers to split UserRightPanelTab[] into
    terminal and workspace sub-tabs.
  • utils/rightPanelTabStorage.ts: remove singleton and default-terminal-hidden
    storage; add per-chat active sub-tab persistence.
  • components/ChatsSidebar/tabs/getEffectiveTabId.ts: reused as-is for the
    sub-layers.
  • AgentChatPageView.tsx: build the fixed tab list, route open/close handlers
    to the sub-layers, drop singleton visibility state.

Add:

  • components/RightPanel/SubTabStrip.tsx: shared chip strip (label, optional
    close, optional trailing action) used by Terminal and Workspace.
  • components/RightPanel/TerminalTabPanel.tsx: chip strip, terminal panels,
    empty state, + handling.
  • components/RightPanel/WorkspaceTabPanel.tsx: preview chips, + menu,
    and the empty-state list of apps and ports built from the current dropdown
    items (AppLink, PortsMenuItem data via usePortsData).
  • components/RightPanel/RightPanelEmptyState.tsx: small shared empty state.

Tests

Extend existing coverage where it exists, add Vitest + userEvent tests for
new interaction outcomes, stories only for visual components:

  • utils/rightPanelTabs.test.ts: static tab list, sub-tab partitioning,
    validation still drops stale app/port tabs.
  • utils/sidebarTabStorage.test.ts (and a new storage test if needed):
    active sub-tab persistence, legacy keys ignored, stale top tab id falls back.
  • TerminalTabPanel.test.tsx: + adds a numbered chip and activates it when
    ready, closing renumbers, closing the last chip shows the empty state,
    + disabled when the workspace is not running, command app dedupe.
  • WorkspaceTabPanel.test.tsx: opening an app or port adds and activates a
    chip, reopening activates the existing chip, closing returns to the
    launcher.
  • SidebarTabView stories updated for the underline style, badges, and the
    expanded/close-button states; RightPanelAddTabControl stories removed.

Verification

  • pnpm --dir site test for the touched directories.
  • pnpm --dir site lint, pnpm --dir site check (types), pnpm --dir site format.
  • Manual pass with ./scripts/develop.sh: attached and unattached chats,
    stopped workspace, chat with and without agent-browser, narrow viewport
    overflow, expanded mode, reload persistence of open chips and active tabs.

Design notes

  • Each group remembers its last active chip, so returning to Terminal or
    Workspace lands on the chip the user left. This keeps the common
    "bounce between a terminal and a preview" flow at one click per switch
    instead of two.
  • The sub-layer strip costs one row of vertical space inside the panel. Chips
    stay compact (24px) and the strip is always present in Terminal so + has a
    stable home.

Out of scope

  • Telemetry for tab usage (worth a separate small PR so the redesign can be
    measured; dogfood currently has no per-panel signal).
  • Changes to the workspace pill in the chat input, which keeps its own app
    and port menus.

Generated by Coder Agents on behalf of @tracyjohnsonux.

…layers

The right panel strip is now a fixed set of underline tabs (Summary, Git,
Terminal, Browser, Desktop, Workspace, Debug) that appear when relevant and
are never closed. Terminals and app or port previews move into chip strips
inside the Terminal and Workspace tabs, replacing the add-tab dropdown and
the per-tab close controls.
…inals

The Workspace tab now shows a selector whose menu lists every app with a
checkbox for the ones open as previews, plus the ports submenu. The
Terminal tab keeps chips while they fit on one row and collapses into the
same selector once they do not; with no terminals it shows only an Add a
terminal button.
The tab list clips vertical overflow, so the trigger's 1px negative margin
pushed the underline out of view. Move the overlap to the list wrapper.
…a fade

A gradient overlay either hid the header border or let the underline of a
scrolled-off active tab show through. Mask the tab list itself so labels
and underlines fade together while the header border stays untouched.
…s terminal

The Workspace tab now shows an open button when nothing is open, chips with
an add control while they fit on one row, and a selector with a close
button once they do not. It is hidden entirely when the agent exposes no
visible apps and no port forwarding.
@tracyjohnsonux tracyjohnsonux added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Oct 12, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

experimental Changes that might not necessarily be merged, until its approved to proceed with.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant