Skip to content

Build the Info tab body from public Info rows and sections - #8095

Merged
ymichael merged 6 commits into
mainfrom
bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd
Nov 26, 2026
Merged

ymichael merged 6 commits into
mainfrom
bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd

Conversation

@ymichael

@ymichael ymichael commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb's Info tab was registered through the public tab slot, but its body was not public. ThreadSecondaryPanel filled a private React context (ThreadInfoContentContext) with <ThreadMetadataContent>. That component took 18 props built in ThreadDetailView and 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-failures replaces that row with an operation row, 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 to error, which a lost start, a refused start command or provider.failed before 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.
    • It renders every threadInfoRow and threadInfoSection, bb's own included, through the same mount path.
    • It shows a skeleton while the thread loads.
    • It shows "No thread details available." only when no dt and no [data-info-section] rendered.
  • apps/app/src/core-contributions/thread-info.tsx (plus thread-info/*.tsx) registers:
  • Removed:
    • ThreadInfoContentContext and thread-info-registration.tsx;
    • ThreadMetadataContent and its 18-prop metadata plumbing;
    • metadataContent on the secondary panel;
    • hasAnyThreadMetadata;
    • the private parent-thread subset query;
    • useThreadTimelineProvisioningFailure and thread-provisioning-failure.ts.
  • Section collapse state is stored under <pluginId>/<id> for every section; bb's own are bb--core/<id>. The infoPanel.collapsedSections schema maps the legacy bare ids childThreads, forks and threadStorage, so existing collapsed state carries over.

New and changed public API (plugin SDK 0.6.205)

  • experimental_useEnvironment(environmentId): ExperimentalEnvironmentState
    • States: loading, ready with environment, notFound, error, the same as experimental_useThread.
    • ExperimentalEnvironment = environments.get's Environment plus label and host: { id, name, connected, local, named, machineProvider } | null.
    • It reads the same realtime-kept environment, hosts and provider queries the thread view uses.
    • label comes from core's formatEnvironmentDisplay/getEnvironmentWorkspaceInfoDisplay.
    • named and machineProvider carry 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? }): ExperimentalThreadStorageFilesState
    • States: loading, ready with files, or error with errorMessage (core's error text).
    • enabled: false pauses 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.
    • It is named after searchPickerOptions, which moved from @bb/shared-ui/picker-search into @bb/fuzzy-match.
    • Core and the SDK runtime now share that one function.
  • ExperimentalThread.runtime.failure: "provisioning" | null.
    • Stored in the new nullable threads.failure_kind (migration 0172_thread_failure_kind, generated by drizzle-kit).
    • Written only in writeThreadLifecycleStateInTransaction: set when provisioning.failed moves the thread to error, cleared on every other status move.
    • Filled by the runtime builders for threads.get, sidebar entries and status-change realtime.
    • Server to client only; no daemon protocol change.
  • Type-only widening, already supported at runtime: ExperimentalThreadTitleTextProps.tooltip.

Registry components (no SDK member)

  • Moved from apps/app into @bb/shared-ui and published by plugin-registry:
    • option-picker (13 app callers repointed);
    • thread-unarchive-button;
    • truncate-path-middle;
    • thread-storage-tree;
    • use-thread-storage-browser;
    • right-panel-file-visuals.
  • Newly published: info-list-row, copy-button, list-loading-placeholder, picker-layout, use-reset-picker-scroll, and a new info-list-more-row.

Docs

  • docs/api_to_audit.md:
    • new entries for experimental_useEnvironment, experimental_useThreadStorageFiles and experimental_searchPickerOptions;
    • updated entries for Info rows/experimental_ThreadInfo, experimental_useThread (runtime.failure), panel tabs, unified tabs and thread-title text.
  • Plugin Guide surfaces.ts and the anatomy manifest.
  • bb-plugin-authoring frontend-registration.md and frontend-components.md.
  • docs/configuration.md row for infoPanel.collapsedSections.

Core callers on the shared path

  • Every core Info row and section and the Info tab itself (thread-info.tsx) run on the public slots and hooks.
  • ThreadInfoRows/ThreadInfoSections mount core and plugin entries identically.
  • The lazy panel placeholder renders the same ThreadInfo.
  • BranchPicker, ProjectSelector, ModelReasoningPicker and machine search call the same searchPickerOptions.

Visible changes, all intended

  • A thread with no environment, parent, failure, archive or forks now shows its Parent and Project rows and any plugin rows or sections, instead of "No thread details available." (F12).
  • A real provisioning failure now shows "Environment: Not created · provisioning failed".
  • Thread storage no longer marks the file open in a split panel pane, or opens folders and expands "N more" to reveal it. That highlight only showed with Info and the file side by side, and reading it publicly needed a required target on every file tab. Removed with InfoList's revealIndex, which existed only for it.
  • Everything else matched main on live data (see below).

How you verified

Live, one dev server, main's app bundle via a proxy against the branch's bundle on identical data:

  • Info card element screenshots are pixel-identical for:
    • a child thread (Parent link, Notify parent "When stuck", Project, Environment, Directory, Git rows);
    • an archived thread (Archived row with Unarchive);
    • a fork.
  • On the root worktree thread (Child threads, Forks, Thread storage) the only difference is the relative time "3m" against "4m", from capture timing.
  • Parent picker options are identical ("None", "Fork of QA"; the child and the archived thread excluded).
  • Opening a storage file opens the same tab on both builds.
  • F12: the pending thread with an automation shows "No thread details available." on main. On the branch it shows Parent, Project and the Automations section.
  • Provisioning failure: a worktree thread whose repository was deleted before dispatch. Main shows "No thread details available."; the branch shows "Environment: Not created · provisioning failed". The DB row has failure_kind = 'provisioning'.
  • Two machines (a second daemon enrolled on the dev server): the Machine row is pixel-identical on main and branch for a thread on each machine.
  • Removed machine (host set to destroyed in the dev DB, then restored): both builds show "Unavailable — machine removed" with Machine "Studio (second)". The branch gets the name from hosts.get({ includeRemoved: true }).
  • Removing machine (host phase = 'removing'): both builds show "Machine removal in progress" with the machine named. Pixel-identical.
  • Split panes (Root and Child threads side by side): the Info panel follows the focused pane on both builds. Pixel-identical for the child; the root differs only in the Forks collapse state.

Tests (each fails on main for the behaviour it covers):

  • ThreadInfo.test.tsx, 7 tests:
    • plugin section plus core rows on a thread without metadata;
    • Environment label, Machine row and new-thread action with two machines;
    • removed machine named through the removed-host read;
    • provisioning failure shown only for runtime.failure;
    • archived thread read by id;
    • child threads and forks;
    • parent options (children first; self, descendants, side chats and other projects excluded).
  • lifecycle-failure-kind.test.ts: provisioning.failed sets the failure. A lost start, a refused start command, provider.failed before start and a deleted environment row leave it null. A retry clears it. The check covers the column, threads.get and the list entry.
  • public-host-get-removed.test.ts: includeRemoved returns a removed host; a plain GET still 404s.
  • public-ui-preferences.test.ts: legacy section ids map to bb--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 test for @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.mjs after turbo run build --filter=@bb/app: OK (numbers above). drizzle-kit generate: no schema changes after 0172.
  • After rebasing onto Load plugin surfaces and core contributions from chunks with one lazy helper #8152/Start lazy plugin parts and their runtime slots as early as the screen needs them #8203, live on 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.failure is required on ExperimentalThread (ThreadWithRuntime) and thread list entries. Add failure: null to literal runtime objects. In the community corpus (504 folders), 31 folders build runtime: { displayStatus } literals, all in tests or test helpers. Only the ones typed as these thread shapes break. Examples: tobi/bb-bots-sidebar tests/workflow-runs.test.ts, openwizdev/WizPlugins wizbar tests, VKirill/bb-plugin-project-folders auto-archive.test.ts.

I did not edit these plugins.

Community callers that can migrate (not edited):

  • environment reads in the app: 14 folders call useSdk().environments.* and about 10 call hosts.* as one-shot fetches, e.g. SergeyGavrilov/bb-diff-tree, wy3z/bb-cursor-suite agent-pills;
  • storage files: 9 folders call threads.storageFiles.
  • The KosachMax/bb-plugin-notion-theme CSS on dl [data-info-section] still matches.

🤖 Generated with Claude Code

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd branch 2 times, most recently from 5df9a28 to 057d884 Compare November 25, 2026 00:23
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]>
ymichael and others added 6 commits November 25, 2026 20:03
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]>
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
ymichael force-pushed the bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd branch from 057d884 to 8d184fa Compare November 26, 2026 04:17
@ymichael
ymichael merged commit 2a21dd5 into main Nov 26, 2026
99 of 100 checks passed
@ymichael
ymichael deleted the bb/build-the-info-tab-body-from-public-info-rows-an-thr_4bmsu3fsmd branch November 26, 2026 04:41
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