Skip to content

Unify plugin tabs across threads and navigation pages - #6013

Merged
ymichael merged 1 commit into
mainfrom
bb/git-plugin-pr-1-plugin-fixed-tabs-in-the-thread-thr_i4jcnrjiv8
Oct 23, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/git-plugin-pr-1-plugin-fixed-tabs-in-the-thread-thr_i4jcnrjiv8

Conversation

@ymichael

@ymichael ymichael commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Thread action tabs, navigation-page fixed tabs, and core Info/Diff used different registration and opening paths. That made tab context and lifecycle inconsistent and prevented plugins from owning core pinned tabs. Saved layouts also needed to survive the transition, plugin loading, visibility changes and reloads.

What changed

  • Add one registration: app.slots.experimental_tab({ id, title, icon, tooltip?, layout?, context, availability, useVisible?, component, ... }). Context is { kind: "thread" } with { threadId } props, or { kind: "nav-panel", panelId } with { subPath } props. Fixed tabs have one non-closable identity; action tabs launch closable instances with persisted/deduplicated params. Only actions accept run and params. Navigation-page actions also fit this model.

  • Use one registry and destination dispatcher. ExperimentalAppPanel.experimental_openTab is the new opener; existing fixed-tab, action and thread-panel open calls remain wrappers over the same implementation. A visibility hook hides a fixed tab or launcher while retaining saved fixed order and existing action instances. Hooks execute inside the plugin crash boundary; plugin generations reset crashed content across every context.

  • Register core Info and Diff as thread/fixed tabs. Preserve Diff's Meta+D toggle, changed-file/commit entry points, Git setting, visibility and pane-local review controllers. Preserve Add Info tab row and section slots that core uses #6117's ordered Info row and section registrations. There is no core-only Info/Diff content dispatch.

  • Migrate first-party Docs, GitHub, Side Chat, Tasks, Workflows and the ThreadChat demo. Remove the unshipped experimental_threadFixedTab API. Remove threadPanelAction, navPanel.fixedTabs, and their old registration/prop types from public SDK declarations and normal Guide/authoring documentation. Keep lenient runtime adapters so already-published plugins keep loading. Git install/update and path/builtin rebuilds emit migration warnings, also recorded in plugin logs; they never fail builds for these retired names. Runtime SDK exports remain available. Record the 92/15 known legacy marketplace callers and removal criteria in docs/api_to_audit.md.

  • Preserve existing plugin-page-fixed and plugin-panel IDs/params. Convert old Info/Diff entries, selected IDs and split placement to core plugin-fixed entries without reordering, including revision-checked server rewrites. SDK/CLI thread tab inspection/update uses the same persisted model. No SQL schema or daemon wire change.

  • Update Plugin Guide cards/surfaces and authoring migration examples. Rebase onto main 2884950f17 (Move GitHub PR status into a bundled GitHub PR Status plugin #6125); bump SDK with bump-plugin-sdk.mjs --patch to 0.6.73, above main's 0.6.72. New-thread-screen actions retain their separate project context and share the action-opening implementation.

  • Resolve Move GitHub PR status into a bundled GitHub PR Status plugin #6125 conflicts by retaining the retired PR-hook runtime export and both tab adapters. Keep named-import and property-registration warnings together, all non-fatal. Use main's returned migrationWarnings and logPluginBuildWarnings pipeline for all three names so warnings are logged once; preserve both audit entries and migration docs. First-party callers of the new tab API require SDK >=0.6.73.

How you verified

  • After rebasing, freshly clone/build/install Graph at 3fd202e9af47 and T3 Sidebar at 8b535729dd22 through bb's Git install flow. Both artifact manifests report SDK 0.6.73. Graph logs the two tab warnings; T3 logs the retired PR-hook warning at src/ThreadCard.tsx:6. Both have zero plugin-log errors. Graph's thread/fixed tabs render, and T3's actual sidebar renders PR Unify plugin tabs across threads and navigation pages #6013 alongside the matching core Info row, with no browser errors. Restore the sidebar preference and disable T3 after QA. Evidence: /Users/michael/.bb/thread-storage/thr_fkjwifewbd/pr6013-rebase-6125/verification.md.

  • pnpm exec turbo run typecheck lint test --filter='...[origin/main]' --concurrency=1 passes: 243/243 tasks, including 6,323 app tests and 3,675 server tests. SDK version guard, formatting and git diff --check pass. The unchanged source-layout builtin watcher test failed in the initial broad run, then passed in its complete isolated suite (28/28) and the full rerun. No timeout was weakened.

  • One six-case contract table covers new thread fixed/action, new navigation-page fixed/action and both legacy adapters: stable saved identity, persisted params, deduplication, close behavior, visibility, remount and crash/reload. Existing migration and split-readiness tests remain. Independent mutations prove crash recovery failures in both the table and the actual navigation-page host; repaired focused tests pass. A full-suite failure also verified the legacy fixed-target callback contract before its repair.

  • Real same-store upgrade from main c0013e2aba: save first-party/marketplace tabs and a Side Chat instance, upgrade to the branch, and compare persisted data. Every action entry, parameter and order remains unchanged; Info/Diff convert in place. Verify Info, Diff, changed-file navigation, Meta+D, Docs/Tasks navigation, GitHub, Workflows and restored Side Chat. Prior branch evidence covers reordered/split Diff restoration and the Git setting.

  • Actual fresh Git-source install flow at immutable public commits: Agent Graph 3fd202e9af47, SQL 69593e887aaf, Host Monitor 1d84e329e69d (plugins/host-monitor) and JB Flow 66d4700cb1c3. They build, load and log the migration warnings. Graph/SQL/JB Flow action tabs open, close, reopen and restore once; Graph/SQL/Host Monitor fixed tabs reopen and persist without close controls. No errors in the fresh app console or their plugin logs. JB Flow's published commit has actions but no fixed tabs.

  • Install original published Lazygit 0.2.10 and Global Workflows 0.1.3 npm bundles; app.js hashes match the scanned published artifacts. Both legacy action tabs open, close and restore. The Lazygit terminal renders; Global Workflows shows an empty configured catalog. No workflows, database queries, voice sessions or external GitHub writes run.

  • Handsfree 0.1.6 has the same sidebar voice-bar crash on main and this branch; its fixed Views tab renders the same companion state at phone width. This is recorded as a pre-existing baseline, not counted toward the three working fixed-tab plugins.

  • Review app runs from the new head with pnpm start:worktree: prepared thread. Detailed local evidence: /Users/michael/.bb/thread-storage/thr_fkjwifewbd/pr6013-unified/verification.md.

  • Size: 80 files, +3,093 / -999; production/tooling +1,805/-673, tests/support +1,095/-195, docs +193/-131. The previous cleanup removed 188 net lines, including the JSX glyph assertion and redundant fixed-tab setup. Visibility observers remain so plugin hooks run within crash isolation.

AGENT GENERATED

@ymichael ymichael changed the title Let plugins pin tabs in the thread panel, with core's Info tab on the same path Let plugins pin thread tabs, with core Info and Diff on the same path Oct 22, 2026
@ymichael
ymichael marked this pull request as ready for review October 22, 2026 20:09
@ymichael ymichael changed the title Let plugins pin thread tabs, with core Info and Diff on the same path Unify plugin tabs across threads and navigation pages Oct 22, 2026
@ymichael
ymichael force-pushed the bb/git-plugin-pr-1-plugin-fixed-tabs-in-the-thread-thr_i4jcnrjiv8 branch from b833f61 to c74fea1 Compare October 22, 2026 23:53
@ymichael
ymichael merged commit 1e80ca7 into main Oct 23, 2026
89 of 91 checks passed
@ymichael
ymichael deleted the bb/git-plugin-pr-1-plugin-fixed-tabs-in-the-thread-thr_i4jcnrjiv8 branch October 23, 2026 02:44
alexandre-vl added a commit to alexandre-vl/bb that referenced this pull request Oct 23, 2026
Upstream get-bb#6013 renamed PluginThreadPanelProps to
ExperimentalThreadActionTabProps, which conflicts with the inbox's split
of PullPanelTab in plugins/github/app.tsx.
alexandre-vl added a commit to alexandre-vl/bb that referenced this pull request Oct 23, 2026
Upstream get-bb#6013 replaced threadPanelAction with experimental_tab, so link
claims move to thread action tabs: experimental_claimUrl is a member of
ExperimentalTabRegistration, the collector rejects it outside thread
action tabs, and useOpenClaimedUrl reads usePluginSlots().tabs. The
GitHub issue tab registers through experimental_tab.

replaceTabId reaches openPluginPanel through the panel action destination,
and only an open refused before it reaches the opener warns about params,
so a replacement whose tab has closed declines quietly.

Bumps the plugin SDK to 0.6.74.
ymichael added a commit that referenced this pull request Nov 18, 2026
## Human comments

## What was wrong

Boot JavaScript grew from 349.6 KB to 419.8 KB brotli between #6076
(dae54bd) and f1c5304, measured per module with the same build.
Most of the growth came from features, but the largest piece was a leak.
#6579 had the sidebar updates badge (`useUpdateInventory`) import
`pluginHasUpdateSurfaces` from `PluginUpdatesCard.tsx`. That one helper
put the plugin-management UI, the shared-ui resource list and
`@radix-ui/react-scroll-area` on boot: 19.7 KB brotli. A second leak
came with #6756: `thread-action-registry` imports `useBbNavigate` from
`plugin-navigation-hooks.ts`, which also defined the plugin-only
file-open hook, so the local open-target hooks loaded before first
paint.

While splitting dialogs I also found a bug in `vite-journey-chunks.ts`.
Vite adds `\0vite/preload-helper.js` to `importedIds` for any module
with a dynamic `import()`, with no matching import declaration in the
code. The counts disagreed, so `moduleEdges` fell back to following
every name of every import. Once `ThreadActionsProvider` gained a split,
that pulled the `@bb/client-core` and `@bb/thread-view` timeline code
into the plugin runtime chunk (PluginFrontend +18.5 KB, NewThreadPage
+15 KB).

Boot brotli growth, #6076 → f1c5304 (per-module attribution, brotli
share of each boot chunk):

| Commit / module cluster | Brotli bytes |
|---|---|
| #6579 Settings → Updates: plugin management UI, shared-ui resource
list, `@radix-ui/react-scroll-area` via `pluginHasUpdateSurfaces` |
+19,727 |
| #7133 dependency update: `react-dom` 19.2.4 → 19.3.1 (+ `react`,
`scheduler`) | +7,329 |
| #6002 keyed thread store: `query-tags` keyed store,
`thread-entity-store`, `thread-panel-queries` | +5,824 |
| #6013 / #6519 core tab and message-metadata registrations through the
plugin collector (`plugin-app-registration-collector`, validators) |
+5,249 |
| #7213 single update button: `@radix-ui/react-hover-card`, badge model
| +3,148 |
| #6756 open-target hooks via `plugin-navigation-hooks` | +2,381 |
| #6763 shared rename path: `inline-rename`, rename dialogs | +1,830 |
| #7176 setup-guide telemetry: `onboarding-model` | +1,733 |
| Radix version bumps (`react-collection` and others, excluding
scroll-area and hover-card) | +~3,900 |
| React Compiler memo caches (Nov 15 budget entry) and other
app/shared-ui feature growth | remainder (~19,000) |
| **Total** | **+70,214** |

Shared packages: `@bb/shared-ui` +15.3 KB (mostly the resource list
above), `@get-bb/plugin-sdk` +5.2 KB (the collector),
`@bb/server-contract` +2.0 KB, `@bb/sdk` +1.2 KB, `@bb/domain` +0.1 KB.
Zod was already on boot at #6076 and is unchanged.

## What changed

- `pluginHasUpdateSurfaces` moved from `PluginUpdatesCard.tsx` to
`plugin-status.ts`. The plugin-management UI now loads with Settings and
Tools (−19.7 KB).
- `usePluginCanOpenFileExternally` moved from
`plugin-navigation-hooks.ts` to a new `plugin-file-open-hooks.ts`, still
re-exported by `plugin-sdk-hooks.ts`. The open-target hooks now load
with the thread and compose pages, which already use them (−2.4 KB).
- An earlier version also set `treeshake.manualPureFunctions: ["z"]` to
drop unused zod schemas (−3.6 KB). It is removed. Rolldown matches that
name in every module, minified dependencies included, and also inside
function bodies. In the built app it deleted sonner's
`setSwiping(true)`/`setSwiping(false)` calls (toasts no longer follow a
swipe on touch screens), cmdk's result-sort call, and two `push` calls
in d3-scale's log ticks.
- The project path, project rename and delete, and thread delete and
archive dialogs load behind `defineSplit` preload-tier wrappers that
mount when opened and stay mounted, following `ApplicationUrlDialog`
(−3.1 KB). Nothing in them is visible at first paint.
- `vite-journey-chunks.ts` ignores the preload helper id. The regression
test fails before the fix and passes after.
- `bundle-budget.json`: `splitBoundaries` boot guards for
`PluginUpdatesCard`, `UpdatePluginDialog`, `useLocalOpenTargets` and the
five dialogs. `@radix-ui/react-scroll-area` is added to
`forbiddenBootPackages`, plus a dated `$comment` entry. Against main's
build, the new budget reports all nine guards.
- Limits are unchanged. Boot now measures 402,655 bytes against 429,151,
which is 6.2% headroom. 10% over the new measurement (442,921) would be
a raise, so lowering the limit would leave less than 10%.

Not reached: 10% headroom needs about 12.3 KB more. The remaining boot
code that isn't first-paint UI is small and spread out. The
command-palette placeholder is kept on boot deliberately so Cmd+K opens
instantly. The updates hover-card body is ~2 KB and splitting it would
risk an empty card on an early hover. The plugin collector (5.2 KB) is
how core registers its own Info tab and message time, per the rule that
core uses the plugin API path. Each of these would cost something
visible or break that rule.

## How you verified

Bundle sizes from real builds of main (3678415, same sizes as
f1c5304) and this branch rebased on main (`.br` files, as
`check-bundle-budget.mjs` counts them):

| Closure | main raw / brotli | branch raw / brotli | brotli Δ |
|---|---|---|---|
| boot | 1,717,479 / 428,928 | 1,597,774 / 402,655 | −26,273 (−6.1%) |
| ThreadPage | 1,909,102 / 504,492 | 1,918,632 / 506,727 | +2,235 |
| NewThreadPage | 1,007,979 / 270,590 | 1,025,094 / 274,769 | +4,179 |
| PluginFrontend | 832,313 / 220,554 | 846,772 / 223,750 | +3,196 |
| boot + ThreadPage | 933,420 | 909,382 | −24,038 |
| boot + NewThreadPage | 699,518 | 677,424 | −22,094 |
| boot + PluginFrontend | 649,482 | 626,405 | −23,077 |

Journey growth is the open-target hooks (~3.9 KB) that those pages use,
plus small dialog dependencies.

First content on a real server (measured with the earlier version that
still had the `z` hint, so about 3.6 KB more JS was removed than now):
one `pnpm start:worktree` server with real data (a real agent thread
plus fixtures). Main's and this branch's builds were served by swapping
`index.html` in `apps/app/dist`, so server and data were identical. Each
run used headless Chrome on a fresh navigation with the HTTP cache
cleared and disabled, 4× CPU throttle, 1.6 Mbps / 150 ms RTT. Median of
6 alternating runs; ranges did not overlap for any metric:

| Page | Metric | main | branch | Δ |
|---|---|---|---|---|
| New thread `/` | FCP | 3,594 ms | 3,430 ms | −164 |
| | composer painted | 6,862 ms | 6,731 ms | −131 |
| Thread `/threads/<id>` | FCP | 3,606 ms | 3,432 ms | −174 |
| | timeline painted | 8,942 ms | 8,756 ms | −187 |
| Plugin page `/plugins/automations/automations` | FCP | 3,572 ms |
3,422 ms | −150 |
| | content painted | 7,496 ms | 7,353 ms | −144 |
| | JS downloaded before content (new / thread / plugin) | 745,687 /
979,589 / 732,738 B | 719,291 / 951,279 / 706,155 B | −26.4 / −28.3 /
−26.6 KB |

Manual checks on the branch build:
- Cold load, sidebar and composer: no console errors.
- Updates badge hover card: lists the provider CLI updates.
- Thread page renders its timeline.
- New thread submitted from the composer.
- Thread delete dialog: confirmed, thread deleted.
- Archive on a parent with a child: dialog shows the child count; both
threads archived.
- "New project" path-entry fallback dialog: path submitted, project
created.
- Settings → Updates and the Plugins page render.
- Project rename and delete dialogs opened through the real
`ProjectActionsProvider` in a throwaway test, because their only menu
sits in a header that the current routes don't render.
- A 409 on `GET /threads/<new>/thread-storage/location` right after
submit also happens on main.

Commands:
- `pnpm exec turbo run typecheck lint --filter=@bb/app`
- `pnpm exec turbo run test --filter=@bb/app -- <63 related test
files>`: 63 passed
- `src/vite-journey-chunks.test.ts`: fails before the fix, passes after
- `node scripts/check-bundle-budget.mjs`: OK
- `oxfmt --check`
- Rebased on main (includes #7736); `pnpm exec turbo run build typecheck
lint --filter=@bb/app` and `check-bundle-budget.mjs` pass, and the 40
app test files that touch the changed providers, dialogs, layout and
hooks pass on the merge.
- The built sonner and cmdk code again contains the swipe setter and
sort calls that the `z` hint had removed.

> 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 Nov 20, 2026
## Human comments

## What was wrong

`ThreadSecondaryPanel` only mounted `SidebarSplitContainer` once the
thread's fixed tabs were ready (`areFixedTabsReady`). Until then it
rendered the flat panel surface. On a thread switch, readiness is false
on the first render: plugin tabs report visibility from layout effects,
and since #7878 a thread also waits for its saved thread tabs
(`useThreadTabs`) to load. When readiness arrived, the panel replaced
the flat surface with the split container, and React mounted all panel
content a second time. The same swap ran whenever readiness dropped
mid-session, for example while a plugin that owns a saved tab reloads.
The gate came from #6013. It keeps a saved split layout from being
parsed, and overwritten, against an incomplete tab list.

## What changed

- `ThreadSecondaryPanel` mounts `SidebarSplitContainer` right away and
passes readiness down as `isTabListReady`. There is no flat-to-split
swap, so content mounts once on a switch and stays mounted through
plugin reloads.
- `SidebarSplitContainer` (new required `isTabListReady` prop): if it
mounts before the tab list is ready and a saved layout exists, it
renders a best-effort layout from the available tabs, skips persistence
so the saved value stays intact, and restores the saved layout once the
list is ready. With no saved layout it uses the deterministic default
layout, so nothing remounts when tabs arrive.
- No skeleton is shown on a switch. The first version of this PR held
the panel behind `SecondaryPanelContentSkeleton`. After #7878 that
skeleton painted for one thread-tabs fetch on every first visit to a
thread: 33 ms locally and 333 ms with 150 ms of added latency, with no
tab bar or close button.
- The drawer path is unchanged.

## How you verified

- `ThreadSecondaryPanel.threadSwitch.test.tsx` uses the real
`useThreadFixedTabs`, a real plugin tab registration and a stubbed
`sdk.threads.tabs.get`. Content mounts once per switch for Info and an
open file. Content stays mounted with no skeleton while a saved tab's
owning plugin reloads, for Info, an open file and a plugin tab. These
five tests fail with main's `ThreadSecondaryPanel.tsx` and
`SidebarSplitContainer.tsx` (`expected [ 'info:thr_b', 'info:thr_b' ] to
deeply equal [ 'info:thr_b' ]`). Further tests check that panel content
shows while saved tabs load and that a reloaded plugin tab stays
selected.
- The existing saved-split test in
`ThreadSecondaryPanel.collapseControl.test.tsx` passes: the stored split
survives while visibility resolves and is restored afterwards. It now
seeds the thread's `lastUsedAt`, because the container mounts earlier
and `pruneSidebarSplitStorage` drops splits for threads without one.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes. The
`secondary-panel/`, `plugin/` and `thread-detail/` suites pass, apart
from two failures unrelated to this change: a lazy-loading test that
times out under load and passes alone, and a `branding.icon` test that
reads leftover untracked plugin directories in this checkout.
- Live, headless Chromium at 1600x1000 on `pnpm start:worktree`:
- Repeated switches, Info or Diff active, 30 each: 1 panel chrome
insertion per switch (main: 2). Click-to-paint median 16 ms both ways.
- First visit to a thread after a reload, 4 runs each at 0 ms and 150 ms
added latency: 1 insertion, 0 skeleton frames.
- Saved Info | Diff split, first visit after a reload, at 0 ms and 150
ms: the panel shows Info, then restores both panes. The stored layout is
unchanged and no skeleton frames paint.
- Disabling and re-enabling the Git plugin and another plugin with the
panel open: 0 panel remounts, 0 skeleton frames.
- Main-thread CPU per switch, measured on the pre-#7878 base (main: 1
run, branch: 2 runs): Info 50 ms on main vs 45–47 ms on the branch, Diff
92 ms vs 80–84 ms.

Related: #7801. With that change, the duplicate mount opened one extra
short-lived terminal socket per thread switch.

Fixes #7802

> AGENT GENERATED

---------

Co-authored-by: Michael Yong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant