Skip to content

Make the sidebar navigation a provider slot with rail and list placements - #5584

Merged
ymichael merged 19 commits into
mainfrom
bb/undo-left-rail-changes-thr_mgqwa2yese
Oct 16, 2026
Merged

ymichael merged 19 commits into
mainfrom
bb/undo-left-rail-changes-thr_mgqwa2yese

Conversation

@ymichael

@ymichael ymichael commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

#5229 (0.46.0) made the icon rail the only sidebar navigation and removed the plugin API that let a plugin draw it (experimental_sidebarNavigation, experimental_sidebarHeader, and their hooks).

The old slot only covered rows above the thread list, so the rail and the slot could not coexist.

What changed

One navigation slot with a declared placement.

  • app.slots.experimental_sidebarNavigation is restored under its pre-0.46 names. Registrations declare placement: "rail" | "list"; list is the default, so older plugins keep working.
  • bb lays out the sidebar from the placement before the provider renders:
    • rail: a fixed column that stays when the sidebar collapses, New thread in the header and Settings at the bottom of the column.
    • list: rows above the thread list, the footer in the same column after the thread list with a Settings action, Back to app rows on the Settings, Plugins, and Skills lists, a collapse that hides the whole sidebar, and the header slot.
  • Both placements use the same macOS window frame on wide viewports. Switching navigation keeps the title-bar controls in place and Settings Search at the same height; sidebar headers do not reserve an empty window-control gutter below the title bar. Providers without header controls use only an 8-pixel top inset instead of reserving an empty 48-pixel header row. Compact windows retain the floating toggle.
  • bb's Top list keeps the 0.45 row affordances: a hover "…" options button (always shown on touch devices) with the same menu as right-click, the split pane map beside a row's label when its page is open in a split, and More only when a destination is hidden.
  • bb's Top list pins New thread and More and scrolls the destinations between them, capped near 70% of the window with fades at the scroll edges, so many plugin panels or a short window can't push the thread list out of view (the pre-0.46 rows could). The shared region stays uncapped so plugin providers manage their own height.
  • bb's own Rail (navigation/rail, the default) and Top list (navigation/top-list) are the bundled Navigation plugin (see below), so they use exactly the contract a third-party provider gets.
  • The region is a <nav> element again, as before Make the navigation rail the only sidebar layout and remove the sidebar navigation plugin API #5229, and list placements keep the footer after the thread list in the same column, as 0.45 did. Plugins that find their column with closest("nav") and inset what follows, such as Nav Rail, therefore dock with the footer beside the rail.
  • Picking a provider (sidebar/sidebarNavigationProvider.ts):
    • sidebar.navigationProvider (Settings → Appearance → Navigation) selects Automatic or a provider by plugin key.
    • Automatic uses the first provider from a plugin the user installed, else the first built-in one (Rail). A pinned provider that is missing once plugins settle falls back the same way; with no provider at all the sidebar uses the list placement and says no navigation plugin is enabled.
    • Legacy __builtin__ and navigation/navigation read as Automatic.
    • Before plugin frontends settle, a plugin provider's last placement is reserved, so a reload does not flash the rail.
    • A crashing provider or header is replaced by the built-in provider for its placement, with one toast.
  • experimental_Original renders the built-in provider for the same placement, or nothing when the Navigation plugin is disabled.

Rail and Top list are a bundled, forkable plugin (plugins/navigation).

  • The plugin registers both providers, plus Rail's New thread button as its headerComponent, using only experimental_useSidebarNavigation, experimental_useSidebarNavigationSplit, experimental_SidebarNavigationIcon, and registry components. It is default-enabled, on scripts/forkable-plugins.json, and served by the demo server.
  • The host keeps only what surrounds a provider: the placement layout (including the rail's top inset), Settings, the customize editor, the navigation model, and badge collection. The macOS window frame is independent of navigation placement, and navigation headers sit below the title bar on wide macOS windows.
  • The shortcut pill, overflow fade, and split-pane mini-map move into shared-ui and the component registry, so the app, Navigation, and Thread list share one copy each (Thread list drops its private copies).

Built-in providers come from the install source.

  • The app records which plugins were installed as built-ins from the plugin list. Every replacement setting (thread list, navigation, source code, diffs) labels their providers "(built-in)" and lists them after installed plugins, and Automatic prefers a provider from an installed plugin, then slot order. No per-slot constants remain.
  • Monaco is a built-in plugin, so it now shows as "(built-in)" in the Source code and Diffs settings, and Automatic prefers a third-party renderer over it.
  • The bundled Thread list option drops its "BB default." description; the Automatic row already names what it chooses.
  • The Navigation setting hides when no navigation plugin is installed, like the thread list setting, and settings search uses the matching condition.

Shared model (SidebarNavigationModel.tsx, lib/plugin-sidebar-navigation.ts):

  • experimental_useSidebarNavigation() returns isHomeActive, and its actions include goHome(), setOrder(), and openCustomize(). openCustomize() opens bb's editor in a popover beside any provider, after open menus close, and returns focus to the control that opened it. bb's menus and the editor call it "Customize navigation" on every provider.
  • Each panel's experimental_useBadge value is in the model as item.badge. The badge sources mount once in the model instead of in the rail.

Badges (supersedes #5524).

  • This PR includes Draw plugin badges on navigation rail icons #5524's value-based experimental_useBadge and its compatibility handling for experimental_sidebarAccessory (the field is dropped with a warning), plus Tasks' migration to the hook.
  • ExperimentalBadge is { count?, text?, tone?, label }:
    • text is a short visible value of at most 8 characters, such as "NEW", "73%", or "2 down", and cannot be combined with count;
    • tone is neutral (the default), warning, or critical, and bb owns the colors.
  • The fields follow the 30 bb-community plugins that drew experimental_sidebarAccessory: 12 drew one count, 8 several numbers or a fraction, 5 a short status, 3 a percentage, and 18 used red, amber, or an accent color for state.
  • Drawing:
    • Fills are solid theme colors: muted gray for neutral, attention amber with a new --attention-foreground for warning, and destructive red for critical.
    • The rail draws counts (capped at 9+) and a tone-colored dot for text, each cut out of the icon by a ring in the rail's own background.
    • The Top list and More menu draw the count (capped at 99+), the text, or a dot.
    • More's dot takes the strongest hidden tone, and the label is in every accessible name.
  • Plugins written before 0.46 that drew counts from the item's old experimental_Accessory field show none until they read item.badge.

Header. A navigation's optional headerComponent renders in the sidebar header row while it is active, replacing the separate experimental_sidebarHeader slot and its sidebar.headerProvider setting; that slot remains as an untyped runtime alias so a pre-0.46 plugin's header joins its navigation. The thread list setting is now Sidebar thread list.

Plugin SDK 0.6.53.

  • Restored types and runtime exports.
  • ExperimentalBadgeTone and the new badge fields.
  • Collector validation for placement.
  • Test-harness support (the sidebarNavigation option and sidebarNavigationCalls).
  • Tasks now requires >=0.6.53. No server/daemon wire change.

Docs.

  • docs/configuration.md, the customization guide, and the plugin-authoring references (new frontend-sidebar-navigation.md, plus frontend-core-slots.md and the API indexes).
  • docs/api_to_audit.md entries with stabilization items and the core callers on the same path.
  • A Plugin Guide "Sidebar navigation" surface on the rail fixture, and verify-bb rows for Top list and navigation/header plugins, including disabling the Navigation plugin.
  • The navigation docs, SDK doc comments, and renderer slot docs describe the bundled Navigation plugin, the navigation/* keys, and the built-in-aware Automatic rule.

How you verified

  • Empty header correction (8cee6a05da): the new regression test fails before the fix; all 24 affected sidebar, header, and Settings tests pass after it, along with app lint and typecheck. The rendered macOS simulation confirms an 8-pixel inset above Top list and the retained 48-pixel Settings Search row.

  • Desktop spacing fix (fb133df5d9): both regression tests fail before the fix and pass after it. The 62 focused app layout, sidebar chrome/header, and Settings tests pass; app lint and typecheck pass. An isolated browser with simulated macOS chrome confirms Rail and Top list use identical title-bar/toggle coordinates and Settings Search height, with no extra window-control gutter. Compact windows retain their floating toggle. This renderer check does not verify native Electron window behavior.

  • Windows CI timeout fix (ae0adb0fa6): the two ACP restart tests use the same 30-second allowance as similar process-restart tests. All 499 ACP tests pass locally (4 skipped), along with lint and typecheck; Windows confirmation remains with CI.

  • Full typecheck, lint, and test run is left to CI on this branch (rebased onto 399d63d277). The rail and its Settings cell keep the spacing from Compact the macOS app frame around the traffic lights and move headers into the title bar #5529 (compact macOS frame) and Align sidebar rail and footer icons to the row rhythm #5609 (row-rhythm alignment), and the app typecheck passes after the rebase. Locally, the affected app, SDK, Plugin Guide, Tasks, guide, mobile, and server suites passed before the last rebase; the mobile theme and global.css were regenerated for the new --attention-foreground token.

  • check-plugin-sdk-version.mjs and check-npm-version-guard.mjs pass at 0.6.53.

  • Navigation plugin commit (5a0cc8d599):

    • scripts/check-plugin-forks.mjs plugins/navigation plugins/thread-list: both copies install, typecheck, test, and bb plugin build outside the monorepo with published packages only (Thread list passed on a re-run after one vitest worker start timeout under load).
    • Turbo typecheck and lint pass for the app, both sidebar plugins, shared-ui, plugin registry, server, demo server, domain, SDK, Plugin Guide, and templates. Tests pass for Navigation (14), Thread list, Plugin Guide, plugin registry, demo server (which now serves both sidebar plugins), the server's builtin-registry and UI-preference suites, and 229 app test files across settings, lib, sidebar, code, layout, and plugin. One app file (PluginSettings.test.tsx) failed under the parallel run and passed alone.
    • The app's Rail and Top list integration tests now load the real plugin through test/fixtures/navigation-plugin.ts; the plugin's own drawing (count caps, text badges, More's tone, menus, the header button) is tested portably in plugins/navigation/app.test.tsx.
    • After rebasing onto 399d63d277: turbo typecheck and lint pass for every package affected relative to main (155 tasks); Navigation, Thread list, plugin registry, and 231 app test files pass.
    • Ran pnpm start:worktree with the bundled plugin and the installed Nav Rail, Compact Nav, and Collapsible Navigation plugins. I confirmed the server and plugins come up, but did not repeat the visual pass below after this commit.
  • New and updated tests:

    • provider resolution (sidebarNavigationProvider.test.ts);
    • plugin providers on the real SDK path: list placement, badges, openCustomize, pinned built-ins, crash fallback, and Original (SidebarNavigationHost.test.tsx);
    • Top list rows, text and tone badges, the More dot, and Customize focus (SidebarNavigationList.test.tsx);
    • list placements keep the footer after the navigation in one column (AppSidebar.test.tsx);
    • the rail on the provider host, including invalid badge values (zero count, count plus text, text over 8 characters, unknown tone), text drawn as a toned dot, and More's strongest tone (SidebarNavigationRail.test.tsx);
    • the header slot, Back to app routing, and the last-known preference store;
    • SDK harness and placement validation, and the server reading stored pre-0.46 provider rows.
  • Manual checks with pnpm start:worktree in headless Chromium at 1440×900 (light and dark) and 390×844, plus the packaged macOS desktop app (pnpm desktop:worktree), with Rail and Top list on the framed and unframed windows:

    • Installed from bb-community, unmodified: Nav Rail, Compact Nav, and Collapsible Navigation. Each loads and draws its navigation; Nav Rail docks as a vertical rail with the footer beside it and moves New thread into the header; Compact Nav and Collapsible Navigation also work as header providers.
    • Installed the deleted examples/plugins/sidebar-navigation plugin: Customize, Original, the crash fallback, pinning Rail over it, a reload without a rail flash, and removal falling back to Rail.
    • A local plugin with four badged panels (critical text, warning count, warning text, neutral text) renders as intended on the rail and in the Top list in both themes.
  • Not verified: iOS Safari and the native mobile shell; the header alignment on macOS after the header moved into the plugin. A pinned plugin key that is not installed shows an empty rail-width column on the first load until frontends settle, then falls back.

Follow-up commits on this branch.

  • fb133df5d9 keeps the macOS window chrome stable when switching between rail and list placements (AppLayout.tsx, SidebarChrome.tsx, with tests and docs).
  • 8cee6a05da removes the empty header row above Top list navigation (AppSidebar.tsx, with a test).
  • ae0adb0fa6 gives the ACP restart tests enough time on Windows (provider-bridge-acp-next test timeouts only).
  • CI is green on 8cee6a05da: 48 checks passed or skipped.

Supersedes #5524.

Fixes #5360
Fixes #5327

🤖 Generated with Claude Code

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/undo-left-rail-changes-thr_mgqwa2yese branch 2 times, most recently from 2bd7d5c to e462ac6 Compare October 16, 2026 03:56
ymichael and others added 16 commits October 16, 2026 11:56
…ents

bb draws the sidebar navigation through app.slots.experimental_sidebarNavigation
again, restored under its pre-0.46 names so released navigation plugins load
unmodified. Registrations declare a placement: rail (a fixed column that stays
when the sidebar collapses, with the framed macOS title bar) or list (rows above
the thread list, Settings in the footer, Back to app rows, and the header slot).
bb ships two providers through the same contract, Rail and Top list, picked
with sidebar.navigationProvider in Settings -> Appearance -> Navigation;
Automatic prefers an installed plugin provider and falls back to Rail.

The navigation model now carries Home, Customize, reorder, and each panel's
experimental_useBadge value (folded in from #5524), so every provider draws the
same badges. experimental_sidebarHeader returns for list placements. Plugin
SDK 0.6.52.

Fixes #5360
Fixes #5327

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The navigation region is a nav element again, as it was before #5229, so
plugins that find their column with closest("nav"), such as Nav Rail, dock as
designed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ExperimentalBadge gains text (a short visible value, at most 8 characters,
exclusive with count) and tone (neutral, warning, or critical, drawn with bb's
theme colors). The Top list and More menu draw the count or text in a pill
colored by tone; the icon-only rail draws counts and a tone-colored dot for
text. More's dot takes the strongest hidden tone. The shape follows the 30
bb-community plugins that drew experimental_sidebarAccessory: counts, short
statuses, percentages, and fractions, with red, amber, or neutral colors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Badges use solid fills from the theme: a muted gray for neutral, attention
amber with a new --attention-foreground for warning, and destructive red for
critical. On the rail every count and dot sits in a ring painted with the
rail's own background, so it reads against the icon instead of over it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Top list pins New thread and More and scrolls the destinations between
them, capped near 40% of the window, with fades while more rows sit above or
below. Before, enough plugin panels or a short window pushed the thread list
out of view and clipped More, as the pre-0.46 rows also did. The shared
navigation region stays uncapped so plugin providers keep managing their own
height.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eded

Top list rows get the 0.45 hover "…" button again, with the same menu as
right-click (shared with the rail's context menu), always shown on touch
devices; a badge fades out while the button shows in its place. Rows draw the
split pane map beside the label when their page is open in a split. More only
appears when a destination is hidden, since each row's menu reaches Customize.
shared-ui now exports its sidebar hover-action classes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rail said "Customize rail" and the Top list said "Customize sidebar",
but the editor only picks which destinations show and in what order. One
name now covers the menu items and the editor title on both providers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The list layout put the footer in the bottom grid row the rail uses, outside
the column that holds the navigation and thread list. Docking plugins such
as Nav Rail inset the elements after the navigation in that column, as they
did in 0.45, so they missed the footer: Settings and the footer actions sat
under the rail at the window's edge and the rail's tint stopped above them.
List placements now render the footer after the thread list in the same
column; only the rail keeps the separate row beside its Settings button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Settings -> Appearance called it "Header", which read as any header in the
app. It now matches the "Sidebar footer" setting below it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Sidebar" alone read as the whole sidebar, beside separate Sidebar header
and Sidebar footer settings. It names the part it changes now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rail keeps New thread in the sidebar header, so a header provider never
mounts there. The setting now says so and is disabled instead of offering a
choice that has no effect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sidebar header was a separate exclusive slot with its own setting, so
users could pair a header with a navigation it did not belong to, and the
setting did nothing with a rail. A navigation registration now takes an
optional headerComponent that renders beside the sidebar toggle while that
navigation is active. bb's Rail supplies New thread as its header through
the same resolution, and a crashing plugin header falls back to the header
of bb's provider for the same placement.

experimental_sidebarHeader stays as an untyped runtime alias: a plugin's
header joins each of its navigations without a headerComponent, so Nav
Rail, Compact Nav, and Collapsible Navigation keep working. The Sidebar
header setting and the sidebar.headerProvider preference are removed.

Top list draws New thread as a regular row again, as in 0.45: it follows
the saved order and visibility and appears in Customize. The rail keeps it
pinned in its header and out of Customize.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bb's two sidebar navigation layouts now ship as the bundled, default-enabled
Navigation plugin (plugins/navigation), registered through
experimental_sidebarNavigation like any other provider and kept on the
forkable list. The host keeps only the placement layout, Settings, the
customize editor, and the navigation model.

Whether a provider is built-in now comes from the plugin's install source
instead of per-picker constants, so every replacement slot labels built-in
providers "(built-in)", lists them after installed plugins, and prefers an
installed plugin under Automatic. Shortcut pill, overflow fade, and the split
pane mini-map move into shared-ui and the component registry so the app and
both sidebar plugins share one copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/undo-left-rail-changes-thr_mgqwa2yese branch from 1d50964 to 5a0cc8d Compare October 16, 2026 18:58
@ymichael
ymichael merged commit 3e7e490 into main Oct 16, 2026
48 checks passed
@ymichael
ymichael deleted the bb/undo-left-rail-changes-thr_mgqwa2yese branch October 16, 2026 20:43
@yusuf8834

Copy link
Copy Markdown

when top list enabled. right and left edges are not equal.

image

ymichael added a commit that referenced this pull request Oct 17, 2026
## Human comments

## What was wrong

Follow-up to #5584 (reported in
#5584 (comment): "when
top list enabled, right and left edges are not equal"). In the framed
macOS desktop window, the window frame left an 8px lip on the right and
bottom of the card. With the Rail placement, the rail fills the left
side. With the list placement (Top list) there is no rail, and the frame
had no leading lip, so the sidebar card (and the content card when the
sidebar is collapsed) sat flush against the window's left edge. The
collapsed title-bar reserve also assumed a rail was present, so the page
title overlapped the sidebar toggle in Top list.

## What changed

- `apps/app/src/components/ui/sidebar.tsx`, `apps/app/src/app.css`: with
the list placement, the frame gains a leading lip
(`--bb-window-frame-leading-lip`), so the sidebar card and the collapsed
content card are inset 8px on the left, matching the right and bottom.
`SidebarProvider` publishes `--bb-window-card-collapsed-left`: the rail
width for Rail, the leading lip for Top list.
- `apps/app/src/lib/bb-desktop.ts`:
`MACOS_TITLE_BAR_COLLAPSED_SIDEBAR_RESERVE_CLASS` subtracts
`--bb-window-card-collapsed-left` instead of assuming a rail, so the
title clears the toggle when the sidebar is collapsed in Top list.
- Rail placement and non-macOS or unframed windows are unchanged. No
wire, CLI, or plugin API changes.

## How you verified

- Added cases to `apps/app/src/components/ui/sidebar.test.tsx` for the
leading lip and the published collapsed-left offset under both
placements.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` and the
sidebar/layout/secondary-panel tests pass.
- Measured in the real Electron app via CDP, window 1280px wide:
  - Top list open: left gap 0 -> 8px; right and bottom gaps stay 8px.
- Top list collapsed: left gap 0 -> 8px; the title now clears the
sidebar toggle.
  - Rail open and collapsed: unchanged.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Oct 20, 2026
## Human comments

## What was wrong

Holding ⌘ shows shortcut pills, and the icon-only chrome buttons drew
theirs outside their own bounds: the sidebar toggle's pill was `absolute
left-full`, the back/forward pair was `absolute right-full` of the
arrows, and the right-panel toggle's pill was `absolute right-full`,
`absolute top-full`, or an inline sibling depending on the surface. Each
assumed the space beside it was empty. The rail navigation (#5584) puts
New thread, with its own `⇧⌘O` pill, directly in that space, so `⌘ \`
covered the New thread icon and `⌘[ ⌘]` stacked on top of `⇧⌘O`. In a
thread, the inline `⌘J` pushed the close and open-in-editor buttons
sideways, and with the panel open the hide-panel `⌘J` landed on the
maximize button.

## What changed

- Sidebar toggle and back/forward: no held-modifier pill, matching the
rail's own icon buttons. Their shortcut stays in the accessible label,
and in the existing tooltip for back/forward.
- `AppLayout.tsx`: the sidebar toggle hint is removed from all three
header layouts (framed, macOS desktop chrome, browser overlay).
- `SidebarHistoryNavigationControls.tsx`: the floating `⌘[ ⌘]` pair is
deleted.
- Right-panel toggle (`⌘J`): the hint is kept but moved under the
button, right-aligned, on every surface: `RootComposeView.tsx`,
`ThreadDetailHeader.tsx`, `ThreadSecondaryPanel.tsx`, and
`SplitWorkspaceSecondaryPanelHost.tsx` (which already used this
placement). One constant, `RIGHT_PANEL_TOGGLE_SHORTCUT_HINT_CLASS` in
`panelToggleControlState.ts`, holds the placement; `z-10` keeps it above
the open panel's body.
- Pills inside wide, labeled controls are unchanged: New thread, model
picker, composer focus, open-in-editor, thread rows ⌃1–9.

No wire, CLI, plugin API, or data changes.

## How you verified

- Real dev server with a connected host and seeded threads, ⌘ held at
1280×860, main (9e5c8a9) vs this branch on the same data. Home: main
overlaps `⌘ \` with the New thread icon and `⌘[ ⌘]` with `⇧⌘O`; the
branch shows only New thread's pill. Thread header: main's inline `⌘J`
shifts the close and open-in-editor buttons; the branch shows `⌘J` under
the toggle and the buttons stay put. Panel open: main's `⌘J` lands on
the maximize button; the branch shows it under the hide button, clear of
maximize (without `z-10` the panel body painted over it).
- Adjacent pills still appear while ⌘ is held on the branch: `⇧⌘O`,
`⌃1`–`⌃3`, `⇧⌘C`, `⇧⌘M`, `⌘O`, and `⌘J` on home, thread, and the open
panel.
- Controls still work: the sidebar toggle flips `aria-expanded` both
ways; back/forward navigate between home and a thread; the back tooltip
shows `⌘ [`; ⌘J opens the panel and the hide button closes it; labels
read `Toggle sidebar (⌘ \)` and `Hide right panel (⌘ J)`.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes. `vitest
run src/components src/views` in `apps/app`: 4386 passed, 3 skipped. The
test that asserted the floating back/forward pair appears while ⌘ is
held is deleted with the behavior it covered.

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
diegopetrucci added a commit to diegopetrucci/tlh-gui that referenced this pull request Oct 24, 2026
* Fix browser destination URL while loading (#5629)

## Human comments

## What was wrong

The desktop browser state used Electron's committed URL while a
main-frame navigation was still loading. State updates therefore
replaced the destination in the URL bar with an empty string on a new
tab or the previous page's URL on an existing tab.

## What changed

Track the pending main-frame URL through navigation and redirects,
ignoring iframe navigation. Clear it on commit or cancellation, and
retain failed destinations for error display. No daemon wire or CLI
contracts change.

## How you verified

- Regression was demonstrated before the fix on the source machine for
both empty and existing tabs.
- On M5: `pnpm exec turbo run test --filter=@bb/desktop --
test/desktop-browser-view-manager.test.ts` passed all 94 tests,
including redirects, iframe events, cancellation, failure, and recovery.
- `pnpm exec turbo run lint typecheck --filter=@bb/desktop` passed.
- `pnpm desktop:worktree` packaged and launched an isolated desktop;
server and daemon health checks passed with the local host connected.
- Visual URL-bar testing remains pending. Verification inventory has
pre-existing `Unmapped CLI family: browser` drift.

> AGENT GENERATED

* Add @phyjswang to allow list

* Start-align tables inside nested timeline groups (#5632)

## Human comments

## What was wrong

Markdown tables wider than the text column break out symmetrically,
centered on the column, up to the room available on the narrower side of
the nearest clipping ancestor. Inside a nested timeline group
(child-thread reports, delegations, turn details) the text column is
indented behind the group's left rail, so a wide table extended left
past the rail and the rail drew straight through the table's cells.

## What changed

- `NESTED_TIMELINE_GROUP_LINE_CLASS_NAME` now sets
`--md-table-start-offset: 0px` (`markdown-table-breakout.ts`). Tables
inside a nested group start at the text column and break out to the
right only.
- `MarkdownTable` derives its start margin from that variable, falling
back to the existing centered margins, and start-aligns the scroll
wrapper the same way. Top-level tables are unchanged.
- The breakout limit measurement gives start-aligned tables the room to
the clip's right edge minus 1rem, the same gutter the centered `100cqw -
2rem` cap leaves.
- New Ladle row "child-completed — wide table" in
`GeneratedConversationMessage.stories.tsx`.

No wire, CLI, or plugin API changes.

## How you verified

- New case in `markdown-preview.test.tsx`: a start-aligned table gets
the full right-hand room (`calc(1100px - 1rem)`); the centered
calculation yields `500px` for the same geometry, so the case fails
without the change.
- `pnpm exec turbo run typecheck lint test --filter='...[origin/main]'`:
14/14 tasks pass.
- `pnpm start:worktree` with a parent thread and a child whose
completion report contains a 3-column wide table: the parent's top-level
tables still span x 336–1424, centered on the column; the nested
report's table spans 544–1424, starting at the report's text column
clear of the rail and sharing the same right edge.
- Ladle: the markdown-preview breakout story is still centered on the
column.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Quote rendered math as raw TeX in selection copy and Add to chat (#5619)

KaTeX renders each formula twice, a visually hidden MathML copy and the visible HTML, so serializing a selection produced output like "E=mc2E = mc^2E=mc2". Selections now expand to whole formulas and serialize each as the TeX from its annotation: $$tex$$ inline, a $$ block for display math.

Markdown file previews use the same serializer for Add to chat and for copy (Cmd+C/Ctrl+C). The HTML clipboard flavor replaces each formula with its MathML, without the TeX annotation, so rich paste shows it once.

Co-authored-by: Junsen Wang <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Skip first-run setup by default for source development (#5633)

## Human comments

## What was wrong

Fresh source development instances showed first-run setup every time a
new checkout received its own database, interrupting development and
verification.

## What changed

Default `BB_SKIP_ONBOARDING` to `1` for `pnpm dev` and `pnpm
start:worktree`, while preserving explicit environment overrides such as
`BB_SKIP_ONBOARDING=0`. Server startup records onboarding completion
only when the flag is enabled and completion is missing. Normal server
launches default the flag to false, and Settings can still replay setup.
Documented the flag and source-launch behavior. No server/daemon wire
changes.

## How you verified

- `pnpm exec turbo run test --filter=@bb/scripts --
test/run-dev.test.ts`: all 21 tests pass. Both override regression cases
failed before the fix and passed afterward.
- `pnpm exec turbo run lint typecheck --filter=@bb/scripts`: package
typecheck passes (no package lint task).
- `git diff --check`: passes.

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Make the sidebar navigation a provider slot with rail and list placements (#5584)

## Human comments

## What was wrong

#5229 (0.46.0) made the icon rail the only sidebar navigation and
removed the plugin API that let a plugin draw it
(`experimental_sidebarNavigation`, `experimental_sidebarHeader`, and
their hooks).
- Users who preferred labeled rows had no way back (#5360).
- Navigation plugins on the marketplace stopped loading: Nav Rail,
Compact Nav, Collapsible Navigation, Slim Nav, Sidebar Subtitles, and
Herdr commands (#5376).
- Panel counts had nowhere to show, because the rail is icon-only and no
longer mounted `experimental_sidebarAccessory` (#5327). 30 bb-community
plugins draw one.

The old slot only covered rows above the thread list, so the rail and
the slot could not coexist.

## What changed

**One navigation slot with a declared placement.**
- `app.slots.experimental_sidebarNavigation` is restored under its
pre-0.46 names. Registrations declare `placement: "rail" | "list"`;
`list` is the default, so older plugins keep working.
- bb lays out the sidebar from the placement before the provider
renders:
- **rail:** a fixed column that stays when the sidebar collapses, New
thread in the header and Settings at the bottom of the column.
- **list:** rows above the thread list, the footer in the same column
after the thread list with a Settings action, Back to app rows on the
Settings, Plugins, and Skills lists, a collapse that hides the whole
sidebar, and the header slot.
- Both placements use the same macOS window frame on wide viewports.
Switching navigation keeps the title-bar controls in place and Settings
Search at the same height; sidebar headers do not reserve an empty
window-control gutter below the title bar. Providers without header
controls use only an 8-pixel top inset instead of reserving an empty
48-pixel header row. Compact windows retain the floating toggle.
- bb's Top list keeps the 0.45 row affordances: a hover "…" options
button (always shown on touch devices) with the same menu as
right-click, the split pane map beside a row's label when its page is
open in a split, and More only when a destination is hidden.
- bb's Top list pins New thread and More and scrolls the destinations
between them, capped near 70% of the window with fades at the scroll
edges, so many plugin panels or a short window can't push the thread
list out of view (the pre-0.46 rows could). The shared region stays
uncapped so plugin providers manage their own height.
- bb's own **Rail** (`navigation/rail`, the default) and **Top list**
(`navigation/top-list`) are the bundled Navigation plugin (see below),
so they use exactly the contract a third-party provider gets.
- The region is a `<nav>` element again, as before #5229, and list
placements keep the footer after the thread list in the same column, as
0.45 did. Plugins that find their column with `closest("nav")` and inset
what follows, such as Nav Rail, therefore dock with the footer beside
the rail.
- Picking a provider (`sidebar/sidebarNavigationProvider.ts`):
- `sidebar.navigationProvider` (Settings → Appearance → Navigation)
selects Automatic or a provider by plugin key.
- Automatic uses the first provider from a plugin the user installed,
else the first built-in one (Rail). A pinned provider that is missing
once plugins settle falls back the same way; with no provider at all the
sidebar uses the list placement and says no navigation plugin is
enabled.
  - Legacy `__builtin__` and `navigation/navigation` read as Automatic.
- Before plugin frontends settle, a plugin provider's last placement is
reserved, so a reload does not flash the rail.
- A crashing provider or header is replaced by the built-in provider for
its placement, with one toast.
- `experimental_Original` renders the built-in provider for the same
placement, or nothing when the Navigation plugin is disabled.

**Rail and Top list are a bundled, forkable plugin**
(`plugins/navigation`).
- The plugin registers both providers, plus Rail's New thread button as
its `headerComponent`, using only `experimental_useSidebarNavigation`,
`experimental_useSidebarNavigationSplit`,
`experimental_SidebarNavigationIcon`, and registry components. It is
default-enabled, on `scripts/forkable-plugins.json`, and served by the
demo server.
- The host keeps only what surrounds a provider: the placement layout
(including the rail's top inset), Settings, the customize editor, the
navigation model, and badge collection. The macOS window frame is
independent of navigation placement, and navigation headers sit below
the title bar on wide macOS windows.
- The shortcut pill, overflow fade, and split-pane mini-map move into
shared-ui and the component registry, so the app, Navigation, and Thread
list share one copy each (Thread list drops its private copies).

**Built-in providers come from the install source.**
- The app records which plugins were installed as built-ins from the
plugin list. Every replacement setting (thread list, navigation, source
code, diffs) labels their providers "(built-in)" and lists them after
installed plugins, and Automatic prefers a provider from an installed
plugin, then slot order. No per-slot constants remain.
- Monaco is a built-in plugin, so it now shows as "(built-in)" in the
Source code and Diffs settings, and Automatic prefers a third-party
renderer over it.
- The bundled Thread list option drops its "BB default." description;
the Automatic row already names what it chooses.
- The Navigation setting hides when no navigation plugin is installed,
like the thread list setting, and settings search uses the matching
condition.

**Shared model** (`SidebarNavigationModel.tsx`,
`lib/plugin-sidebar-navigation.ts`):
- `experimental_useSidebarNavigation()` returns `isHomeActive`, and its
actions include `goHome()`, `setOrder()`, and `openCustomize()`.
`openCustomize()` opens bb's editor in a popover beside any provider,
after open menus close, and returns focus to the control that opened it.
bb's menus and the editor call it "Customize navigation" on every
provider.
- Each panel's `experimental_useBadge` value is in the model as
`item.badge`. The badge sources mount once in the model instead of in
the rail.

**Badges (supersedes #5524).**
- This PR includes #5524's value-based `experimental_useBadge` and its
compatibility handling for `experimental_sidebarAccessory` (the field is
dropped with a warning), plus Tasks' migration to the hook.
- `ExperimentalBadge` is `{ count?, text?, tone?, label }`:
- `text` is a short visible value of at most 8 characters, such as
"NEW", "73%", or "2 down", and cannot be combined with `count`;
- `tone` is `neutral` (the default), `warning`, or `critical`, and bb
owns the colors.
- The fields follow the 30 bb-community plugins that drew
`experimental_sidebarAccessory`: 12 drew one count, 8 several numbers or
a fraction, 5 a short status, 3 a percentage, and 18 used red, amber, or
an accent color for state.
- Drawing:
- Fills are solid theme colors: muted gray for neutral, attention amber
with a new `--attention-foreground` for warning, and destructive red for
critical.
- The rail draws counts (capped at `9+`) and a tone-colored dot for
text, each cut out of the icon by a ring in the rail's own background.
- The Top list and More menu draw the count (capped at `99+`), the text,
or a dot.
- More's dot takes the strongest hidden tone, and the label is in every
accessible name.
- Plugins written before 0.46 that drew counts from the item's old
`experimental_Accessory` field show none until they read `item.badge`.

**Header.** A navigation's optional `headerComponent` renders in the
sidebar header row while it is active, replacing the separate
`experimental_sidebarHeader` slot and its `sidebar.headerProvider`
setting; that slot remains as an untyped runtime alias so a pre-0.46
plugin's header joins its navigation. The thread list setting is now
**Sidebar thread list**.

**Plugin SDK 0.6.53.**
- Restored types and runtime exports.
- `ExperimentalBadgeTone` and the new badge fields.
- Collector validation for `placement`.
- Test-harness support (the `sidebarNavigation` option and
`sidebarNavigationCalls`).
- Tasks now requires `>=0.6.53`. No server/daemon wire change.

**Docs.**
- `docs/configuration.md`, the customization guide, and the
plugin-authoring references (new `frontend-sidebar-navigation.md`, plus
`frontend-core-slots.md` and the API indexes).
- `docs/api_to_audit.md` entries with stabilization items and the core
callers on the same path.
- A Plugin Guide "Sidebar navigation" surface on the rail fixture, and
verify-bb rows for Top list and navigation/header plugins, including
disabling the Navigation plugin.
- The navigation docs, SDK doc comments, and renderer slot docs describe
the bundled Navigation plugin, the `navigation/*` keys, and the
built-in-aware Automatic rule.

## How you verified

- Empty header correction (`8cee6a05da`): the new regression test fails
before the fix; all 24 affected sidebar, header, and Settings tests pass
after it, along with app lint and typecheck. The rendered macOS
simulation confirms an 8-pixel inset above Top list and the retained
48-pixel Settings Search row.
- Desktop spacing fix (`fb133df5d9`): both regression tests fail before
the fix and pass after it. The 62 focused app layout, sidebar
chrome/header, and Settings tests pass; app lint and typecheck pass. An
isolated browser with simulated macOS chrome confirms Rail and Top list
use identical title-bar/toggle coordinates and Settings Search height,
with no extra window-control gutter. Compact windows retain their
floating toggle. This renderer check does not verify native Electron
window behavior.
- Windows CI timeout fix (`ae0adb0fa6`): the two ACP restart tests use
the same 30-second allowance as similar process-restart tests. All 499
ACP tests pass locally (4 skipped), along with lint and typecheck;
Windows confirmation remains with CI.

- Full typecheck, lint, and test run is left to CI on this branch
(rebased onto `399d63d277`). The rail and its Settings cell keep the
spacing from #5529 (compact macOS frame) and #5609 (row-rhythm
alignment), and the app typecheck passes after the rebase. Locally, the
affected app, SDK, Plugin Guide, Tasks, guide, mobile, and server suites
passed before the last rebase; the mobile theme and `global.css` were
regenerated for the new `--attention-foreground` token.
- `check-plugin-sdk-version.mjs` and `check-npm-version-guard.mjs` pass
at 0.6.53.
- Navigation plugin commit (`5a0cc8d599`):
- `scripts/check-plugin-forks.mjs plugins/navigation
plugins/thread-list`: both copies install, typecheck, test, and `bb
plugin build` outside the monorepo with published packages only (Thread
list passed on a re-run after one vitest worker start timeout under
load).
- Turbo typecheck and lint pass for the app, both sidebar plugins,
shared-ui, plugin registry, server, demo server, domain, SDK, Plugin
Guide, and templates. Tests pass for Navigation (14), Thread list,
Plugin Guide, plugin registry, demo server (which now serves both
sidebar plugins), the server's builtin-registry and UI-preference
suites, and 229 app test files across settings, lib, sidebar, code,
layout, and plugin. One app file (`PluginSettings.test.tsx`) failed
under the parallel run and passed alone.
- The app's Rail and Top list integration tests now load the real plugin
through `test/fixtures/navigation-plugin.ts`; the plugin's own drawing
(count caps, text badges, More's tone, menus, the header button) is
tested portably in `plugins/navigation/app.test.tsx`.
- After rebasing onto `399d63d277`: turbo typecheck and lint pass for
every package affected relative to main (155 tasks); Navigation, Thread
list, plugin registry, and 231 app test files pass.
- Ran `pnpm start:worktree` with the bundled plugin and the installed
Nav Rail, Compact Nav, and Collapsible Navigation plugins. I confirmed
the server and plugins come up, but did not repeat the visual pass below
after this commit.
- New and updated tests:
  - provider resolution (`sidebarNavigationProvider.test.ts`);
- plugin providers on the real SDK path: list placement, badges,
`openCustomize`, pinned built-ins, crash fallback, and Original
(`SidebarNavigationHost.test.tsx`);
- Top list rows, text and tone badges, the More dot, and Customize focus
(`SidebarNavigationList.test.tsx`);
- list placements keep the footer after the navigation in one column
(`AppSidebar.test.tsx`);
- the rail on the provider host, including invalid badge values (zero
count, count plus text, text over 8 characters, unknown tone), text
drawn as a toned dot, and More's strongest tone
(`SidebarNavigationRail.test.tsx`);
- the header slot, Back to app routing, and the last-known preference
store;
- SDK harness and placement validation, and the server reading stored
pre-0.46 provider rows.
- Manual checks with `pnpm start:worktree` in headless Chromium at
1440×900 (light and dark) and 390×844, plus the packaged macOS desktop
app (`pnpm desktop:worktree`), with Rail and Top list on the framed and
unframed windows:
- Installed from bb-community, unmodified: **Nav Rail**, **Compact
Nav**, and **Collapsible Navigation**. Each loads and draws its
navigation; Nav Rail docks as a vertical rail with the footer beside it
and moves New thread into the header; Compact Nav and Collapsible
Navigation also work as header providers.
- Installed the deleted `examples/plugins/sidebar-navigation` plugin:
Customize, Original, the crash fallback, pinning Rail over it, a reload
without a rail flash, and removal falling back to Rail.
- A local plugin with four badged panels (critical text, warning count,
warning text, neutral text) renders as intended on the rail and in the
Top list in both themes.
- Not verified: iOS Safari and the native mobile shell; the header
alignment on macOS after the header moved into the plugin. A pinned
plugin key that is not installed shows an empty rail-width column on the
first load until frontends settle, then falls back.

**Follow-up commits on this branch.**
- `fb133df5d9` keeps the macOS window chrome stable when switching
between rail and list placements (`AppLayout.tsx`, `SidebarChrome.tsx`,
with tests and docs).
- `8cee6a05da` removes the empty header row above Top list navigation
(`AppSidebar.tsx`, with a test).
- `ae0adb0fa6` gives the ACP restart tests enough time on Windows
(`provider-bridge-acp-next` test timeouts only).
- CI is green on `8cee6a05da`: 48 checks passed or skipped.

Supersedes #5524.

Fixes #5360
Fixes #5327

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Improve video attachment previews and consolidate file streaming (#5636)

## Human comments

## What was wrong

Video attachments appeared as file pills and lacked image-style
previews. Playback downloaded entire attachments because their endpoint
ignored byte ranges. Video elements created during abandoned React
renders also fetched media, multiplying requests, and completed uploads
discarded access to the selected local video. Attachments and
daemon-hosted files implemented HTTP responses separately.

## What changed

- Add video thumbnails and native playback in the shared attachment
lightbox, preserving playback keyboard controls and image gallery
navigation.
- Assign video sources only after React commits and release them on
unmount. Reuse uploaded local videos for composer previews, including
MOV files without a MIME type.
- Share range, conditional-cache, HEAD, response-header, streaming, and
cancellation handling between attachment and daemon file responses. Keep
separate local and daemon readers and existing route authorization,
cache, and security policies.
- Document the shared delivery path and range verification. Git revision
reads retain their existing whole-file path. No daemon wire fields, CLI
commands, or SDK contracts changed.

## How you verified

- `pnpm exec turbo run test lint typecheck --filter=@bb/app`: 5,934
tests passed, 3 skipped; typecheck and lint passed (existing warnings
only).
- Focused server tests through Turbo: 99 tests passed across shared
streaming, daemon responses, attachment routes, and file routes; server
typecheck and scoped lint passed.
- Regression tests cover abandoned React renders, local video reuse,
mixed galleries, ranges, validators, HEAD, cancellation, read failures,
and local file changes. Local-video regressions failed before the cache
fix and passed afterward.
- Browser checks verified thumbnail/lightbox playback and zero
attachment-content downloads for a newly uploaded local video. Network
investigation confirmed abandoned video elements no longer request
media.
- Rebuilt `pnpm start:worktree`; live local and daemon endpoints
returned matching 1,024-byte 206 responses and bodyless HEAD responses
with the full content length.

> AGENT GENERATED

* Fix timeline bounce during automatic group collapse (#5637)

## Human comments

## What was wrong

Switching back to a thread could show a cached, expanded running-command
group before refreshed completed rows arrived. The disclosure retained
its body during the automatic collapse, briefly rendering the larger
refreshed body before shrinking over 200 ms. This pushed messages up and
then down while the composer stayed fixed.

## What changed

Automatic expansion changes in the shared expandable timeline row now
settle without animating or retaining the closing body. User-triggered
toggles retain their animation. This also applies to expandable system
rows such as provisioning; separate status indicators and other
content-height changes are outside this fix.

## How you verified

- Added a regression that failed before the fix and passes afterward,
covering refreshed automatic collapse and preservation of manual toggle
animation.
- Passed 50 tests across ExpandableTimelineRow, disclosure, and
ThreadTimelineRows.actions using `pnpm exec turbo run test
--filter=@bb/app -- src/components/ui/disclosure.test.tsx
src/components/thread/timeline/ExpandableTimelineRow.test.tsx
src/components/thread/timeline/ThreadTimelineRows.actions.test.tsx`.
- Passed `pnpm exec turbo run lint typecheck --filter=@bb/app` (lint has
existing warnings).
- Reproduced with the real timeline components in an isolated browser
fixture without browser previews: before the fix, a message moved up 52
px then down 72 px; after the fix it moved directly to its final
position, 20 px below the initial position.
- Built and opened `pnpm start:worktree` with three sample threads for
manual switching and disclosure checks.

> AGENT GENERATED

* fix(app): avoid auto-linking ambiguous slash references (#5639)

## Human comments

## What was wrong

The Markdown renderer treated any slash in inline code as evidence of a
file path. Git references such as `origin/main` and `...[origin/main]`
consequently became links to nonexistent files under the thread
workspace.

## What changed

Require an explicit path prefix, a filename extension, or a line
reference before automatically linking inline code. Ambiguous
extensionless relative references such as `scripts/run` remain code;
`./scripts/run`, references with line numbers, and explicit Markdown
links still work. This remains a syntactic heuristic rather than a
file-existence check.

## How you verified

- Extended the existing renderer cases; the four ambiguous-reference
cases failed before the fix and passed afterward.
- `pnpm exec turbo run test lint typecheck --filter=@bb/app`: passed;
5,991 tests passed, four skipped; lint reported 254 warnings and zero
errors.
- Formatted both changed files and ran `git diff --check`.

> AGENT GENERATED

* fix(acp): hide Fast for models that cannot apply it (#5643)

## Human comments

## What was wrong

ACP-native model discovery omitted `supportedServiceTiers`, which caused
the model picker to inherit the ACP provider's Default/Fast list. Agents
such as OMP and Hermes therefore showed a Fast toggle even though the
bridge could not apply it.

## What changed

Both ACP bridges now report explicit model-level service tiers. Existing
model configuration probes advertise Fast only when the model exposes a
selectable `fast` option accepting `true`; unsupported, unprobed, legacy
session-model, and synthetic fallback models report an empty list. CLI
model families retain their existing fast-variant support. Discovery and
runtime selection share the Fast option lookup.

This corrects values under the existing service-tier contract; no wire
shape, CLI, or configuration surface changes.

## How you verified

- Extended bridge regression tests for native discovery, per-model Fast
support, failed probes, legacy model lists, and synthetic fallbacks;
confirmed failure before the fix.
- `pnpm exec turbo run test lint typecheck
--filter=@bb/provider-bridge-acp --filter=@bb/provider-bridge-acp-next`:
passed (893 tests passed, 8 skipped).
- `pnpm exec turbo run test --filter=@bb/domain --
test/service-tier.test.ts`: 6 passed.
- `pnpm start:worktree`: build and startup passed; live OMP and Hermes
model catalogs report explicit empty supported tiers. Cursor live
discovery requires authentication.
- ACP Cursor replay comparison: old/new output matched; the runner
reported 4 passes, 6 failures from stale pre-existing allowlist entries,
and 1 process-scoped model-list skip.

> AGENT GENERATED

* Render single-dollar inline math with Pandoc delimiter rules (#5648)

## Human comments

## What was wrong

#512 fixed #511 (prices like `$5 to $10` rendering as math) by setting
`singleDollarTextMath: false` on remark-math, which turned off
single-dollar math everywhere. Inline `$x$`, the form most Markdown and
model output use, has shown as raw TeX in chat and in Markdown file
previews since then. KaTeX was also lazy-loaded only when content
contained `$$`.

## What changed

Based on the prototype @phyjswang proposed in #5557 (commit authored by
them).

- `apps/app/src/components/ui/markdown-inline-dollar-math.ts`: a
micromark text construct for `$…$` that emits the same `mathText` tokens
as remark-math, so `mdast-util-math` and `rehype-katex` handle it
unchanged. It applies Pandoc's delimiter rules: the opening `$` must
precede non-whitespace, the closing `$` must follow non-whitespace and
must not precede a digit. A backtick or stray `$` inside the span
cancels the match, `\$` inside math is an escape, and `$$x$` does not
start math at its second `$`.
- `markdown-preview.tsx`: registers the construct after remark-math,
which keeps `singleDollarTextMath: false`.
- `markdown-katex-loader.ts`: `markdownMayContainMath` also matches
`$…$`, so KaTeX loads for single-dollar math.
- `micromark-extension-math` added as a direct dependency for its token
type augmentation.
- Story copy updated.

| Input | Result |
|---|---|
| `$E = mc^2$`, `$a⏎b$`, `$\$5$`, `the $n$th term` | math |
| `$5 to $10`, `$20,000 and $30,000`, `$5/$10`, `$5-$10`, `$ x $`, ``
`$x$` `` | literal |
| `It costs $5 and $\alpha$` | `$5` literal, `\alpha` math |

Known trade-off, same as Pandoc: `$HOME/$USER` outside a code span
renders `HOME/` as math.

## How you verified

- Tests in `markdown-preview.test.tsx` cover single-dollar math, prices
next to math, code spans after currency (with `incrementalBlocks` on and
off), and the literal cases above. The old test asserting `$x$` stays
literal is replaced.
- `pnpm exec turbo run typecheck lint test --filter=@bb/app`: typecheck
and lint pass. 6000 tests passed and 3 failed in the full run
(`CommandPalette.cold-open`, `CommandPalette`,
`TimelineRowDetails.output-preview`); all 3 pass when rerun alone
together with the markdown suites, so they were load flakes.
- Manual: `pnpm start:worktree` with an agent reply containing a
math/price checklist. All 8 math items rendered (7 inline plus one
display), with no KaTeX errors, and every price and code span stayed
literal.
- Perf, ~50–80 KB single documents, median of 7 runs: parse time is
within noise for prose, prices, and math. The worst case, 20,000 `$5 `
in one paragraph, goes from 36 ms to 47 ms, and cost stays linear. The
`markdownMayContainMath` check costs at most ~300 µs on 60 KB.

Fixes #5557

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Junsen Wang <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(app): let the folder browser switch between Windows drives (#5647)

## Human comments

## What was wrong

The project folder browser (`RemotePathBrowser`) only listed the
children of the current directory. At a Windows drive root `parent` was
`null`, and nothing listed the host's other drives, so drives such as
Google Drive's G: and H: could only be reached by typing a path into
"Edit path". Investigation report:
https://get-bb.github.io/reports/issues/5358.html

## What changed

- **Daemon (`host.browse_directory`)**: the listing now includes
`roots`, the host's filesystem roots. On Windows this is every
accessible drive A–Z, each checked with a 1 s timeout so a disconnected
network drive can't stall the listing
(`apps/host-daemon/src/command-handlers/filesystem-roots.ts`). On other
platforms it is `["/"]`.
- **Daemon**: the browse handler now resolves symlinks with Node's JS
`fs.realpath` instead of the native one. The native call asks Windows
for the final path, which rewrites subst drives to their target folder
and mapped network drives to UNC paths (which bb rejects). Picking such
a drive from the new menu would otherwise leave the drive. POSIX
resolution is unchanged.
- **App**: when the host has more than one root, the drive breadcrumb
becomes a menu of drives (`C: ⌄`), and picking one opens that drive.
- **Wire change**: `roots` is required in `directoryListingSchema`
(host-daemon contract) and `hostDirectoryListingSchema` (server
contract). `HOST_DAEMON_PROTOCOL_VERSION` 238 → 239.
- **SDK/CLI**: `sdk.hosts.directory` returns `roots` automatically.
There is no CLI browse command, and the browser is not exposed to
plugins.
- Ladle: a "windows drives" row in `dialogs/Project Path`.

## How you verified

- New `filesystem-roots.test.ts`: on POSIX it returns `/` without
checking anything; with a simulated win32 host it lists C:, G: and H:;
drives whose check errors or never answers are left out.
- New win32-only test in `host-files.test.ts` (runs in the Windows
`packages-host` CI shard): it maps a spare drive letter with `subst`,
browses it, and asserts that the browser stays on that drive, `parent`
is `null`, the files are listed, and `roots` includes both the system
drive and the subst drive. This has not run locally (macOS); this PR's
Windows CI run is its first.
- `turbo run typecheck lint` for host-daemon, app, server,
host-daemon-contract, server-contract and sdk: passing.
Host-daemon-contract tests pass; targeted vitest runs of the daemon
browse, app dialog and server thread-storage-orphans tests pass.
- Ladle: opening the drive menu in the Windows story lists `C:\`, `G:\`,
`H:\`.
- Not verified: native Windows with real Google Drive for desktop
mounts.

Fixes #5358

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(app): wrap long Mermaid labels at fractional zoom (#5649)

## Human comments

## What was wrong

Mermaid 11.15.0 wraps an HTML label only when its measured width is
exactly equal to the 200px wrapping width
([createText.ts](https://github.com/mermaid-js/mermaid/blob/41646dfd43ac83f001b03c70605feb036afae46d/packages/mermaid/src/rendering-util/createText.ts#L70-L76)).
At a fractional devicePixelRatio, Chromium measures a clamped label at
about 199.99px instead of 200. The check fails, so long flowchart labels
stay on one line and are cut off. One example is the desktop app at 90%
zoom on a Retina display (devicePixelRatio 1.8). This is the upstream
bug mermaid-js/mermaid#7794, which is still open.

## What changed

- Added `patches/[email protected]`, registered in
`pnpm.patchedDependencies`. It applies the fix from the upstream PR
mermaid-js/mermaid#8233 (open, unreleased): `bbox.width === width`
becomes `bbox.width >= width - 1`.
- The patch changes the three unminified builds (`mermaid.core`, which
the app bundles, plus `mermaid.esm` and `mermaid.js`). It leaves out the
minified builds, which would add about 95 KB of single-line hunks.
- This differs from the fix suggested in the issue, `htmlLabels: false`,
because the patch keeps HTML-only label features such as icons. Delete
the patch once Mermaid releases the upstream fix; pnpm fails the install
on a version bump, so it cannot be left behind silently.

## How you verified

- Reproduced in a hidden Electron 44 window with
`webContents.setZoomFactor`, using the issue's flowchart and
`mermaid/dist/mermaid.js`:
- Stock 11.15.0 at zoom 0.9 (devicePixelRatio 1.8): 0/4 long labels
wrap. Measured width 199.9945px, `white-space: nowrap`.
  - Patched at zoom 0.9: 4/4 wrap.
  - Zooms 0.67, 0.8, 1, 1.1, 1.25 and 1.5 wrap both before and after.
  - The count of short `nowrap` labels is unchanged at every zoom.
- `pnpm exec turbo run build --filter=@bb/app`: the built chunk contains
`g.width>=n-1`.
- `pnpm exec turbo run test --filter=@bb/app -- markdown-mermaid`: 21
passed.
- `pnpm install --frozen-lockfile` passes.

Fixes #5448

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Show foreground Claude Code commands and subagents as foreground work (#5650)

## Human comments

## What was wrong

Claude Code sends a `task_started` message for long-running
**foreground** work as well as background work, and marks which one it
is with `is_backgrounded`. BB ignored that flag (#5641):

- Every `local_bash` task became a `backgroundTask` item. A blocking
foreground Bash command showed a "Background command" card above the
composer and an extra "Running background command" row in the timeline.
The thread looked like it had handed the command off, but a steer waited
until the command finished.
- Foreground subagents (`local_agent` with `is_backgrounded: false`) are
kept as task items on purpose, because the delegation row reads their
progress. Nothing recorded that they were foreground, though. The
composer card said "Running background agent", and the thread activity
counts included them.

## What changed

**Foreground Bash commands**
(`plugins/provider-claude-code/src/task-translation.ts`)
- A `local_bash` task that starts with `is_backgrounded: false` is
tracked but not materialized. It stays a normal running command.
- If a later `task_updated` reports `patch.is_backgrounded: true`, the
bridge opens the `backgroundTask` item then, and the usual completion
closes it.

**Foreground subagents**
- `backgroundTask` items carry a new `foreground` flag. The Claude Code
bridge sets it from `task_started.is_backgrounded` and clears it on
`task_updated.patch.is_backgrounded`.
- The composer's running-task card
(`selectActiveBackgroundCommandMessages`) and the activity count query
(`listActiveBackgroundTaskCountsByThreadIds`) skip foreground tasks. The
timeline row is unchanged, since the delegation row already hid these
task items.

**Wire and storage**
- Bridge delta shape: `foreground` is optional and the assembler fills
`false`, so third-party bridges keep validating. The provider-bridge
grammar stays v2; the v2 snapshot gains the optional field.
- Stored and domain item: `foreground` is required. Rows stored before
this change read as `false` (`convertLegacyStoredThreadEvent`), and the
count query treats a missing value the same way.
- `HOST_DAEMON_PROTOCOL_VERSION` 239 → 240, plugin SDK 0.6.54.
- The Claude subagent replay lane (`bridge→runtime.current.ndjson`)
gains only `"foreground":true`. That recording is a foreground subagent.

**Not in this PR**, from the issue's expected behavior:
- a composer hint that a steer waits for a running foreground command
and that Stop cancels it;
- a control to move a running foreground command to the background. The
SDK supports this through `Query.backgroundTasks(toolUseId)`, and with
this PR its result would display correctly.

## How you verified

- New tests, each of which fails without its fix:
- provider: a foreground Bash command produces no task items; a
foreground command moved to the background materializes and completes; a
foreground subagent carries `foreground: true` until `task_updated`
moves it.
- thread-view: a foreground agent stays out of
`activeBackgroundCommands` until a progress event clears `foreground`.
- db: a foreground agent is excluded from the counts, and a pre-flag
stored row is still counted.
- domain: pre-flag stored rows read as `foreground: false` for
`item/started` and the background-task progress/completed events.
- Live SDK probe (Claude Agent SDK 0.3.245): a plain foreground `sleep
8; echo done` sends `task_started` with `is_backgrounded: false` and
`task_type: "local_bash"`, then `task_notification`.
- Dev instance (`pnpm start:worktree`) with three Claude Code threads;
the recorded events and `thread list` activity match:
- a foreground 2-minute command records only a `commandExecution` item,
with zero background counts;
- a foreground subagent's task item records `foreground: true`, with
`activeBackgroundAgentCount: 0`;
- a `run_in_background` command records `foreground: false`, with
`activeBackgroundCommandCount: 1`.
- `pnpm exec turbo run typecheck lint --filter='...[origin/main]'`
passes.
- `turbo run test` passes for `@bb/domain`, `@bb/db`,
`@bb/provider-bridge-protocol`, `@bb/thread-view`, `@bb/agent-runtime`,
`@bb/provider-parity`, `@bb/host-daemon-contract`, `@bb/server`,
`@bb/app` and `bb-plugin-provider-claude-code`.

Refs #5641

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Browser Automation: fail close when browser cleanup fails (#5652)

## Human comments

## What was wrong

The Browser Automation `close` RPC reported `state: "closed"` even when
the browser was not released (#5418). The server recorded the session as
closed, ran cleanup through `Promise.allSettled`, logged failures
privately, and returned the ordinary session. The host's `close` deleted
the registry entry first and swallowed `RuntimeSession.close()` errors,
so a failed cleanup returned success, and so did any later close. A
close while `open` was still starting did not cancel the startup, so a
browser could finish launching after its session was closed. E2E testing
also showed that restart cleanup never reached the host: it ran during
plugin registration, where bb refuses host calls (`host plugin calls are
unavailable during factory registration`).

## What changed

This uses the issue's alternative proposal, not the `cleanup` field:
`close` and `stop` reject when cleanup fails. The public session schema
is unchanged.

- `plugins/browser-automation/server.ts`:
- `finish` still retires the session first, so it accepts no more
commands, and aborts an `open` still in progress.
- It then rejects with `Browser session closed, but cleanup on host <id>
failed: <reasons>. Run close to retry.` Failed tab listing during close
now counts as a failure instead of leaving the record pending.
- Concurrent closes share one in-flight outcome, and a `stop` after a
failed close no longer turns the session back into `stopped`.
- Internal callers (run timeout/failure paths, worker exit) don't let a
cleanup error replace their own result.
- Restart cleanup runs as a one-shot `restart-cleanup` background
service, which starts after activation.
- `plugins/browser-automation/host.ts`:
- `close` propagates runtime close errors and shares one in-flight close
between concurrent callers. A close after a failure retries.
- Sessions are registered before the runtime starts, so a close during
startup aborts it and disposes a runtime that starts late anyway.
- The worker remembers closed session IDs (capped at 1024) and refuses a
late `open` for one.
- `plugins/browser-automation/runtime.ts`: a failed `close()` can be
retried instead of returning the cached rejection.
- README and bundled skill document the new failure behavior.

No server/daemon wire change: the host `close` output is still `null`.
These are plugin-internal host RPC semantics, and the server and host
entries ship together.

A session the worker never saw still closes successfully: that worker
holds nothing for it, and a worker's processes and temp directory are
reclaimed when it exits. Reporting that case as failed would leave
sessions failing forever after any worker restart.

## How you verified

- New tests:
- Server: rejected host close and retry, concurrent closes sharing one
failure, a startup that completes after close, restart with pending
cleanup.
- Host: concurrent callers sharing a failure, then retry on the next
close; close during startup disposes the late runtime and refuses
reopen.
  - The two host tests fail against the old `host.ts`.
- `pnpm exec turbo run typecheck test lint
--filter=bb-plugin-browser-automation` passes (87 tests).
`@bb/bundled-plugins` typecheck/test/build passed on the first iteration
of this branch.
- E2E against a fresh source dev instance (`pnpm dev`), with real Chrome
on macOS through the source CLI:
1. **Normal close:** script ran, close exit 0, Chrome gone, profile
directory removed, later `run` refused.
2. **Close during open:** close exit 0, open failed with `Host plugin
call was cancelled`, worker had no children and no profiles afterwards.
3. **Forced cleanup failure** (an immutable file via `chflags uchg` in
the profile): close exit 1 with `EPERM ... unlink`. Chrome was already
gone and the session was retired. A retry while locked failed again;
after unlocking, the retry succeeded and removed the directory.
4. **Two concurrent closes** on the locked profile: both failed with the
same error, and a single close after unlocking succeeded.
5. **Plugin reload with a failed cleanup recorded:** the stored
`cleanupPending` went from 1 to 0 via `restart-cleanup`, and the
factory-registration error was gone.
- E2E found bugs 3 and 5 in an earlier iteration (retry replayed the
cached failure; restart cleanup was refused during registration). Both
are fixed here.

Not covered: the desktop browser backend, the 10-second host timeout (in
code it becomes an ordinary rejection, which is tested), and the app UI
(unchanged).

Fixes #5418

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Scope Markdown reader offsets by panel identity (#5616)

🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

Markdown reader offsets live in one panel instance even though the
panel's tab list changes between threads. A different thread's tabs
prune the previous thread's positions; remounting discards the map,
while equal tab IDs can leak positions across threads.

Reproduction and root-cause report:
https://get-bb.github.io/reports/issues/5615.html

## What changed

Keep the in-session offset maps keyed by the existing panel-state
identity. Preserve per-instance behavior for unscoped panels and keep
closed-tab pruning within the current scope.

Extend the existing real-panel regression harness for disjoint tab
lists, shared tab IDs, remounting, and scoped close/reopen behavior. Two
secondary-panel files change; no new dependency, generated file,
stored-data change, public API, or daemon protocol change.

Changed-line count against trusted `origin/main`: **83 text lines** (69
additions + 14 deletions), **2 files**.

## How you verified

- Before the production fix, the focused suite fails with **3 failed / 6
passed** at trusted main `01affc197dc621cddc7343e09b1c5c10a5b9efcb`. The
same agent repeats those failures in a second clean checkout at that
exact commit.
- After the fix, `pnpm exec turbo run test --filter=@bb/app --
src/components/secondary-panel/ThreadSecondaryPanel.markdown-scroll.test.tsx
src/components/secondary-panel/ThreadSecondaryPanel.collapseControl.test.tsx
src/components/secondary-panel/FilePreview.test.tsx
src/components/secondary-panel/ThreadSecondaryPanelTabContent.markdown-images.test.tsx`
passes **72/72** across four files.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes; lint
reports 250 existing warnings and 0 errors, with none in the changed
panel file.
- Isolated source app in Chromium: real sidebar navigation changes an
open preview from scrollTop **6400 to 0** before the fix; the same
sequence restores **6400** after the fix. The report includes inspected
screenshots.
- `git diff --check` and the secret-model scan pass. No binary changes.

Fixes #5615

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_d4dllspvmvau9537
sha=issue-5615 kind=summary -->

---------

Co-authored-by: SawyerHood <[email protected]>
Co-authored-by: Michael Yong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(db): seek missing timeline parents by item (#5599)

## Human comments

I have a long running "Captain" thread. I noticed after a few days I
started seeing “Loading latest messages…” for a few seconds each time I
switched to it, and BB feels frozen. I had Opus ask Muse Wonder, Astra,
Gemini 4, and Fable , and Grok for the best solution and they all seemed
to agree it was this and that it would be a general improvement for bb
not just a fix for my workflow.

## What was wrong

For two or more missing parent IDs, SQLite can choose
`events_thread_sequence_idx (thread_id=?)` to satisfy `ORDER BY
sequence` in `listStoredDelegatingItemRowsByItemIds`. It then scans a
long thread's events to resolve a few IDs, including IDs whose parents
are not delegating items. This is a general timeline-path performance
bug, not a Captain- or Crew-specific behavior. See #5598 for the
standalone repro, observed symptoms, and distinctions from other
timeline stalls.

## What changed

- The lookup explicitly uses the existing
`events_delegating_item_lookup_idx`, constraining both `thread_id` and
`item_id` for multi-ID requests. It keeps the same filters and sequence
ordering.
- Its selection uses the existing SQL row projection required by Drizzle
when `FROM` is a raw indexed table expression. One migrated-DB test
checks the emitted plan and exact mixed-kind returned rows with the
timeline's numeric output cap.
- No schema, migration, caller, wire/protocol, CLI, guide, or UI
behavior changes. `INDEXED BY` intentionally couples this query to the
already-migrated partial index; a missing or unusable index fails
statement preparation. A workload with substantially more matching IDs
might still favor a scan; the 28-hit synthetic case below did not show
that crossover.

## How you verified

- Red-first: with the test added but the original query, row equality
passed and the plan assertion failed on `SEARCH events USING INDEX
events_thread_sequence_idx (thread_id=?)`. Green: the patched capped
query returns the same full rows and uses
`events_delegating_item_lookup_idx (thread_id=? AND item_id=?)`.
- After rebasing onto `4363ba27d6f942d6b42ae61c8f85800e756b9085`: `pnpm
exec turbo run typecheck test --filter=@bb/db` (53 files, 625 tests);
`pnpm exec turbo run typecheck --filter=@bb/server`; `pnpm exec turbo
run test --filter=@bb/server --
test/services/threads/timeline-parented-pagination.test.ts
test/services/threads/timeline-in-turn-window.test.ts` (36 tests). All
passed. Before the rebase, all 15 server `timeline*.test.ts` files
passed (145 tests).
- On an isolated exe.dev Ubuntu VM using the installed-app tag
`desktop-v0.46.0` (`4c87fdec7`) plus this exact patch: frozen pnpm
install, the focused capped query-plan/row test, the full `@bb/db`
typecheck and test suite, `@bb/server` typecheck, and the 36
parented-timeline tests passed. `pnpm start --dryrun
--no-in-app-updates` built all 51 production tasks without starting a
server or creating a database.
- A one-off, in-memory 177,000-event comparison of the emitted query
with and without the hint returned identical rows in identical order.
For 28 missing IDs, median lookup time was 44.8 ms without the hint
versus 0.012 ms with it; for 28 matching IDs (56 returned rows), 44.0 ms
versus 0.081 ms. These warm synthetic timings are not a measurement of
Captain or a cold production database.
- `git diff --check` passed. The installed bb app and production DB were
not changed; Captain's end-to-end timeline timing needs observation
after a release, and other timeline costs may remain.

Fixes #5598

> AGENT GENERATED
Claude Opus 5.5

* Skip first-run setup in pnpm desktop:worktree (#5653)

## Human comments

## What was wrong

`pnpm start:worktree` defaults `BB_SKIP_ONBOARDING` to `1` in
`toDevLaunchProcessEnv`, but `pnpm desktop:worktree` builds its
environment in `toDesktopLaunchProcessEnv` and never set it. The
packaged app forwards its environment to the server it spawns, so a
fresh worktree desktop instance showed the first-run setup screen.

## What changed

- `packages/scripts/src/commands/run-desktop.ts`: worktree mode defaults
`BB_SKIP_ONBOARDING` to `1`; an explicit `BB_SKIP_ONBOARDING=0` still
retains setup. Plain `pnpm desktop` is unchanged.
- `docs/configuration.md` and `docs/debugging-and-qa.md` list
`desktop:worktree` alongside `dev` and `start:worktree`.

## How you verified

- `packages/scripts/test/run-desktop.test.ts` asserts the worktree
default, that an explicit `0` survives, and that prod mode leaves it
unset.
- `pnpm exec turbo run test typecheck lint --filter=@bb/scripts` passes.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(db): seek background-task and request-outcome events by index (#5655)

## Human comments

## What was wrong

Follow-up to #5598 / #5599. A query-plan sweep of every SELECT run by
the `@bb/db` and `@bb/server` suites found four more `events` lookups
that SQLite answers by walking a thread's whole history through a
`thread_id`-only index seek, even though a selective index already
exists. Production databases have no `sqlite_stat1`, so these test-suite
plans are the production plans. Two of the lookups run on every timeline
build that shows background tasks or delegations.

- `listLatestBackgroundTaskStateRowsByItemIds` filters `item_id IN
(...)` with no kind predicate, so neither the background-task partial
index nor the delegating-item partial index qualifies.
- The completed-task probes in
`listLatestOpenBackgroundTaskStateRowsForThread` and both
`listOpenBackgroundTaskItemRows*` queries have no kind predicate either.
The thread variant's candidate scan also chose the thread-sequence index
over the background-task partial index.
- `hasTerminalClientTurnRequestEvent` ORs two type branches. SQLite does
not split the OR into index seeks, so it walks the thread.

## What changed

- `packages/db/src/data/events.ts`
- `listLatestBackgroundTaskStateRowsByItemIds`: the latest-state
subquery is now a `UNION ALL` of a background-task arm, pinned to
`events_background_task_thread_type_item_sequence_idx`, and a delegation
arm, pinned to `events_delegating_item_lookup_idx`. Each arm uses a
literal kind predicate.
- The completed/settled probes add a literal `item_kind =
'backgroundTask'`. `listOpenBackgroundTaskItemRowsForThread` pins
`events_background_task_thread_type_item_sequence_idx` for its candidate
rows.
- New `hasStoredTerminalClientTurnRequestEvent`, which filters `type IN
('turn/input/accepted', 'client/turn/rejected')` before the OR. It moves
from `apps/server/src/services/threads/thread-lifecycle.ts`, which now
calls it, so it can have a plan regression next to its siblings.
- Returned rows do not change. Every event of these four state types
carries the matching `item_kind`: the domain schemas pin it, and all
24,056 such rows in a long-lived production database agree. The `latest`
MAX subquery in the open-task listings is deliberately left without a
kind filter, because adding one would change results if a tool call and
a background task ever shared an item ID.
- No schema, migration, wire or protocol, CLI, or UI changes.

## How you verified

- New `packages/db/test/query-plans.test.ts` cases for the
background/delegation state lookup, both open-task listings, and the
terminal-request check. The existing open background-task test also
gains a no-thread-only-seek assertion. Against the previous query
shapes, all four fail on plan assertions while their returned-row
assertions pass; with the change they pass.
- `pnpm exec turbo run typecheck lint test --filter=@bb/db
--filter=@bb/server`: 628 db tests and 3,549 server tests passed. Re-ran
db typecheck/lint/test and server typecheck/lint after rebasing onto
`c00ff8bed2`.
- Replayed each emitted statement read-only against a real 143k-event
thread:

| Query | Before | After |
| --- | --- | --- |
| Latest background-task/delegation state by item (timeline) | 94 ms
cold / 4–9 ms warm | <0.1 ms |
| Completed-task IDs for open background tasks (timeline) | 8 ms | <0.1
ms |
| Open background tasks for a thread (thread stop) | 71 ms | <0.1 ms |
| Settled probe per open task, host listing (daemon reconnect) | ~7 ms
each | <0.1 ms |
| Terminal client turn request check (command failure) | 72–78 ms | 4 ms
|

- Manual: `pnpm start:worktree` with a seeded 150k-event thread
containing a running and a finished background task and a delegation in
its latest turn. The timeline returns 200 and shows the latest states.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* feat(app): open the address bar URL in a new browser tab with Cmd+Enter / Alt+Enter (#5657)

## Human comments

## What was wrong

The in-app browser's address bar could only load a typed URL into the
current tab. There was no keyboard way to open it in a new browser tab,
the way Safari/Chrome (Cmd+Enter on Mac) and Chrome/Edge/Firefox
(Alt+Enter on Windows/Linux) do.

## What changed

- `BrowserTabContent` handles modified Enter in the address bar:
Cmd+Enter on Mac, Alt+Enter on Windows/Linux. It resolves the typed
input, restores the current tab's address, blurs the field, and opens
the URL in a new browser tab through a new `onOpenInNewTab` prop instead
of navigating the current tab.
- Ctrl+Enter is deliberately not used off-Mac: browsers there use it for
`www.`/`.com` completion, so it would contradict muscle memory.
- `BrowserTabDeck` threads `onOpenInNewTab` from its hosts
(`ThreadDetailView`, `RootComposeView`, `PluginPanelRightPanelHost`). No
wire, CLI, or protocol changes.

## How you verified

- New platform test table in `BrowserTabContent.chrome.test.tsx`:
Cmd+Enter on Mac opens a tab, Ctrl+Enter on Mac does not, Alt+Enter on
Windows and Linux opens a tab, Ctrl+Enter on Windows does not.
`BrowserTabDeck.browser-view-ordering.test.tsx` covers the deck wiring.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes (0
errors); `BrowserTabContent`/`BrowserTabDeck` vitest suites pass
(49/49).
- Manually launched with `pnpm desktop:worktree` on macOS for testing.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fix skill details for symlinked skill directories (#5556)

## Human comments

## What was wrong

Imported skills discovered through a symlinked directory retain their
logical path. The Skills detail page and CLI then use that directory as
the root for `host.read_file_relative` and `host.list_files`, whose
host-side validation rejects symlink roots. A listed, readable Pi skill
therefore shows `Failed to load SKILL.md.`; both `bb skill show` and `bb
skill files` return HTTP 502. This remains reproducible with the file
handler from upstream `main` at
`05771e3c82404328854468f0fff7f0f8203e2076`. The reproduction and
investigation are in #5555. Merged #5519 fixes discovery, while this
change fixes the subsequent detail reads.

## What changed

- Add a required `followRootSymlink` boolean to the two host file RPCs.
The server opts in for skill content and file-list reads; other callers
explicitly pass `false`.
- When opted in, the host resolves the root before using the existing
directory and relative-file validation. Relative reads stay confined to
the resolved skill directory, dotfiles remain denied, and file listings
continue to skip nested symlinks. Linked skills remain non-manageable.
- Increment `HOST_DAEMON_PROTOCOL_VERSION` from **240 to 241** for the
required wire fields, update existing callers and contract fixtures, and
document the policy in `docs/debugging-and-qa.md`.
- A followed root that no longer exists (removed target or dangling
link) returns the usual missing-file `ENOENT` error instead of a raw
filesystem error.
- The existing SDK and CLI skill operations use the same server paths;
there are no new user-facing flags or configuration.

## How you verified

- Reproduced the installed BB 0.46.0 failure using both `bb skill show`
and `bb skill files` against a real Pi directory link. The target
`SKILL.md` exists and resolves successfully.
- Added an owner-boundary regression covering listing a linked
directory, reading `SKILL.md` and a nested reference, hiding dotfiles,
rejecting `..`, and rejecting a nested link escaping the resolved root.
With `host-files.ts` taken from latest upstream `main`, it fails with
`Path "…/research" must not be a symlink`; it passes with this fix.
- Extended the server skill-detail test to check that both RPCs receive
the explicit opt-in. Existing generic file-root rejection tests continue
to pass with `false`.
- After rebasing onto the checked upstream `main`, all **168 focused
tests passed**:
  ```sh
pnpm exec turbo run test --filter=@bb/host-daemon --
test/command/workspace-dispatch.test.ts
src/command-handlers/host-files.test.ts
src/command-handlers/list-skills.test.ts
pnpm exec turbo run test --filter=@bb/server --
test/public/public-project-skills.test.ts
test/files/host-file-routes.test.ts
test/internal/internal-environment-change.test.ts
pnpm exec turbo run test --filter=@bb/host-daemon-contract --
test/contract.test.ts
pnpm exec turbo run lint typecheck --filter=@bb/host-daemon
--filter=@bb/server --filter=@bb/host-daemon-contract
  ```
- Formatting and `git diff --check` passed. Source verification used
Node 22.19.0 and pnpm 9.15.0 on macOS arm64. The installed desktop app
was not replaced; post-fix browser/desktop UI verification has not been
run.

- Commandeered by a maintainer: merged current `main` (protocol 240 →
241) and added the missing-root handling above, with a dangling-link
case in the regression test. Re-ran the focused host-daemon, server (8
files touching these RPCs), and contract suites plus lint/typecheck; all
pass.

Fixes #5555

> AGENT GENERATED

---------

Co-authored-by: Michael Yong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* Keep background work settlements across message edits (#5656)

## Human comments

## What was wrong

Editing a sent message deletes every event from the edited request
onward (`deleteThreadEventSuffixInTransaction`). When a background task
started before that request and settled after it, the deletion removed
the settlement but kept the `item/started` event. In #5481, the
background download started at seq 140033, Escape stopped the thread
(which settles open tasks with a completion after the edited request at
140146), the edit passed the background-work guard because the task was
settled, and then the rewrite deleted that completion. The card showed
"Running" indefinitely, and the orphan counted as active background
work, so every later edit returned 409.

## What changed

- `packages/db/src/data/events.ts`: new
`listThreadEventSuffixBackgroundSettlementRows` returns, for each
background task or delegation that started before the cutoff and was not
settled before it, its last settlement inside the deleted suffix.
- `apps/server/src/services/threads/thread-edit-message.ts`: inside the
edit transaction, those settlements are re-appended (thread-scoped,
original item state) after the suffix is deleted. The predicted
replacement request sequence accounts for the carried events.
- Tasks that start and settle entirely inside the deleted suffix are
still removed.
- No wire, CLI, or guide changes. Orphans already stuck in existing
threads are not repaired here; they are settled when the host daemon
restarts.

## How you verified

- New regression test in
`apps/server/test/threads/thread-edit-message.test.ts` (task started
before the edited message, stopped after it, plus a task entirely inside
the suffix). It fails on main and passes with the fix.
- `pnpm exec turbo run lint typecheck --filter=@bb/server
--filter=@bb/db`
- `pnpm exec turbo run test --filter=@bb/server --
test/internal/background-task-reconciliation.test.ts
test/threads/thread-edit-message.test.ts` (66 passed)
- Manual, on a `pnpm start:worktree` instance with a real Claude Code
thread: background `sleep 3600` started (seq 23), second message (seq
33), stopped mid-turn (task settled `stopped` at 47), then `bb thread
edit-message --expected-request-sequence 33`. Result: `system/operation`
48, carried `item/backgroundTask/completed` (stopped) 49, new request
50, new `thread/identity` 51; no running background work remained.

Fixes #5481

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Let clicks on the voice input strip focus the textarea (#5665)

## Human comments

## What was wrong

In the app's `VoiceInputTextarea` (used by the question form's "Type
your own answer…" box and by plugins through
`experimental_VoiceInputTextarea`), the voice-input controls sit in a
full-width, absolutely positioned row over the bottom of the textarea.
That row caught pointer events across its whole width, so clicking
anywhere in the bottom ~32px of the textarea hit the row instead of the
textarea and did not focus it.

## What changed

`apps/app/src/components/promptbox/VoiceInputTextarea.tsx`: the overlay
row is `pointer-events-none` and its direct children are
`pointer-events-auto`, so clicks on empty space in the row reach the
textarea while the mic, cancel, and stop buttons and the waveform still
receive clicks.

## How you verified

- `pnpm exec turbo run lint typecheck --filter=@bb/app` passes.
- `pnpm start:worktree` plus a real Claude Code `AskUserQuestion` thread
in headless Chrome at 1280px with the mic visible. After selecting
"Other…" and blurring, `elementFromPoint` 12px above the textarea's
bottom edge returned the `TEXTAREA`, and a mouse click there focused it.
The element at the mic button's center is still the "Start voice input"
button.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Give the Top list sidebar a leading window-frame lip (#5703)

## Human comments

## What was wrong

Follow-up to #5584 (reported in
https://github.com/get-bb/bb/pull/5584#issuecomment-6236573317: "when
top list enabled, right and left edges are not equal"). In the framed
macOS desktop window, the window frame left an 8px lip on the right and
bottom of the card. With the Rail placement, the rail fills the left
side. With the list placement (Top list) there is no rail, and the frame
had no leading lip, so the sidebar card (and the content card when the
sidebar is collapsed) sat flush against the window's left edge. The
collapsed title-bar reserve also assumed a rail was present, so the page
title overlapped the sidebar toggle in Top list.

## What changed

- `apps/app/src/components/ui/sidebar.tsx`, `apps/app/src/app.css`: with
the list placement, the frame gains a leading lip
(`--bb-window-frame-leading-lip`), s…
v-lebedev added a commit to vrata-tg/vrata-bb that referenced this pull request Oct 25, 2026
* Add @phyjswang to allow list

* Start-align tables inside nested timeline groups (#5632)

## Human comments

## What was wrong

Markdown tables wider than the text column break out symmetrically,
centered on the column, up to the room available on the narrower side of
the nearest clipping ancestor. Inside a nested timeline group
(child-thread reports, delegations, turn details) the text column is
indented behind the group's left rail, so a wide table extended left
past the rail and the rail drew straight through the table's cells.

## What changed

- `NESTED_TIMELINE_GROUP_LINE_CLASS_NAME` now sets
`--md-table-start-offset: 0px` (`markdown-table-breakout.ts`). Tables
inside a nested group start at the text column and break out to the
right only.
- `MarkdownTable` derives its start margin from that variable, falling
back to the existing centered margins, and start-aligns the scroll
wrapper the same way. Top-level tables are unchanged.
- The breakout limit measurement gives start-aligned tables the room to
the clip's right edge minus 1rem, the same gutter the centered `100cqw -
2rem` cap leaves.
- New Ladle row "child-completed — wide table" in
`GeneratedConversationMessage.stories.tsx`.

No wire, CLI, or plugin API changes.

## How you verified

- New case in `markdown-preview.test.tsx`: a start-aligned table gets
the full right-hand room (`calc(1100px - 1rem)`); the centered
calculation yields `500px` for the same geometry, so the case fails
without the change.
- `pnpm exec turbo run typecheck lint test --filter='...[origin/main]'`:
14/14 tasks pass.
- `pnpm start:worktree` with a parent thread and a child whose
completion report contains a 3-column wide table: the parent's top-level
tables still span x 336–1424, centered on the column; the nested
report's table spans 544–1424, starting at the report's text column
clear of the rail and sharing the same right edge.
- Ladle: the markdown-preview breakout story is still centered on the
column.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Quote rendered math as raw TeX in selection copy and Add to chat (#5619)

KaTeX renders each formula twice, a visually hidden MathML copy and the visible HTML, so serializing a selection produced output like "E=mc2E = mc^2E=mc2". Selections now expand to whole formulas and serialize each as the TeX from its annotation: $$tex$$ inline, a $$ block for display math.

Markdown file previews use the same serializer for Add to chat and for copy (Cmd+C/Ctrl+C). The HTML clipboard flavor replaces each formula with its MathML, without the TeX annotation, so rich paste shows it once.

Co-authored-by: Junsen Wang <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Skip first-run setup by default for source development (#5633)

## Human comments

## What was wrong

Fresh source development instances showed first-run setup every time a
new checkout received its own database, interrupting development and
verification.

## What changed

Default `BB_SKIP_ONBOARDING` to `1` for `pnpm dev` and `pnpm
start:worktree`, while preserving explicit environment overrides such as
`BB_SKIP_ONBOARDING=0`. Server startup records onboarding completion
only when the flag is enabled and completion is missing. Normal server
launches default the flag to false, and Settings can still replay setup.
Documented the flag and source-launch behavior. No server/daemon wire
changes.

## How you verified

- `pnpm exec turbo run test --filter=@bb/scripts --
test/run-dev.test.ts`: all 21 tests pass. Both override regression cases
failed before the fix and passed afterward.
- `pnpm exec turbo run lint typecheck --filter=@bb/scripts`: package
typecheck passes (no package lint task).
- `git diff --check`: passes.

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Make the sidebar navigation a provider slot with rail and list placements (#5584)

## Human comments

## What was wrong

#5229 (0.46.0) made the icon rail the only sidebar navigation and
removed the plugin API that let a plugin draw it
(`experimental_sidebarNavigation`, `experimental_sidebarHeader`, and
their hooks).
- Users who preferred labeled rows had no way back (#5360).
- Navigation plugins on the marketplace stopped loading: Nav Rail,
Compact Nav, Collapsible Navigation, Slim Nav, Sidebar Subtitles, and
Herdr commands (#5376).
- Panel counts had nowhere to show, because the rail is icon-only and no
longer mounted `experimental_sidebarAccessory` (#5327). 30 bb-community
plugins draw one.

The old slot only covered rows above the thread list, so the rail and
the slot could not coexist.

## What changed

**One navigation slot with a declared placement.**
- `app.slots.experimental_sidebarNavigation` is restored under its
pre-0.46 names. Registrations declare `placement: "rail" | "list"`;
`list` is the default, so older plugins keep working.
- bb lays out the sidebar from the placement before the provider
renders:
- **rail:** a fixed column that stays when the sidebar collapses, New
thread in the header and Settings at the bottom of the column.
- **list:** rows above the thread list, the footer in the same column
after the thread list with a Settings action, Back to app rows on the
Settings, Plugins, and Skills lists, a collapse that hides the whole
sidebar, and the header slot.
- Both placements use the same macOS window frame on wide viewports.
Switching navigation keeps the title-bar controls in place and Settings
Search at the same height; sidebar headers do not reserve an empty
window-control gutter below the title bar. Providers without header
controls use only an 8-pixel top inset instead of reserving an empty
48-pixel header row. Compact windows retain the floating toggle.
- bb's Top list keeps the 0.45 row affordances: a hover "…" options
button (always shown on touch devices) with the same menu as
right-click, the split pane map beside a row's label when its page is
open in a split, and More only when a destination is hidden.
- bb's Top list pins New thread and More and scrolls the destinations
between them, capped near 70% of the window with fades at the scroll
edges, so many plugin panels or a short window can't push the thread
list out of view (the pre-0.46 rows could). The shared region stays
uncapped so plugin providers manage their own height.
- bb's own **Rail** (`navigation/rail`, the default) and **Top list**
(`navigation/top-list`) are the bundled Navigation plugin (see below),
so they use exactly the contract a third-party provider gets.
- The region is a `<nav>` element again, as before #5229, and list
placements keep the footer after the thread list in the same column, as
0.45 did. Plugins that find their column with `closest("nav")` and inset
what follows, such as Nav Rail, therefore dock with the footer beside
the rail.
- Picking a provider (`sidebar/sidebarNavigationProvider.ts`):
- `sidebar.navigationProvider` (Settings → Appearance → Navigation)
selects Automatic or a provider by plugin key.
- Automatic uses the first provider from a plugin the user installed,
else the first built-in one (Rail). A pinned provider that is missing
once plugins settle falls back the same way; with no provider at all the
sidebar uses the list placement and says no navigation plugin is
enabled.
  - Legacy `__builtin__` and `navigation/navigation` read as Automatic.
- Before plugin frontends settle, a plugin provider's last placement is
reserved, so a reload does not flash the rail.
- A crashing provider or header is replaced by the built-in provider for
its placement, with one toast.
- `experimental_Original` renders the built-in provider for the same
placement, or nothing when the Navigation plugin is disabled.

**Rail and Top list are a bundled, forkable plugin**
(`plugins/navigation`).
- The plugin registers both providers, plus Rail's New thread button as
its `headerComponent`, using only `experimental_useSidebarNavigation`,
`experimental_useSidebarNavigationSplit`,
`experimental_SidebarNavigationIcon`, and registry components. It is
default-enabled, on `scripts/forkable-plugins.json`, and served by the
demo server.
- The host keeps only what surrounds a provider: the placement layout
(including the rail's top inset), Settings, the customize editor, the
navigation model, and badge collection. The macOS window frame is
independent of navigation placement, and navigation headers sit below
the title bar on wide macOS windows.
- The shortcut pill, overflow fade, and split-pane mini-map move into
shared-ui and the component registry, so the app, Navigation, and Thread
list share one copy each (Thread list drops its private copies).

**Built-in providers come from the install source.**
- The app records which plugins were installed as built-ins from the
plugin list. Every replacement setting (thread list, navigation, source
code, diffs) labels their providers "(built-in)" and lists them after
installed plugins, and Automatic prefers a provider from an installed
plugin, then slot order. No per-slot constants remain.
- Monaco is a built-in plugin, so it now shows as "(built-in)" in the
Source code and Diffs settings, and Automatic prefers a third-party
renderer over it.
- The bundled Thread list option drops its "BB default." description;
the Automatic row already names what it chooses.
- The Navigation setting hides when no navigation plugin is installed,
like the thread list setting, and settings search uses the matching
condition.

**Shared model** (`SidebarNavigationModel.tsx`,
`lib/plugin-sidebar-navigation.ts`):
- `experimental_useSidebarNavigation()` returns `isHomeActive`, and its
actions include `goHome()`, `setOrder()`, and `openCustomize()`.
`openCustomize()` opens bb's editor in a popover beside any provider,
after open menus close, and returns focus to the control that opened it.
bb's menus and the editor call it "Customize navigation" on every
provider.
- Each panel's `experimental_useBadge` value is in the model as
`item.badge`. The badge sources mount once in the model instead of in
the rail.

**Badges (supersedes #5524).**
- This PR includes #5524's value-based `experimental_useBadge` and its
compatibility handling for `experimental_sidebarAccessory` (the field is
dropped with a warning), plus Tasks' migration to the hook.
- `ExperimentalBadge` is `{ count?, text?, tone?, label }`:
- `text` is a short visible value of at most 8 characters, such as
"NEW", "73%", or "2 down", and cannot be combined with `count`;
- `tone` is `neutral` (the default), `warning`, or `critical`, and bb
owns the colors.
- The fields follow the 30 bb-community plugins that drew
`experimental_sidebarAccessory`: 12 drew one count, 8 several numbers or
a fraction, 5 a short status, 3 a percentage, and 18 used red, amber, or
an accent color for state.
- Drawing:
- Fills are solid theme colors: muted gray for neutral, attention amber
with a new `--attention-foreground` for warning, and destructive red for
critical.
- The rail draws counts (capped at `9+`) and a tone-colored dot for
text, each cut out of the icon by a ring in the rail's own background.
- The Top list and More menu draw the count (capped at `99+`), the text,
or a dot.
- More's dot takes the strongest hidden tone, and the label is in every
accessible name.
- Plugins written before 0.46 that drew counts from the item's old
`experimental_Accessory` field show none until they read `item.badge`.

**Header.** A navigation's optional `headerComponent` renders in the
sidebar header row while it is active, replacing the separate
`experimental_sidebarHeader` slot and its `sidebar.headerProvider`
setting; that slot remains as an untyped runtime alias so a pre-0.46
plugin's header joins its navigation. The thread list setting is now
**Sidebar thread list**.

**Plugin SDK 0.6.53.**
- Restored types and runtime exports.
- `ExperimentalBadgeTone` and the new badge fields.
- Collector validation for `placement`.
- Test-harness support (the `sidebarNavigation` option and
`sidebarNavigationCalls`).
- Tasks now requires `>=0.6.53`. No server/daemon wire change.

**Docs.**
- `docs/configuration.md`, the customization guide, and the
plugin-authoring references (new `frontend-sidebar-navigation.md`, plus
`frontend-core-slots.md` and the API indexes).
- `docs/api_to_audit.md` entries with stabilization items and the core
callers on the same path.
- A Plugin Guide "Sidebar navigation" surface on the rail fixture, and
verify-bb rows for Top list and navigation/header plugins, including
disabling the Navigation plugin.
- The navigation docs, SDK doc comments, and renderer slot docs describe
the bundled Navigation plugin, the `navigation/*` keys, and the
built-in-aware Automatic rule.

## How you verified

- Empty header correction (`8cee6a05da`): the new regression test fails
before the fix; all 24 affected sidebar, header, and Settings tests pass
after it, along with app lint and typecheck. The rendered macOS
simulation confirms an 8-pixel inset above Top list and the retained
48-pixel Settings Search row.
- Desktop spacing fix (`fb133df5d9`): both regression tests fail before
the fix and pass after it. The 62 focused app layout, sidebar
chrome/header, and Settings tests pass; app lint and typecheck pass. An
isolated browser with simulated macOS chrome confirms Rail and Top list
use identical title-bar/toggle coordinates and Settings Search height,
with no extra window-control gutter. Compact windows retain their
floating toggle. This renderer check does not verify native Electron
window behavior.
- Windows CI timeout fix (`ae0adb0fa6`): the two ACP restart tests use
the same 30-second allowance as similar process-restart tests. All 499
ACP tests pass locally (4 skipped), along with lint and typecheck;
Windows confirmation remains with CI.

- Full typecheck, lint, and test run is left to CI on this branch
(rebased onto `399d63d277`). The rail and its Settings cell keep the
spacing from #5529 (compact macOS frame) and #5609 (row-rhythm
alignment), and the app typecheck passes after the rebase. Locally, the
affected app, SDK, Plugin Guide, Tasks, guide, mobile, and server suites
passed before the last rebase; the mobile theme and `global.css` were
regenerated for the new `--attention-foreground` token.
- `check-plugin-sdk-version.mjs` and `check-npm-version-guard.mjs` pass
at 0.6.53.
- Navigation plugin commit (`5a0cc8d599`):
- `scripts/check-plugin-forks.mjs plugins/navigation
plugins/thread-list`: both copies install, typecheck, test, and `bb
plugin build` outside the monorepo with published packages only (Thread
list passed on a re-run after one vitest worker start timeout under
load).
- Turbo typecheck and lint pass for the app, both sidebar plugins,
shared-ui, plugin registry, server, demo server, domain, SDK, Plugin
Guide, and templates. Tests pass for Navigation (14), Thread list,
Plugin Guide, plugin registry, demo server (which now serves both
sidebar plugins), the server's builtin-registry and UI-preference
suites, and 229 app test files across settings, lib, sidebar, code,
layout, and plugin. One app file (`PluginSettings.test.tsx`) failed
under the parallel run and passed alone.
- The app's Rail and Top list integration tests now load the real plugin
through `test/fixtures/navigation-plugin.ts`; the plugin's own drawing
(count caps, text badges, More's tone, menus, the header button) is
tested portably in `plugins/navigation/app.test.tsx`.
- After rebasing onto `399d63d277`: turbo typecheck and lint pass for
every package affected relative to main (155 tasks); Navigation, Thread
list, plugin registry, and 231 app test files pass.
- Ran `pnpm start:worktree` with the bundled plugin and the installed
Nav Rail, Compact Nav, and Collapsible Navigation plugins. I confirmed
the server and plugins come up, but did not repeat the visual pass below
after this commit.
- New and updated tests:
  - provider resolution (`sidebarNavigationProvider.test.ts`);
- plugin providers on the real SDK path: list placement, badges,
`openCustomize`, pinned built-ins, crash fallback, and Original
(`SidebarNavigationHost.test.tsx`);
- Top list rows, text and tone badges, the More dot, and Customize focus
(`SidebarNavigationList.test.tsx`);
- list placements keep the footer after the navigation in one column
(`AppSidebar.test.tsx`);
- the rail on the provider host, including invalid badge values (zero
count, count plus text, text over 8 characters, unknown tone), text
drawn as a toned dot, and More's strongest tone
(`SidebarNavigationRail.test.tsx`);
- the header slot, Back to app routing, and the last-known preference
store;
- SDK harness and placement validation, and the server reading stored
pre-0.46 provider rows.
- Manual checks with `pnpm start:worktree` in headless Chromium at
1440×900 (light and dark) and 390×844, plus the packaged macOS desktop
app (`pnpm desktop:worktree`), with Rail and Top list on the framed and
unframed windows:
- Installed from bb-community, unmodified: **Nav Rail**, **Compact
Nav**, and **Collapsible Navigation**. Each loads and draws its
navigation; Nav Rail docks as a vertical rail with the footer beside it
and moves New thread into the header; Compact Nav and Collapsible
Navigation also work as header providers.
- Installed the deleted `examples/plugins/sidebar-navigation` plugin:
Customize, Original, the crash fallback, pinning Rail over it, a reload
without a rail flash, and removal falling back to Rail.
- A local plugin with four badged panels (critical text, warning count,
warning text, neutral text) renders as intended on the rail and in the
Top list in both themes.
- Not verified: iOS Safari and the native mobile shell; the header
alignment on macOS after the header moved into the plugin. A pinned
plugin key that is not installed shows an empty rail-width column on the
first load until frontends settle, then falls back.

**Follow-up commits on this branch.**
- `fb133df5d9` keeps the macOS window chrome stable when switching
between rail and list placements (`AppLayout.tsx`, `SidebarChrome.tsx`,
with tests and docs).
- `8cee6a05da` removes the empty header row above Top list navigation
(`AppSidebar.tsx`, with a test).
- `ae0adb0fa6` gives the ACP restart tests enough time on Windows
(`provider-bridge-acp-next` test timeouts only).
- CI is green on `8cee6a05da`: 48 checks passed or skipped.

Supersedes #5524.

Fixes #5360
Fixes #5327

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Improve video attachment previews and consolidate file streaming (#5636)

## Human comments

## What was wrong

Video attachments appeared as file pills and lacked image-style
previews. Playback downloaded entire attachments because their endpoint
ignored byte ranges. Video elements created during abandoned React
renders also fetched media, multiplying requests, and completed uploads
discarded access to the selected local video. Attachments and
daemon-hosted files implemented HTTP responses separately.

## What changed

- Add video thumbnails and native playback in the shared attachment
lightbox, preserving playback keyboard controls and image gallery
navigation.
- Assign video sources only after React commits and release them on
unmount. Reuse uploaded local videos for composer previews, including
MOV files without a MIME type.
- Share range, conditional-cache, HEAD, response-header, streaming, and
cancellation handling between attachment and daemon file responses. Keep
separate local and daemon readers and existing route authorization,
cache, and security policies.
- Document the shared delivery path and range verification. Git revision
reads retain their existing whole-file path. No daemon wire fields, CLI
commands, or SDK contracts changed.

## How you verified

- `pnpm exec turbo run test lint typecheck --filter=@bb/app`: 5,934
tests passed, 3 skipped; typecheck and lint passed (existing warnings
only).
- Focused server tests through Turbo: 99 tests passed across shared
streaming, daemon responses, attachment routes, and file routes; server
typecheck and scoped lint passed.
- Regression tests cover abandoned React renders, local video reuse,
mixed galleries, ranges, validators, HEAD, cancellation, read failures,
and local file changes. Local-video regressions failed before the cache
fix and passed afterward.
- Browser checks verified thumbnail/lightbox playback and zero
attachment-content downloads for a newly uploaded local video. Network
investigation confirmed abandoned video elements no longer request
media.
- Rebuilt `pnpm start:worktree`; live local and daemon endpoints
returned matching 1,024-byte 206 responses and bodyless HEAD responses
with the full content length.

> AGENT GENERATED

* Fix timeline bounce during automatic group collapse (#5637)

## Human comments

## What was wrong

Switching back to a thread could show a cached, expanded running-command
group before refreshed completed rows arrived. The disclosure retained
its body during the automatic collapse, briefly rendering the larger
refreshed body before shrinking over 200 ms. This pushed messages up and
then down while the composer stayed fixed.

## What changed

Automatic expansion changes in the shared expandable timeline row now
settle without animating or retaining the closing body. User-triggered
toggles retain their animation. This also applies to expandable system
rows such as provisioning; separate status indicators and other
content-height changes are outside this fix.

## How you verified

- Added a regression that failed before the fix and passes afterward,
covering refreshed automatic collapse and preservation of manual toggle
animation.
- Passed 50 tests across ExpandableTimelineRow, disclosure, and
ThreadTimelineRows.actions using `pnpm exec turbo run test
--filter=@bb/app -- src/components/ui/disclosure.test.tsx
src/components/thread/timeline/ExpandableTimelineRow.test.tsx
src/components/thread/timeline/ThreadTimelineRows.actions.test.tsx`.
- Passed `pnpm exec turbo run lint typecheck --filter=@bb/app` (lint has
existing warnings).
- Reproduced with the real timeline components in an isolated browser
fixture without browser previews: before the fix, a message moved up 52
px then down 72 px; after the fix it moved directly to its final
position, 20 px below the initial position.
- Built and opened `pnpm start:worktree` with three sample threads for
manual switching and disclosure checks.

> AGENT GENERATED

* fix(app): avoid auto-linking ambiguous slash references (#5639)

## Human comments

## What was wrong

The Markdown renderer treated any slash in inline code as evidence of a
file path. Git references such as `origin/main` and `...[origin/main]`
consequently became links to nonexistent files under the thread
workspace.

## What changed

Require an explicit path prefix, a filename extension, or a line
reference before automatically linking inline code. Ambiguous
extensionless relative references such as `scripts/run` remain code;
`./scripts/run`, references with line numbers, and explicit Markdown
links still work. This remains a syntactic heuristic rather than a
file-existence check.

## How you verified

- Extended the existing renderer cases; the four ambiguous-reference
cases failed before the fix and passed afterward.
- `pnpm exec turbo run test lint typecheck --filter=@bb/app`: passed;
5,991 tests passed, four skipped; lint reported 254 warnings and zero
errors.
- Formatted both changed files and ran `git diff --check`.

> AGENT GENERATED

* fix(acp): hide Fast for models that cannot apply it (#5643)

## Human comments

## What was wrong

ACP-native model discovery omitted `supportedServiceTiers`, which caused
the model picker to inherit the ACP provider's Default/Fast list. Agents
such as OMP and Hermes therefore showed a Fast toggle even though the
bridge could not apply it.

## What changed

Both ACP bridges now report explicit model-level service tiers. Existing
model configuration probes advertise Fast only when the model exposes a
selectable `fast` option accepting `true`; unsupported, unprobed, legacy
session-model, and synthetic fallback models report an empty list. CLI
model families retain their existing fast-variant support. Discovery and
runtime selection share the Fast option lookup.

This corrects values under the existing service-tier contract; no wire
shape, CLI, or configuration surface changes.

## How you verified

- Extended bridge regression tests for native discovery, per-model Fast
support, failed probes, legacy model lists, and synthetic fallbacks;
confirmed failure before the fix.
- `pnpm exec turbo run test lint typecheck
--filter=@bb/provider-bridge-acp --filter=@bb/provider-bridge-acp-next`:
passed (893 tests passed, 8 skipped).
- `pnpm exec turbo run test --filter=@bb/domain --
test/service-tier.test.ts`: 6 passed.
- `pnpm start:worktree`: build and startup passed; live OMP and Hermes
model catalogs report explicit empty supported tiers. Cursor live
discovery requires authentication.
- ACP Cursor replay comparison: old/new output matched; the runner
reported 4 passes, 6 failures from stale pre-existing allowlist entries,
and 1 process-scoped model-list skip.

> AGENT GENERATED

* Render single-dollar inline math with Pandoc delimiter rules (#5648)

## Human comments

## What was wrong

#512 fixed #511 (prices like `$5 to $10` rendering as math) by setting
`singleDollarTextMath: false` on remark-math, which turned off
single-dollar math everywhere. Inline `$x$`, the form most Markdown and
model output use, has shown as raw TeX in chat and in Markdown file
previews since then. KaTeX was also lazy-loaded only when content
contained `$$`.

## What changed

Based on the prototype @phyjswang proposed in #5557 (commit authored by
them).

- `apps/app/src/components/ui/markdown-inline-dollar-math.ts`: a
micromark text construct for `$…$` that emits the same `mathText` tokens
as remark-math, so `mdast-util-math` and `rehype-katex` handle it
unchanged. It applies Pandoc's delimiter rules: the opening `$` must
precede non-whitespace, the closing `$` must follow non-whitespace and
must not precede a digit. A backtick or stray `$` inside the span
cancels the match, `\$` inside math is an escape, and `$$x$` does not
start math at its second `$`.
- `markdown-preview.tsx`: registers the construct after remark-math,
which keeps `singleDollarTextMath: false`.
- `markdown-katex-loader.ts`: `markdownMayContainMath` also matches
`$…$`, so KaTeX loads for single-dollar math.
- `micromark-extension-math` added as a direct dependency for its token
type augmentation.
- Story copy updated.

| Input | Result |
|---|---|
| `$E = mc^2$`, `$a⏎b$`, `$\$5$`, `the $n$th term` | math |
| `$5 to $10`, `$20,000 and $30,000`, `$5/$10`, `$5-$10`, `$ x $`, ``
`$x$` `` | literal |
| `It costs $5 and $\alpha$` | `$5` literal, `\alpha` math |

Known trade-off, same as Pandoc: `$HOME/$USER` outside a code span
renders `HOME/` as math.

## How you verified

- Tests in `markdown-preview.test.tsx` cover single-dollar math, prices
next to math, code spans after currency (with `incrementalBlocks` on and
off), and the literal cases above. The old test asserting `$x$` stays
literal is replaced.
- `pnpm exec turbo run typecheck lint test --filter=@bb/app`: typecheck
and lint pass. 6000 tests passed and 3 failed in the full run
(`CommandPalette.cold-open`, `CommandPalette`,
`TimelineRowDetails.output-preview`); all 3 pass when rerun alone
together with the markdown suites, so they were load flakes.
- Manual: `pnpm start:worktree` with an agent reply containing a
math/price checklist. All 8 math items rendered (7 inline plus one
display), with no KaTeX errors, and every price and code span stayed
literal.
- Perf, ~50–80 KB single documents, median of 7 runs: parse time is
within noise for prose, prices, and math. The worst case, 20,000 `$5 `
in one paragraph, goes from 36 ms to 47 ms, and cost stays linear. The
`markdownMayContainMath` check costs at most ~300 µs on 60 KB.

Fixes #5557

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Junsen Wang <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(app): let the folder browser switch between Windows drives (#5647)

## Human comments

## What was wrong

The project folder browser (`RemotePathBrowser`) only listed the
children of the current directory. At a Windows drive root `parent` was
`null`, and nothing listed the host's other drives, so drives such as
Google Drive's G: and H: could only be reached by typing a path into
"Edit path". Investigation report:
https://get-bb.github.io/reports/issues/5358.html

## What changed

- **Daemon (`host.browse_directory`)**: the listing now includes
`roots`, the host's filesystem roots. On Windows this is every
accessible drive A–Z, each checked with a 1 s timeout so a disconnected
network drive can't stall the listing
(`apps/host-daemon/src/command-handlers/filesystem-roots.ts`). On other
platforms it is `["/"]`.
- **Daemon**: the browse handler now resolves symlinks with Node's JS
`fs.realpath` instead of the native one. The native call asks Windows
for the final path, which rewrites subst drives to their target folder
and mapped network drives to UNC paths (which bb rejects). Picking such
a drive from the new menu would otherwise leave the drive. POSIX
resolution is unchanged.
- **App**: when the host has more than one root, the drive breadcrumb
becomes a menu of drives (`C: ⌄`), and picking one opens that drive.
- **Wire change**: `roots` is required in `directoryListingSchema`
(host-daemon contract) and `hostDirectoryListingSchema` (server
contract). `HOST_DAEMON_PROTOCOL_VERSION` 238 → 239.
- **SDK/CLI**: `sdk.hosts.directory` returns `roots` automatically.
There is no CLI browse command, and the browser is not exposed to
plugins.
- Ladle: a "windows drives" row in `dialogs/Project Path`.

## How you verified

- New `filesystem-roots.test.ts`: on POSIX it returns `/` without
checking anything; with a simulated win32 host it lists C:, G: and H:;
drives whose check errors or never answers are left out.
- New win32-only test in `host-files.test.ts` (runs in the Windows
`packages-host` CI shard): it maps a spare drive letter with `subst`,
browses it, and asserts that the browser stays on that drive, `parent`
is `null`, the files are listed, and `roots` includes both the system
drive and the subst drive. This has not run locally (macOS); this PR's
Windows CI run is its first.
- `turbo run typecheck lint` for host-daemon, app, server,
host-daemon-contract, server-contract and sdk: passing.
Host-daemon-contract tests pass; targeted vitest runs of the daemon
browse, app dialog and server thread-storage-orphans tests pass.
- Ladle: opening the drive menu in the Windows story lists `C:\`, `G:\`,
`H:\`.
- Not verified: native Windows with real Google Drive for desktop
mounts.

Fixes #5358

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(app): wrap long Mermaid labels at fractional zoom (#5649)

## Human comments

## What was wrong

Mermaid 11.15.0 wraps an HTML label only when its measured width is
exactly equal to the 200px wrapping width
([createText.ts](https://github.com/mermaid-js/mermaid/blob/41646dfd43ac83f001b03c70605feb036afae46d/packages/mermaid/src/rendering-util/createText.ts#L70-L76)).
At a fractional devicePixelRatio, Chromium measures a clamped label at
about 199.99px instead of 200. The check fails, so long flowchart labels
stay on one line and are cut off. One example is the desktop app at 90%
zoom on a Retina display (devicePixelRatio 1.8). This is the upstream
bug mermaid-js/mermaid#7794, which is still open.

## What changed

- Added `patches/[email protected]`, registered in
`pnpm.patchedDependencies`. It applies the fix from the upstream PR
mermaid-js/mermaid#8233 (open, unreleased): `bbox.width === width`
becomes `bbox.width >= width - 1`.
- The patch changes the three unminified builds (`mermaid.core`, which
the app bundles, plus `mermaid.esm` and `mermaid.js`). It leaves out the
minified builds, which would add about 95 KB of single-line hunks.
- This differs from the fix suggested in the issue, `htmlLabels: false`,
because the patch keeps HTML-only label features such as icons. Delete
the patch once Mermaid releases the upstream fix; pnpm fails the install
on a version bump, so it cannot be left behind silently.

## How you verified

- Reproduced in a hidden Electron 44 window with
`webContents.setZoomFactor`, using the issue's flowchart and
`mermaid/dist/mermaid.js`:
- Stock 11.15.0 at zoom 0.9 (devicePixelRatio 1.8): 0/4 long labels
wrap. Measured width 199.9945px, `white-space: nowrap`.
  - Patched at zoom 0.9: 4/4 wrap.
  - Zooms 0.67, 0.8, 1, 1.1, 1.25 and 1.5 wrap both before and after.
  - The count of short `nowrap` labels is unchanged at every zoom.
- `pnpm exec turbo run build --filter=@bb/app`: the built chunk contains
`g.width>=n-1`.
- `pnpm exec turbo run test --filter=@bb/app -- markdown-mermaid`: 21
passed.
- `pnpm install --frozen-lockfile` passes.

Fixes #5448

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Show foreground Claude Code commands and subagents as foreground work (#5650)

## Human comments

## What was wrong

Claude Code sends a `task_started` message for long-running
**foreground** work as well as background work, and marks which one it
is with `is_backgrounded`. BB ignored that flag (#5641):

- Every `local_bash` task became a `backgroundTask` item. A blocking
foreground Bash command showed a "Background command" card above the
composer and an extra "Running background command" row in the timeline.
The thread looked like it had handed the command off, but a steer waited
until the command finished.
- Foreground subagents (`local_agent` with `is_backgrounded: false`) are
kept as task items on purpose, because the delegation row reads their
progress. Nothing recorded that they were foreground, though. The
composer card said "Running background agent", and the thread activity
counts included them.

## What changed

**Foreground Bash commands**
(`plugins/provider-claude-code/src/task-translation.ts`)
- A `local_bash` task that starts with `is_backgrounded: false` is
tracked but not materialized. It stays a normal running command.
- If a later `task_updated` reports `patch.is_backgrounded: true`, the
bridge opens the `backgroundTask` item then, and the usual completion
closes it.

**Foreground subagents**
- `backgroundTask` items carry a new `foreground` flag. The Claude Code
bridge sets it from `task_started.is_backgrounded` and clears it on
`task_updated.patch.is_backgrounded`.
- The composer's running-task card
(`selectActiveBackgroundCommandMessages`) and the activity count query
(`listActiveBackgroundTaskCountsByThreadIds`) skip foreground tasks. The
timeline row is unchanged, since the delegation row already hid these
task items.

**Wire and storage**
- Bridge delta shape: `foreground` is optional and the assembler fills
`false`, so third-party bridges keep validating. The provider-bridge
grammar stays v2; the v2 snapshot gains the optional field.
- Stored and domain item: `foreground` is required. Rows stored before
this change read as `false` (`convertLegacyStoredThreadEvent`), and the
count query treats a missing value the same way.
- `HOST_DAEMON_PROTOCOL_VERSION` 239 → 240, plugin SDK 0.6.54.
- The Claude subagent replay lane (`bridge→runtime.current.ndjson`)
gains only `"foreground":true`. That recording is a foreground subagent.

**Not in this PR**, from the issue's expected behavior:
- a composer hint that a steer waits for a running foreground command
and that Stop cancels it;
- a control to move a running foreground command to the background. The
SDK supports this through `Query.backgroundTasks(toolUseId)`, and with
this PR its result would display correctly.

## How you verified

- New tests, each of which fails without its fix:
- provider: a foreground Bash command produces no task items; a
foreground command moved to the background materializes and completes; a
foreground subagent carries `foreground: true` until `task_updated`
moves it.
- thread-view: a foreground agent stays out of
`activeBackgroundCommands` until a progress event clears `foreground`.
- db: a foreground agent is excluded from the counts, and a pre-flag
stored row is still counted.
- domain: pre-flag stored rows read as `foreground: false` for
`item/started` and the background-task progress/completed events.
- Live SDK probe (Claude Agent SDK 0.3.245): a plain foreground `sleep
8; echo done` sends `task_started` with `is_backgrounded: false` and
`task_type: "local_bash"`, then `task_notification`.
- Dev instance (`pnpm start:worktree`) with three Claude Code threads;
the recorded events and `thread list` activity match:
- a foreground 2-minute command records only a `commandExecution` item,
with zero background counts;
- a foreground subagent's task item records `foreground: true`, with
`activeBackgroundAgentCount: 0`;
- a `run_in_background` command records `foreground: false`, with
`activeBackgroundCommandCount: 1`.
- `pnpm exec turbo run typecheck lint --filter='...[origin/main]'`
passes.
- `turbo run test` passes for `@bb/domain`, `@bb/db`,
`@bb/provider-bridge-protocol`, `@bb/thread-view`, `@bb/agent-runtime`,
`@bb/provider-parity`, `@bb/host-daemon-contract`, `@bb/server`,
`@bb/app` and `bb-plugin-provider-claude-code`.

Refs #5641

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Browser Automation: fail close when browser cleanup fails (#5652)

## Human comments

## What was wrong

The Browser Automation `close` RPC reported `state: "closed"` even when
the browser was not released (#5418). The server recorded the session as
closed, ran cleanup through `Promise.allSettled`, logged failures
privately, and returned the ordinary session. The host's `close` deleted
the registry entry first and swallowed `RuntimeSession.close()` errors,
so a failed cleanup returned success, and so did any later close. A
close while `open` was still starting did not cancel the startup, so a
browser could finish launching after its session was closed. E2E testing
also showed that restart cleanup never reached the host: it ran during
plugin registration, where bb refuses host calls (`host plugin calls are
unavailable during factory registration`).

## What changed

This uses the issue's alternative proposal, not the `cleanup` field:
`close` and `stop` reject when cleanup fails. The public session schema
is unchanged.

- `plugins/browser-automation/server.ts`:
- `finish` still retires the session first, so it accepts no more
commands, and aborts an `open` still in progress.
- It then rejects with `Browser session closed, but cleanup on host <id>
failed: <reasons>. Run close to retry.` Failed tab listing during close
now counts as a failure instead of leaving the record pending.
- Concurrent closes share one in-flight outcome, and a `stop` after a
failed close no longer turns the session back into `stopped`.
- Internal callers (run timeout/failure paths, worker exit) don't let a
cleanup error replace their own result.
- Restart cleanup runs as a one-shot `restart-cleanup` background
service, which starts after activation.
- `plugins/browser-automation/host.ts`:
- `close` propagates runtime close errors and shares one in-flight close
between concurrent callers. A close after a failure retries.
- Sessions are registered before the runtime starts, so a close during
startup aborts it and disposes a runtime that starts late anyway.
- The worker remembers closed session IDs (capped at 1024) and refuses a
late `open` for one.
- `plugins/browser-automation/runtime.ts`: a failed `close()` can be
retried instead of returning the cached rejection.
- README and bundled skill document the new failure behavior.

No server/daemon wire change: the host `close` output is still `null`.
These are plugin-internal host RPC semantics, and the server and host
entries ship together.

A session the worker never saw still closes successfully: that worker
holds nothing for it, and a worker's processes and temp directory are
reclaimed when it exits. Reporting that case as failed would leave
sessions failing forever after any worker restart.

## How you verified

- New tests:
- Server: rejected host close and retry, concurrent closes sharing one
failure, a startup that completes after close, restart with pending
cleanup.
- Host: concurrent callers sharing a failure, then retry on the next
close; close during startup disposes the late runtime and refuses
reopen.
  - The two host tests fail against the old `host.ts`.
- `pnpm exec turbo run typecheck test lint
--filter=bb-plugin-browser-automation` passes (87 tests).
`@bb/bundled-plugins` typecheck/test/build passed on the first iteration
of this branch.
- E2E against a fresh source dev instance (`pnpm dev`), with real Chrome
on macOS through the source CLI:
1. **Normal close:** script ran, close exit 0, Chrome gone, profile
directory removed, later `run` refused.
2. **Close during open:** close exit 0, open failed with `Host plugin
call was cancelled`, worker had no children and no profiles afterwards.
3. **Forced cleanup failure** (an immutable file via `chflags uchg` in
the profile): close exit 1 with `EPERM ... unlink`. Chrome was already
gone and the session was retired. A retry while locked failed again;
after unlocking, the retry succeeded and removed the directory.
4. **Two concurrent closes** on the locked profile: both failed with the
same error, and a single close after unlocking succeeded.
5. **Plugin reload with a failed cleanup recorded:** the stored
`cleanupPending` went from 1 to 0 via `restart-cleanup`, and the
factory-registration error was gone.
- E2E found bugs 3 and 5 in an earlier iteration (retry replayed the
cached failure; restart cleanup was refused during registration). Both
are fixed here.

Not covered: the desktop browser backend, the 10-second host timeout (in
code it becomes an ordinary rejection, which is tested), and the app UI
(unchanged).

Fixes #5418

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Scope Markdown reader offsets by panel identity (#5616)

🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

Markdown reader offsets live in one panel instance even though the
panel's tab list changes between threads. A different thread's tabs
prune the previous thread's positions; remounting discards the map,
while equal tab IDs can leak positions across threads.

Reproduction and root-cause report:
https://get-bb.github.io/reports/issues/5615.html

## What changed

Keep the in-session offset maps keyed by the existing panel-state
identity. Preserve per-instance behavior for unscoped panels and keep
closed-tab pruning within the current scope.

Extend the existing real-panel regression harness for disjoint tab
lists, shared tab IDs, remounting, and scoped close/reopen behavior. Two
secondary-panel files change; no new dependency, generated file,
stored-data change, public API, or daemon protocol change.

Changed-line count against trusted `origin/main`: **83 text lines** (69
additions + 14 deletions), **2 files**.

## How you verified

- Before the production fix, the focused suite fails with **3 failed / 6
passed** at trusted main `01affc197dc621cddc7343e09b1c5c10a5b9efcb`. The
same agent repeats those failures in a second clean checkout at that
exact commit.
- After the fix, `pnpm exec turbo run test --filter=@bb/app --
src/components/secondary-panel/ThreadSecondaryPanel.markdown-scroll.test.tsx
src/components/secondary-panel/ThreadSecondaryPanel.collapseControl.test.tsx
src/components/secondary-panel/FilePreview.test.tsx
src/components/secondary-panel/ThreadSecondaryPanelTabContent.markdown-images.test.tsx`
passes **72/72** across four files.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes; lint
reports 250 existing warnings and 0 errors, with none in the changed
panel file.
- Isolated source app in Chromium: real sidebar navigation changes an
open preview from scrollTop **6400 to 0** before the fix; the same
sequence restores **6400** after the fix. The report includes inspected
screenshots.
- `git diff --check` and the secret-model scan pass. No binary changes.

Fixes #5615

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_d4dllspvmvau9537
sha=issue-5615 kind=summary -->

---------

Co-authored-by: SawyerHood <[email protected]>
Co-authored-by: Michael Yong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(db): seek missing timeline parents by item (#5599)

## Human comments

I have a long running "Captain" thread. I noticed after a few days I
started seeing “Loading latest messages…” for a few seconds each time I
switched to it, and BB feels frozen. I had Opus ask Muse Wonder, Astra,
Gemini 4, and Fable , and Grok for the best solution and they all seemed
to agree it was this and that it would be a general improvement for bb
not just a fix for my workflow.

## What was wrong

For two or more missing parent IDs, SQLite can choose
`events_thread_sequence_idx (thread_id=?)` to satisfy `ORDER BY
sequence` in `listStoredDelegatingItemRowsByItemIds`. It then scans a
long thread's events to resolve a few IDs, including IDs whose parents
are not delegating items. This is a general timeline-path performance
bug, not a Captain- or Crew-specific behavior. See #5598 for the
standalone repro, observed symptoms, and distinctions from other
timeline stalls.

## What changed

- The lookup explicitly uses the existing
`events_delegating_item_lookup_idx`, constraining both `thread_id` and
`item_id` for multi-ID requests. It keeps the same filters and sequence
ordering.
- Its selection uses the existing SQL row projection required by Drizzle
when `FROM` is a raw indexed table expression. One migrated-DB test
checks the emitted plan and exact mixed-kind returned rows with the
timeline's numeric output cap.
- No schema, migration, caller, wire/protocol, CLI, guide, or UI
behavior changes. `INDEXED BY` intentionally couples this query to the
already-migrated partial index; a missing or unusable index fails
statement preparation. A workload with substantially more matching IDs
might still favor a scan; the 28-hit synthetic case below did not show
that crossover.

## How you verified

- Red-first: with the test added but the original query, row equality
passed and the plan assertion failed on `SEARCH events USING INDEX
events_thread_sequence_idx (thread_id=?)`. Green: the patched capped
query returns the same full rows and uses
`events_delegating_item_lookup_idx (thread_id=? AND item_id=?)`.
- After rebasing onto `4363ba27d6f942d6b42ae61c8f85800e756b9085`: `pnpm
exec turbo run typecheck test --filter=@bb/db` (53 files, 625 tests);
`pnpm exec turbo run typecheck --filter=@bb/server`; `pnpm exec turbo
run test --filter=@bb/server --
test/services/threads/timeline-parented-pagination.test.ts
test/services/threads/timeline-in-turn-window.test.ts` (36 tests). All
passed. Before the rebase, all 15 server `timeline*.test.ts` files
passed (145 tests).
- On an isolated exe.dev Ubuntu VM using the installed-app tag
`desktop-v0.46.0` (`4c87fdec7`) plus this exact patch: frozen pnpm
install, the focused capped query-plan/row test, the full `@bb/db`
typecheck and test suite, `@bb/server` typecheck, and the 36
parented-timeline tests passed. `pnpm start --dryrun
--no-in-app-updates` built all 51 production tasks without starting a
server or creating a database.
- A one-off, in-memory 177,000-event comparison of the emitted query
with and without the hint returned identical rows in identical order.
For 28 missing IDs, median lookup time was 44.8 ms without the hint
versus 0.012 ms with it; for 28 matching IDs (56 returned rows), 44.0 ms
versus 0.081 ms. These warm synthetic timings are not a measurement of
Captain or a cold production database.
- `git diff --check` passed. The installed bb app and production DB were
not changed; Captain's end-to-end timeline timing needs observation
after a release, and other timeline costs may remain.

Fixes #5598

> AGENT GENERATED
Claude Opus 5.5

* Skip first-run setup in pnpm desktop:worktree (#5653)

## Human comments

## What was wrong

`pnpm start:worktree` defaults `BB_SKIP_ONBOARDING` to `1` in
`toDevLaunchProcessEnv`, but `pnpm desktop:worktree` builds its
environment in `toDesktopLaunchProcessEnv` and never set it. The
packaged app forwards its environment to the server it spawns, so a
fresh worktree desktop instance showed the first-run setup screen.

## What changed

- `packages/scripts/src/commands/run-desktop.ts`: worktree mode defaults
`BB_SKIP_ONBOARDING` to `1`; an explicit `BB_SKIP_ONBOARDING=0` still
retains setup. Plain `pnpm desktop` is unchanged.
- `docs/configuration.md` and `docs/debugging-and-qa.md` list
`desktop:worktree` alongside `dev` and `start:worktree`.

## How you verified

- `packages/scripts/test/run-desktop.test.ts` asserts the worktree
default, that an explicit `0` survives, and that prod mode leaves it
unset.
- `pnpm exec turbo run test typecheck lint --filter=@bb/scripts` passes.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(db): seek background-task and request-outcome events by index (#5655)

## Human comments

## What was wrong

Follow-up to #5598 / #5599. A query-plan sweep of every SELECT run by
the `@bb/db` and `@bb/server` suites found four more `events` lookups
that SQLite answers by walking a thread's whole history through a
`thread_id`-only index seek, even though a selective index already
exists. Production databases have no `sqlite_stat1`, so these test-suite
plans are the production plans. Two of the lookups run on every timeline
build that shows background tasks or delegations.

- `listLatestBackgroundTaskStateRowsByItemIds` filters `item_id IN
(...)` with no kind predicate, so neither the background-task partial
index nor the delegating-item partial index qualifies.
- The completed-task probes in
`listLatestOpenBackgroundTaskStateRowsForThread` and both
`listOpenBackgroundTaskItemRows*` queries have no kind predicate either.
The thread variant's candidate scan also chose the thread-sequence index
over the background-task partial index.
- `hasTerminalClientTurnRequestEvent` ORs two type branches. SQLite does
not split the OR into index seeks, so it walks the thread.

## What changed

- `packages/db/src/data/events.ts`
- `listLatestBackgroundTaskStateRowsByItemIds`: the latest-state
subquery is now a `UNION ALL` of a background-task arm, pinned to
`events_background_task_thread_type_item_sequence_idx`, and a delegation
arm, pinned to `events_delegating_item_lookup_idx`. Each arm uses a
literal kind predicate.
- The completed/settled probes add a literal `item_kind =
'backgroundTask'`. `listOpenBackgroundTaskItemRowsForThread` pins
`events_background_task_thread_type_item_sequence_idx` for its candidate
rows.
- New `hasStoredTerminalClientTurnRequestEvent`, which filters `type IN
('turn/input/accepted', 'client/turn/rejected')` before the OR. It moves
from `apps/server/src/services/threads/thread-lifecycle.ts`, which now
calls it, so it can have a plan regression next to its siblings.
- Returned rows do not change. Every event of these four state types
carries the matching `item_kind`: the domain schemas pin it, and all
24,056 such rows in a long-lived production database agree. The `latest`
MAX subquery in the open-task listings is deliberately left without a
kind filter, because adding one would change results if a tool call and
a background task ever shared an item ID.
- No schema, migration, wire or protocol, CLI, or UI changes.

## How you verified

- New `packages/db/test/query-plans.test.ts` cases for the
background/delegation state lookup, both open-task listings, and the
terminal-request check. The existing open background-task test also
gains a no-thread-only-seek assertion. Against the previous query
shapes, all four fail on plan assertions while their returned-row
assertions pass; with the change they pass.
- `pnpm exec turbo run typecheck lint test --filter=@bb/db
--filter=@bb/server`: 628 db tests and 3,549 server tests passed. Re-ran
db typecheck/lint/test and server typecheck/lint after rebasing onto
`c00ff8bed2`.
- Replayed each emitted statement read-only against a real 143k-event
thread:

| Query | Before | After |
| --- | --- | --- |
| Latest background-task/delegation state by item (timeline) | 94 ms
cold / 4–9 ms warm | <0.1 ms |
| Completed-task IDs for open background tasks (timeline) | 8 ms | <0.1
ms |
| Open background tasks for a thread (thread stop) | 71 ms | <0.1 ms |
| Settled probe per open task, host listing (daemon reconnect) | ~7 ms
each | <0.1 ms |
| Terminal client turn request check (command failure) | 72–78 ms | 4 ms
|

- Manual: `pnpm start:worktree` with a seeded 150k-event thread
containing a running and a finished background task and a delegation in
its latest turn. The timeline returns 200 and shows the latest states.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* feat(app): open the address bar URL in a new browser tab with Cmd+Enter / Alt+Enter (#5657)

## Human comments

## What was wrong

The in-app browser's address bar could only load a typed URL into the
current tab. There was no keyboard way to open it in a new browser tab,
the way Safari/Chrome (Cmd+Enter on Mac) and Chrome/Edge/Firefox
(Alt+Enter on Windows/Linux) do.

## What changed

- `BrowserTabContent` handles modified Enter in the address bar:
Cmd+Enter on Mac, Alt+Enter on Windows/Linux. It resolves the typed
input, restores the current tab's address, blurs the field, and opens
the URL in a new browser tab through a new `onOpenInNewTab` prop instead
of navigating the current tab.
- Ctrl+Enter is deliberately not used off-Mac: browsers there use it for
`www.`/`.com` completion, so it would contradict muscle memory.
- `BrowserTabDeck` threads `onOpenInNewTab` from its hosts
(`ThreadDetailView`, `RootComposeView`, `PluginPanelRightPanelHost`). No
wire, CLI, or protocol changes.

## How you verified

- New platform test table in `BrowserTabContent.chrome.test.tsx`:
Cmd+Enter on Mac opens a tab, Ctrl+Enter on Mac does not, Alt+Enter on
Windows and Linux opens a tab, Ctrl+Enter on Windows does not.
`BrowserTabDeck.browser-view-ordering.test.tsx` covers the deck wiring.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes (0
errors); `BrowserTabContent`/`BrowserTabDeck` vitest suites pass
(49/49).
- Manually launched with `pnpm desktop:worktree` on macOS for testing.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fix skill details for symlinked skill directories (#5556)

## Human comments

## What was wrong

Imported skills discovered through a symlinked directory retain their
logical path. The Skills detail page and CLI then use that directory as
the root for `host.read_file_relative` and `host.list_files`, whose
host-side validation rejects symlink roots. A listed, readable Pi skill
therefore shows `Failed to load SKILL.md.`; both `bb skill show` and `bb
skill files` return HTTP 502. This remains reproducible with the file
handler from upstream `main` at
`05771e3c82404328854468f0fff7f0f8203e2076`. The reproduction and
investigation are in #5555. Merged #5519 fixes discovery, while this
change fixes the subsequent detail reads.

## What changed

- Add a required `followRootSymlink` boolean to the two host file RPCs.
The server opts in for skill content and file-list reads; other callers
explicitly pass `false`.
- When opted in, the host resolves the root before using the existing
directory and relative-file validation. Relative reads stay confined to
the resolved skill directory, dotfiles remain denied, and file listings
continue to skip nested symlinks. Linked skills remain non-manageable.
- Increment `HOST_DAEMON_PROTOCOL_VERSION` from **240 to 241** for the
required wire fields, update existing callers and contract fixtures, and
document the policy in `docs/debugging-and-qa.md`.
- A followed root that no longer exists (removed target or dangling
link) returns the usual missing-file `ENOENT` error instead of a raw
filesystem error.
- The existing SDK and CLI skill operations use the same server paths;
there are no new user-facing flags or configuration.

## How you verified

- Reproduced the installed BB 0.46.0 failure using both `bb skill show`
and `bb skill files` against a real Pi directory link. The target
`SKILL.md` exists and resolves successfully.
- Added an owner-boundary regression covering listing a linked
directory, reading `SKILL.md` and a nested reference, hiding dotfiles,
rejecting `..`, and rejecting a nested link escaping the resolved root.
With `host-files.ts` taken from latest upstream `main`, it fails with
`Path "…/research" must not be a symlink`; it passes with this fix.
- Extended the server skill-detail test to check that both RPCs receive
the explicit opt-in. Existing generic file-root rejection tests continue
to pass with `false`.
- After rebasing onto the checked upstream `main`, all **168 focused
tests passed**:
  ```sh
pnpm exec turbo run test --filter=@bb/host-daemon --
test/command/workspace-dispatch.test.ts
src/command-handlers/host-files.test.ts
src/command-handlers/list-skills.test.ts
pnpm exec turbo run test --filter=@bb/server --
test/public/public-project-skills.test.ts
test/files/host-file-routes.test.ts
test/internal/internal-environment-change.test.ts
pnpm exec turbo run test --filter=@bb/host-daemon-contract --
test/contract.test.ts
pnpm exec turbo run lint typecheck --filter=@bb/host-daemon
--filter=@bb/server --filter=@bb/host-daemon-contract
  ```
- Formatting and `git diff --check` passed. Source verification used
Node 22.19.0 and pnpm 9.15.0 on macOS arm64. The installed desktop app
was not replaced; post-fix browser/desktop UI verification has not been
run.

- Commandeered by a maintainer: merged current `main` (protocol 240 →
241) and added the missing-root handling above, with a dangling-link
case in the regression test. Re-ran the focused host-daemon, server (8
files touching these RPCs), and contract suites plus lint/typecheck; all
pass.

Fixes #5555

> AGENT GENERATED

---------

Co-authored-by: Michael Yong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* Keep background work settlements across message edits (#5656)

## Human comments

## What was wrong

Editing a sent message deletes every event from the edited request
onward (`deleteThreadEventSuffixInTransaction`). When a background task
started before that request and settled after it, the deletion removed
the settlement but kept the `item/started` event. In #5481, the
background download started at seq 140033, Escape stopped the thread
(which settles open tasks with a completion after the edited request at
140146), the edit passed the background-work guard because the task was
settled, and then the rewrite deleted that completion. The card showed
"Running" indefinitely, and the orphan counted as active background
work, so every later edit returned 409.

## What changed

- `packages/db/src/data/events.ts`: new
`listThreadEventSuffixBackgroundSettlementRows` returns, for each
background task or delegation that started before the cutoff and was not
settled before it, its last settlement inside the deleted suffix.
- `apps/server/src/services/threads/thread-edit-message.ts`: inside the
edit transaction, those settlements are re-appended (thread-scoped,
original item state) after the suffix is deleted. The predicted
replacement request sequence accounts for the carried events.
- Tasks that start and settle entirely inside the deleted suffix are
still removed.
- No wire, CLI, or guide changes. Orphans already stuck in existing
threads are not repaired here; they are settled when the host daemon
restarts.

## How you verified

- New regression test in
`apps/server/test/threads/thread-edit-message.test.ts` (task started
before the edited message, stopped after it, plus a task entirely inside
the suffix). It fails on main and passes with the fix.
- `pnpm exec turbo run lint typecheck --filter=@bb/server
--filter=@bb/db`
- `pnpm exec turbo run test --filter=@bb/server --
test/internal/background-task-reconciliation.test.ts
test/threads/thread-edit-message.test.ts` (66 passed)
- Manual, on a `pnpm start:worktree` instance with a real Claude Code
thread: background `sleep 3600` started (seq 23), second message (seq
33), stopped mid-turn (task settled `stopped` at 47), then `bb thread
edit-message --expected-request-sequence 33`. Result: `system/operation`
48, carried `item/backgroundTask/completed` (stopped) 49, new request
50, new `thread/identity` 51; no running background work remained.

Fixes #5481

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Let clicks on the voice input strip focus the textarea (#5665)

## Human comments

## What was wrong

In the app's `VoiceInputTextarea` (used by the question form's "Type
your own answer…" box and by plugins through
`experimental_VoiceInputTextarea`), the voice-input controls sit in a
full-width, absolutely positioned row over the bottom of the textarea.
That row caught pointer events across its whole width, so clicking
anywhere in the bottom ~32px of the textarea hit the row instead of the
textarea and did not focus it.

## What changed

`apps/app/src/components/promptbox/VoiceInputTextarea.tsx`: the overlay
row is `pointer-events-none` and its direct children are
`pointer-events-auto`, so clicks on empty space in the row reach the
textarea while the mic, cancel, and stop buttons and the waveform still
receive clicks.

## How you verified

- `pnpm exec turbo run lint typecheck --filter=@bb/app` passes.
- `pnpm start:worktree` plus a real Claude Code `AskUserQuestion` thread
in headless Chrome at 1280px with the mic visible. After selecting
"Other…" and blurring, `elementFromPoint` 12px above the textarea's
bottom edge returned the `TEXTAREA`, and a mouse click there focused it.
The element at the mic button's center is still the "Start voice input"
button.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Give the Top list sidebar a leading window-frame lip (#5703)

## Human comments

## What was wrong

Follow-up to #5584 (reported in
https://github.com/get-bb/bb/pull/5584#issuecomment-6236573317: "when
top list enabled, right and left edges are not equal"). In the framed
macOS desktop window, the window frame left an 8px lip on the right and
bottom of the card. With the Rail placement, the rail fills the left
side. With the list placement (Top list) there is no rail, and the frame
had no leading lip, so the sidebar card (and the content card when the
sidebar is collapsed) sat flush against the window's left edge. The
collapsed title-bar reserve also assumed a rail was present, so the page
title overlapped the sidebar toggle in Top list.

## What changed

- `apps/app/src/components/ui/sidebar.tsx`, `apps/app/src/app.css`: with
the list placement, the frame gains a leading lip
(`--bb-window-frame-leading-lip`), so the sidebar card and the collapsed
content card are inset 8px on the left, matching the right and bottom.
`SidebarProvider` publishes `--bb-window-card-collapsed-left`: the rail
width for Rail, the leading lip for Top list.
- `apps/app/src/lib/bb-desktop.ts`:
`MACOS_TITLE_BAR_COLLAPSED_SIDEBAR_RESERVE_CLASS` subtracts
`--bb-window-card-collapsed-left` instead of assuming a rail, so the
title clears the toggle when the sidebar is collapsed in Top list.
- Rail placement and non-macOS or unframed windows are unchanged. No
wire, CLI, or plugin API changes.

## How you verified

- Added cases to `apps/app/src/components/ui/sidebar.test.tsx` for the
leading lip and the published collapsed-left offset under both
placements.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` and the
sidebar/layout/secondary-panel tests pass.
- Measured in the real Electron app via CDP, window 1280px wide:
  - Top list open: left gap 0 -> 8px; right and bottom gaps stay 8px.
- Top list collapsed: left gap 0 -> 8px; the title now clears the
sidebar toggle.
  - Rail open and collapsed: unchanged.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(host-wa…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants