Repository navigation
Conversation
ymichael
force-pushed
the
bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd
branch
2 times, most recently
from
November 25, 2026 00:23
5df9a28 to
057d884
Compare
This was referenced Nov 25, 2026
ymichael
added a commit
that referenced
this pull request
Nov 25, 2026
… helper (#8152) ## Human comments ## What was wrong Every enabled plugin's app bundle was one ESM file, so all of it downloaded and evaluated at startup whether or not its surfaces rendered. On a cold thread load all 26 bundled plugin bundles arrived before the thread was interactive, and git's entry pulled the `@pierre/diffs` runtime in with it. Core contributions had the mirror problem. They register from modules that load with the app, so everything their registration file imports statically lands in that payload. They cannot use the app's `defineSplit` preload tier, because `bb/core-contribution-imports` limits them to the public SDK. #8095 worked around this with a hand-written `import()` and no preload, and bb's Info rows then popped in above the Git plugin's rows. Every feature that moves behind the plugin boundary would hit the same choice: grow startup, or hand-split and pop in. ## What changed - **One lazy primitive, `experimental_lazy(load)`** on `@get-bb/plugin-sdk/app`, with the same loader shape as `React.lazy`. It returns an `ExperimentalLazyComponent<Props>` to pass straight to a slot. - It has one implementation (`apps/app/src/lib/lazy-component.tsx`): a preload-tier `defineSplit`, warmed at idle once startup and plugin frontends settle, with the same download retries and a direct render once loaded. - The plugin runtime and the core binding (`core-plugin-sdk-app.ts`) serve the same function. - A final load failure crashes the slot into `onCrash`. - `React.lazy` keeps React's meaning. - SDK 0.6.203. - **One host loading rule** (`useOrderedReveal` in `apps/app/src/lib/lazy-parts.ts`), applied to Info rows and sections, context card rows and sections, context segments, the rail, settings, setup-guide and homepage sections, and thread header rows: - An entry shows once every entry above it is ready. - Entries below a loading entry wait at most 3 seconds; after that the host shows what is ready. - The late entry is inserted in its place when it arrives, moving the entries below it once. - Eager entries that register later behave as before. - bb's entries and plugins' follow the same rule. - Hosts find lazy components through `PLUGIN_APP_COMPONENT_FIELDS`, a typed list next to the SDK's registration collector in which every slot kind names its component fields, including nested ones such as composer banners. - **Page owners:** the plugin that owns the page (a plugin panel route or its settings page) loads first, prefetches its lazy chunks with its entry, and publishes its registrations once they load, bounded the same way. - **Core contributions:** - The rail outline's component moved behind `experimental_lazy` (`core-contributions/components/ThreadOutline.tsx`). - Core registrations load at startup, and the thread route starts their lazy parts alongside the thread view, so the outline arrives with the page. - `docs/ui-code-splitting.md` describes how core contributions split. - **Guard:** - `bundle-budget.json` adds `src/core-contributions/components/*` as a split boundary for boot, ThreadPage and NewThreadPage. The checker expands `dir/*` patterns. - ThreadPage limits drop by the measured win (7.1 KB raw, 1.0 KB brotli). Boot limits are unchanged; boot grew 3.9 KB raw / 1.2 KB brotli within them. - **Build and serve:** - Each dynamic `import()` in a plugin becomes a chunk under `dist/chunks/`, listed in `app.meta.json`. - A bundle with chunks has `artifactFormatVersion: 2`, which older bb versions refuse. - The server serves chunks only under the bundle's content hash, checks each chunk's sha256 on read, and keeps or deletes chunks with the artifact directory on rollback and uninstall. - Chunk CSS stays in the single scoped `app.css`. - **Slot Suspense:** every plugin slot now renders inside its own `<Suspense fallback={null}>` (`PluginSlotMount.tsx`), so a lazy component that is still loading leaves only its slot empty. This also applies to any plugin component that suspends for another reason: it now renders nothing inside its slot instead of suspending to the page's loading state. - **Plugins:** Git (Diff tab, commit dialog), Automations (panel, thread Info section), Account Pooler and bb connect (settings and setup-guide sections) load those surfaces lazily. Composer's existing paste-time `import()` now splits. - **Test timing:** `exclusive-pick-first-paint.test.ts` imports `composer-provider` at collection time. Its first case paid about 3.9 s of cold module transform inside the test (other cases took about 0.1 s) and timed out under a loaded parallel run; it now takes 131 ms. - **Docs:** `docs/api_to_audit.md` entry with its core callers, Plugin Guide card `lazy-components`, and the bb-plugin-authoring skill (`frontend-registration.md`, `quickstart.md`). `bb plugin build` lists chunk files. demo-server copies chunks. No daemon wire change. ## How you verified Cold loads of a real thread page from `pnpm start:worktree` in headless Chromium, with an empty cache per run. Main (ce81bd5) and this PR alternated in four blocks with the same plugin state, 18 runs per side (14 for module eval); medians: | | main | this PR | |---|---|---| | All JS before thread interactive (HTTP/1.1, 4x CPU) | 1,696 KB br | 1,454 KB br | | Plugin module eval before interactive, 4x CPU (CPU profile) | 148 ms | 132 ms | | Thread interactive, HTTP/1.1, 4x CPU | 1,427 ms | 1,391 ms | | Thread interactive, HTTP/2, 1x CPU | 317 ms | 321 ms | HTTP/2 shows no change with 50 ms added latency either (638 vs 645 ms), or with a 2.5 MB/s cap (902 vs 901 ms). The win is the bytes and module evaluation that leave the startup path; time to interactive moves only slightly. Slow 4G (562.5 ms RTT, 1.44 Mbps), desktop and phone widths, compared frame by frame with main: - Info rows and sections, the rail outline, the commit dialog, the Automations panel and the setup guide's bb connect section render in the same order and layout as main. - Settings sections arrive sooner: bb connect's at 12.8 s (main 20.3 s) and Account Pooler's at 12.9 s (main over 20 s). On bb connect's page the section now arrives before the plugin's Configuration form fills in, so on phone the form pushes it down once (layout shift 0.06). - The Diff tab, clicked as soon as it appears, shows an empty panel for about 0.9 s while its chunk loads; once warmed (any later click), it renders in 5 ms, as on main. - Git's Commit button and context card arrive 0.6–1.0 s later (22.9–23.4 s vs 22.3–22.8 s), because the idle chunk downloads share the link with Git's status requests. - An aborted chunk crashes only its slot: the Diff tab and Automations panel show their crash state while Info and the composer keep working. `bb plugin dev` on a split plugin rebuilt an edited lazy panel, updated the open page without a reload, served it under a new hash, and returned 404 for the old chunk. A git-installed split plugin whose update crashed rolled back to its previous hash, kept serving that version's chunk and rendered it; uninstalling it returned 404 for the chunk and deleted its files. Tests added, each failing on main: - split build and stale-chunk cleanup (`build-plugin-app.test.ts`); - hashed chunk serving, stale-chunk refusal and format version (`plugin-app-bundle.test.ts`); - rollback keeps chunks (`plugin-update.test.ts`); - the reveal rule, including a late entry inserted in place after the bound, first-commit render and crash containment (`lazy-parts.test.tsx`, `PluginSlotMount.test.tsx`); - every registered component, nested composer parts included, and no non-component functions (`plugin-app-component-fields.test.ts`); - page-owner publishing and chunk prefetch (`plugin-frontend-load-order.test.ts`, `plugin-frontend.test.ts`). `pnpm exec turbo run typecheck lint test` passes for every touched package, and `node apps/app/scripts/check-bundle-budget.mjs` passes. Making the outline eager fails the budget check with "ThreadOutline.tsx is eager in ThreadPage". 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Opus 5.5 <[email protected]>
bb's Info tab is now the public experimental_ThreadInfo host, and its seven rows and three sections are core contributions on experimental_threadInfoRow/ Section behind the core-contribution-imports lint. The tab decides emptiness from what rendered, so plugin rows and sections show on threads without core metadata (a-thread F12, V8). New public members: experimental_ThreadInfo, experimental_useEnvironment, experimental_useThreadStorageFiles, experimental_searchPickerOptions, ExperimentalThread runtime.failure (threads.failure_kind, set by provisioning.failed), a live file target on panel tab file details, and hosts.get includeRemoved. Plugin SDK 0.6.205. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Load core's Info row and section components through import() with a second, lazy core binding, so plugin-sdk-hooks and plugin-sidebar-hooks stay out of boot. Send includeRemoved on hosts.get only when set, and give getThreadFailureKind a query-cost case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the second, directory-chosen binding and resolve the core binding with moduleSideEffects: false, as #8088 does, so each importer pulls in only the members it uses. The Info components keep their import() split, which boot still needs (1748.8 KB without it, 1619.1 KB with it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d option
The Info tab's Thread storage list marked the file open in a split panel
pane and expanded folders and "N more" to reveal it. It only showed with
Info and the file side by side, and reading it through the public API
needed a required target on every file panel tab. Remove the highlight,
the target field, InfoList's revealIndex and the selection tracking in
use-thread-storage-browser, which existed only for it.
experimental_useThreadStorageFiles used an empty thread id to pause,
while experimental_useThread and experimental_useEnvironment treat an
empty id as not found. Pause with { enabled: false } instead, the option
shape the RPC query hooks use.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
#8152 replaced hand-written import() splits in core contributions with experimental_lazy, and #8203 starts the restored screen's lazy parts, including every plugin's Info rows and sections when Info is the restored panel tab. Register bb's Info rows and sections as experimental_lazy parts (components in core-contributions/components/ThreadInfoEntries.tsx) so the host's ordered reveal holds them like plugin entries, and start them from bootPluginFrontends with the same restoredLazyParts list. ThreadInfoSlots shows the pending marker while the reveal holds an entry, since a lazy part no longer suspends into the host. core-contribution-parts imports plugin-slots first: the core binding's ThreadInfo reaches plugin-slots, which collects the core contributions at module load. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd
branch
from
November 26, 2026 04:17
057d884 to
8d184fa
Compare
ymichael
deleted the
bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd
branch
November 26, 2026 04:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
bb's Info tab was registered through the public tab slot, but its body was not public.
ThreadSecondaryPanelfilled a private React context (ThreadInfoContentContext) with<ThreadMetadataContent>. That component took 18 props built inThreadDetailViewand merged a core-only array of seven rows and three sections with plugin registrations. No plugin could build or replace that body. Core rows read private host state that plugin rows can't reach (audit V8, core-contributions rank 8).Emptiness was also decided from core fields alone.
hasAnyThreadMetadata(ThreadDetailSecondaryContent.tsx) showed "No thread details available." whenever core saw no environment, parent, provisioning failure, archive or forks. That hid every plugin row and section, and core's own Parent and Project rows (a-thread F12). Repro on main: a pending thread with no environment and an automation targeting it shows only "No thread details available."; the Automations section is hidden.Main's provisioning-failure row was also wrong. It scanned the cached timeline for a
systemKind: "error"row titled "Provisioning thread failed".normalize-provisioning-failuresreplaces that row with anoperationrow, so a real failure (a worktree whose repository is gone) showed "No thread details available." instead of "Environment: Not created · provisioning failed". Nothing durable recorded the failure: the thread only moved toerror, which a lost start, a refused start command orprovider.failedbefore start also do.What changed
The Info tab is the public host
experimental_ThreadInfo(component,ExperimentalThreadTabProps) is the Info body. Implementation:apps/app/src/components/secondary-panel/info/ThreadInfo.tsx.threadInfoRowandthreadInfoSection, bb's own included, through the same mount path.dtand no[data-info-section]rendered.apps/app/src/core-contributions/thread-info.tsx(plusthread-info/*.tsx) registers:infofixed tab;@get-bb/plugin-sdkand registry components;bb/core-contribution-importsis green.core-contributions/components/ThreadInfoEntries.tsx(inside Load plugin surfaces and core contributions from chunks with one lazy helper #8152'ssrc/core-contributions/components/*split boundary), and each row and section is anexperimental_lazypart, the helper Load plugin surfaces and core contributions from chunks with one lazy helper #8152 added for core contributions. The host's ordered reveal (useOrderedReveal) holds them like plugin entries.ThreadInfoSlotsrenders a pending marker while the reveal holds an entry, and the host shows its skeleton rather than the empty text.bootPluginFrontendspasses the samerestoredLazyPartslist tostartRestoredCoreContributionParts(apps/app/src/lib/core-contribution-parts.ts). CallingreadStoredPanelTabsfrom boot instead would add 12.5 KB raw / 2.3 KB brotli, which Start lazy plugin parts and their runtime slots as early as the screen needs them #8203 kept out.vite-core-plugin-sdk-app.tsresolves the one core binding withmoduleSideEffects: false(the same option as Place thread context through one item registration #8088), so each importer pulls in only the members it uses.plugin-slots.tsputs them first in the slot lists plugins join.ThreadInfoContentContextandthread-info-registration.tsx;ThreadMetadataContentand its 18-propmetadataplumbing;metadataContenton the secondary panel;hasAnyThreadMetadata;useThreadTimelineProvisioningFailureandthread-provisioning-failure.ts.<pluginId>/<id>for every section; bb's own arebb--core/<id>. TheinfoPanel.collapsedSectionsschema maps the legacy bare idschildThreads,forksandthreadStorage, so existing collapsed state carries over.New and changed public API (plugin SDK 0.6.205)
experimental_useEnvironment(environmentId): ExperimentalEnvironmentStateloading,readywithenvironment,notFound,error, the same asexperimental_useThread.ExperimentalEnvironment=environments.get'sEnvironmentpluslabelandhost: { id, name, connected, local, named, machineProvider } | null.labelcomes from core'sformatEnvironmentDisplay/getEnvironmentWorkspaceInfoDisplay.namedandmachineProvidercarry core's Machine-row rules.GET /api/v1/hosts/:id?includeRemoved=true/useSdk().hosts.get({ hostId, includeRemoved })returns a removed machine, disconnected, so the Machine row keeps naming it.experimental_useThreadStorageFiles(threadId, { enabled? }): ExperimentalThreadStorageFilesStateloading,readywithfiles, orerrorwitherrorMessage(core's error text).enabled: falsepauses the read and keeps the last list, the same option shape as the RPC query hooks. Core's Thread storage section pauses it while the Info tab is hidden or the machine is offline.experimental_searchPickerOptions({ options, query, getLabel, getAliases? })exposes bb's picker ranking.searchPickerOptions, which moved from@bb/shared-ui/picker-searchinto@bb/fuzzy-match.ExperimentalThread.runtime.failure: "provisioning" | null.threads.failure_kind(migration0172_thread_failure_kind, generated by drizzle-kit).writeThreadLifecycleStateInTransaction: set whenprovisioning.failedmoves the thread toerror, cleared on every other status move.threads.get, sidebar entries and status-change realtime.ExperimentalThreadTitleTextProps.tooltip.Registry components (no SDK member)
apps/appinto@bb/shared-uiand published byplugin-registry:option-picker(13 app callers repointed);thread-unarchive-button;truncate-path-middle;thread-storage-tree;use-thread-storage-browser;right-panel-file-visuals.info-list-row,copy-button,list-loading-placeholder,picker-layout,use-reset-picker-scroll, and a newinfo-list-more-row.Docs
docs/api_to_audit.md:experimental_useEnvironment,experimental_useThreadStorageFilesandexperimental_searchPickerOptions;experimental_ThreadInfo,experimental_useThread(runtime.failure), panel tabs, unified tabs and thread-title text.surfaces.tsand the anatomy manifest.frontend-registration.mdandfrontend-components.md.docs/configuration.mdrow forinfoPanel.collapsedSections.Core callers on the shared path
thread-info.tsx) run on the public slots and hooks.ThreadInfoRows/ThreadInfoSectionsmount core and plugin entries identically.ThreadInfo.BranchPicker,ProjectSelector,ModelReasoningPickerand machine search call the samesearchPickerOptions.Visible changes, all intended
targeton every file tab. Removed withInfoList'srevealIndex, which existed only for it.How you verified
Live, one dev server, main's app bundle via a proxy against the branch's bundle on identical data:
failure_kind = 'provisioning'.destroyedin the dev DB, then restored): both builds show "Unavailable — machine removed" with Machine "Studio (second)". The branch gets the name fromhosts.get({ includeRemoved: true }).phase = 'removing'): both builds show "Machine removal in progress" with the machine named. Pixel-identical.Tests (each fails on main for the behaviour it covers):
ThreadInfo.test.tsx, 7 tests:runtime.failure;lifecycle-failure-kind.test.ts:provisioning.failedsets the failure. A lost start, a refused start command,provider.failedbefore start and a deleted environment row leave it null. A retry clears it. The check covers the column,threads.getand the list entry.public-host-get-removed.test.ts:includeRemovedreturns a removed host; a plain GET still 404s.public-ui-preferences.test.ts: legacy section ids map tobb--core/*.ThreadInfoSlots.test.tsx: updated so the "core" entries are a plugin registered first, and it settles bb's lazy Info entries before asserting.core-contribution-parts.test.ts: bb's Info rows and sections start loading when Info is the restored tab and not for another restored tab.Commands:
pnpm exec turbo run typecheck lint --filter='...[origin/main]': 168/168.pnpm exec turbo run testfor @bb/app, @bb/server, @bb/db, @bb/domain, @get-bb/plugin-sdk, @bb/shared-ui, @bb/fuzzy-match, @bb/plugin-registry, @bb/sdk, @bb/server-contract, @bb/test-helpers, demo-server, bb-guide, the Git plugin and plugin-api-docs: all green.node apps/app/scripts/check-bundle-budget.mjsafterturbo run build --filter=@bb/app: OK (numbers above).drizzle-kit generate: no schema changes after 0172.pnpm start:worktree: the Info tab on the root thread shows the same rows, Git rows and sections. A reload with Info restored requests the Info chunk 122 ms in, right after the plugin loader chunk. The provisioning-failure and pending-automation threads show what they did before.Plugin author impact
One type-only break. Runtime values are unaffected: the host always sends the field. Plugin code typed against these shapes needs it when it builds them, which in practice means test fixtures.
runtime.failureis required onExperimentalThread(ThreadWithRuntime) and thread list entries. Addfailure: nullto literalruntimeobjects. In the community corpus (504 folders), 31 folders buildruntime: { displayStatus }literals, all in tests or test helpers. Only the ones typed as these thread shapes break. Examples: tobi/bb-bots-sidebartests/workflow-runs.test.ts, openwizdev/WizPlugins wizbar tests, VKirill/bb-plugin-project-foldersauto-archive.test.ts.I did not edit these plugins.
Community callers that can migrate (not edited):
useSdk().environments.*and about 10 callhosts.*as one-shot fetches, e.g. SergeyGavrilov/bb-diff-tree, wy3z/bb-cursor-suite agent-pills;threads.storageFiles.dl [data-info-section]still matches.🤖 Generated with Claude Code