Skip to content

Expose host execution controls to plugin apps - #1469

Merged
ymichael merged 13 commits into
mainfrom
bb/expose-provider-model-picker-to-plugin-apps-thr_fy2hvyjf8s
Aug 21, 2026
Merged

ymichael merged 13 commits into
mainfrom
bb/expose-provider-model-picker-to-plugin-apps-thr_fy2hvyjf8s

Conversation

@brsbl

@brsbl brsbl commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

What was wrong

Plugin settings and compact first-party forms could not reuse bb's execution controls. Prompt Enhancer, Tasks, and Automations therefore each had to own some combination of provider/model discovery, default resolution, capability reconciliation, permission ceilings, labels/icons, and picker UI. That duplicated product policy and made plugin behavior drift from the composer, which is the root cause behind #1836.

What changed

  • Add the experimental host-owned experimental_ProviderModelPicker, a small controlled adapter around the same ModelReasoningPicker and useThreadCreationOptions used by the composer. It does not introduce a second catalog/default/capability resolver.
  • Add the separate experimental host-owned experimental_PermissionModePicker. It uses the same provider capabilities, fallback order, and routed machine permission ceiling as the composer. Placeholder or failed lookups never mutate the controlled value.
  • Keep routing and provider visibility orthogonal. Environment routing supplies host plus workspace context for workspace-dependent catalogs; it does not imply a provider lock. allowProviderChange={false} hides provider tabs while model, reasoning, and service-tier controls remain available.
  • Migrate Tasks delegation presets and Automations agent execution to both controls. Their frontend bundles no longer inspect experimental_useProviders or implement permission reconciliation. Automations explicitly hide provider tabs when targeting an existing provider-bound thread.
  • Preserve every existing public SDK API. All new runtime exports remain experimental_; SDK version 0.4.13, testing runtime, docs/api_to_audit.md, and the canonical builtin plugin-authoring skill are updated.
  • Preserve the earlier end-to-end Tasks and Automations provider/model/reasoning/service-tier migrations, including their CLI surfaces. No server/host-daemon wire contract changes are introduced, so HOST_DAEMON_PROTOCOL_VERSION is unchanged.

Before this PR, no shared compact execution control existed. The exact new API is:

type ExperimentalProviderModelPickerValue = {
  providerId: string;
  model: string;
  reasoningLevel: ReasoningLevel;
  serviceTier?: ServiceTier;
};

type ExperimentalProviderModelPickerRouting =
  | { kind: "host"; hostId: string }
  | { kind: "environment"; environmentId: string };

type ExperimentalProviderModelPickerProps = {
  value: ExperimentalProviderModelPickerValue;
  onChange(value: ExperimentalProviderModelPickerValue): void;
  routing?: ExperimentalProviderModelPickerRouting;
  allowProviderChange?: boolean;
  align?: "start" | "center" | "end"; // default: "start"
  disabled?: boolean;
  className?: string;
};

type ExperimentalPermissionModePickerProps = {
  providerId: string;
  value: PermissionMode;
  onChange(value: PermissionMode): void;
  routing?: ExperimentalProviderModelPickerRouting;
  align?: "start" | "center" | "end"; // default: "end"
  disabled?: boolean;
  className?: string;
};

experimental_ProviderModelPicker: ComponentType<ExperimentalProviderModelPickerProps>;
experimental_PermissionModePicker: ComponentType<ExperimentalPermissionModePickerProps>;

Provider changes wait for the authoritative catalog, then emit provider, default model, reconciled reasoning, and supported service tier atomically. The picker remains open across provider, model, reasoning, and service-tier changes, matching the composer. Verified catalogs normalize stale controlled values; selected-only/retired models survive; placeholder, failed, and empty catalogs leave the value unchanged. Permission selection is deliberately a separate controlled value and is corrected only after provider capabilities and the routed ceiling are authoritative.

The full PR is 2,445 additions / 1,753 deletions across 61 files. Excluding tests, documentation/skills/generated guides, stories, testing runtime, and package metadata, implementation is 868 additions / 1,178 deletions: net −310 implementation lines while adding the shared capabilities and migrating both built-in consumers. Most added lines are focused behavior coverage for the shared policy boundary.

Prompt Enhancer can replace its custom catalog/cache/settings selector with these controls. That external repository is not modified by this PR.

How you verified

Behavior coverage includes caller-controlled picker alignment, persistent open state across execution-option changes, the Tasks left-column override, atomic provider changes, model/reasoning/service-tier capability changes, selected-only retired models, loading/placeholder/error retention, controlled rehydration, explicit provider locking, permission provider/routing/ceiling reconciliation, single-mode providers, Tasks persistence/delegation/CLI, and Automations persistence/execution/CLI. Trivial wiring tests were intentionally skipped.

  • full app suite: 416 files, 3,212 passed / 3 skipped
  • plugin SDK suite: 16 files, 129 passed
  • Tasks suite: 35 files, 361 passed
  • Automations suite: 4 files, 62 passed
  • alignment follow-up: SDK harness 45/45 and Tasks manage 27/27
  • picker persistence follow-up: plugin/shared picker 34/34
  • canonical plugin-authoring skill checks: 14 passed
  • affected Turbo typecheck after final rebase: 5/5 tasks for app and SDK
  • affected Turbo build after final rebase: 5/5 tasks for app, SDK, and generated dependencies
  • affected-package lint: 0 errors (repository baseline warnings only; none in changed picker files)
  • provider-literal ratchet: 140 references across 38 core files
  • SDK npm guard: 0.4.13 is not published and remains available for this release
  • rebased onto current origin/main (d41d1abee41f24b00b62c4c8c716852a17424b5c); the PR branch was updated with force-with-lease

Fixes #1836

BB-Thread-ID: thr_fy2hvyjf8s

AGENT GENERATED

@SawyerHood

SawyerHood commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

🚨 SLOP COP 🚨 · review

I am SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and end-to-end behavior.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

ELI5: This PR lets plugin screens use bb's provider and model menu. One path can save a model before bb confirms it.

Finding

P2: A user can select an unverified Claude model from a provider preview.

Claude can show cached placeholder rows while the verified catalog loads. The automatic provider path correctly waits for verified data. A direct row selection does not wait and calls the plugin's onChange. This behavior breaks the documented SDK guarantee for coherent, verified pairs.

I left an inline comment with the exact path and a test case.

Performance and architecture

  • The disabled shortcut mode still adds three global command handlers for each plugin picker.
  • A provider preview creates two query observers for the same key. TanStack Query shares the network request.
  • The adapter repeats model option conversion from the shared picker and the built-in selection hook.
  • The shared picker renders all visible model rows and updates shared hover state. This design existed before this PR.

These items are not merge blockers for this change. A shared catalog projection helper can prevent future behavior differences.

Checks

  • The security review found no issue.
  • Turbo type checks passed for the app, plugin SDK, plugin build, and templates.
  • Local Turbo tests passed for all four packages. The app ran 2,640 tests.
  • Browser checks passed for desktop selection and the 390-pixel compact drawer.
  • All current GitHub checks passed.

I cannot recommend a merge until the placeholder selection path uses verified catalog data.

@ymichael
ymichael force-pushed the bb/expose-provider-model-picker-to-plugin-apps-thr_fy2hvyjf8s branch from 51bc8cf to 8933fb7 Compare August 21, 2026 19:03
@ymichael ymichael changed the title Expose provider/model picker to plugin apps Expose compact execution picker to plugin apps Aug 21, 2026
@ymichael
ymichael force-pushed the bb/expose-provider-model-picker-to-plugin-apps-thr_fy2hvyjf8s branch 2 times, most recently from da9df5c to a4104e3 Compare August 21, 2026 20:39
@ymichael ymichael changed the title Expose compact execution picker to plugin apps Expose host execution controls to plugin apps Aug 21, 2026
@ymichael
ymichael force-pushed the bb/expose-provider-model-picker-to-plugin-apps-thr_fy2hvyjf8s branch 3 times, most recently from c398ae2 to d767583 Compare August 21, 2026 21:59
@ymichael
ymichael force-pushed the bb/expose-provider-model-picker-to-plugin-apps-thr_fy2hvyjf8s branch from d767583 to 02421e0 Compare August 21, 2026 22:30
@ymichael
ymichael merged commit 3f86b7c into main Aug 21, 2026
13 checks passed
@ymichael
ymichael deleted the bb/expose-provider-model-picker-to-plugin-apps-thr_fy2hvyjf8s branch August 21, 2026 22:53
andrewkchan added a commit that referenced this pull request Aug 22, 2026
now it should be impossible to accidentally change plugin API without
bumping the SDK version

we can delete this if later we decide actually want to iterate faster
without bumping sdk version

## What was wrong

#2270 added `app.slots.commandPaletteAction` — a public plugin API
member —
without moving `PLUGIN_SDK_VERSION`. Pre-1.0 the major is the
compatibility
number and never moves for additive work, so the patch is the only thing
a
plugin author can point `engines.bbPluginSdk` at:
`isPluginSdkRangeSatisfied`
reads that range as a floor within the major. Without a bump, a plugin
using
the new slot has no version to require, so installing it on an older bb
fails
at runtime instead of legibly at load.

Nothing caught it. `version.test.ts` only asserts that
`packages/plugin-sdk/package.json` and `PLUGIN_SDK_VERSION` agree with
*each
other*, never that a surface change moved either. And unlike the
backend, rpc,
and host contracts — each of which has an enumerated export list in
`public-types.test.ts` that a new export forces you to edit —
`app-contract.ts`
has no such list, so nothing about the change was visible in review
either.

The recent history shows the convention is real: 0.4.9→0.4.10 (plugin
styles),
0.4.10→0.4.11 (provider v3), 0.4.11→0.4.12
(`experimental_fullFileContents`),
0.4.12→0.4.13 (quick palette). #2270 is the break in that run, alongside
`3f86b7c80` (#1469), which added 68 lines to `app-contract.ts` with no
bump.

## What changed

- **`packages/domain/src/plugin-sdk-version.ts`,
`packages/plugin-sdk/package.json`**
— 0.4.13 → 0.4.14, keeping the two in the lockstep `version.test.ts`
checks.
- **`.github/workflows/check-plugin-sdk-version.mjs`** — diffs the
branch
against its merge base and fails when it touches a published contract or
  entry file (`app-contract`, `backend-contract`, `host-contract`,
`rpc-contract`, `provider-bridge`, and the `index`/`app`/`host` entries)
without touching the version file. The message names the offending paths
and
what to do. An unresolvable base skips rather than failing on something
the
  author cannot act on.
- **`.github/workflows/version-lockstep.yml`** — runs it as a second
job. It
needs `fetch-depth: 0` for the merge base, so it is a separate job
rather
  than a step on the existing shallow-clone one.

The check is a workflow script rather than a vitest test because the
signal is
a diff against a base commit, which a unit test has no access to. It
follows
the existing `check-version-lockstep.mjs` pattern.

## How you verified

Ran the script against three real branch states:

- this branch (version bumped, no contract change) → "Plugin SDK surface
  unchanged", exit 0
- a scratch branch off `main` touching `app-contract.ts` with no bump →
fails,
  naming the file — i.e. it reproduces exactly the miss in #2270
- the same branch with the bump added → passes

Also confirmed no stale pins: `plugins/*/dist/*.meta.json` carry
`0.4.13` but
are untracked build artifacts that re-stamp on the next build, and
`plugins/tasks` declares `bbPluginSdk: ">=0.4.13"`, a floor that 0.4.14
still
satisfies.

`@get-bb/plugin-sdk` 129 tests and `@bb/server` 1922 tests pass;
typecheck
clean for `@get-bb/plugin-sdk`, `@bb/domain`, and `@bb/server`; the
workflow
YAML parses.

> AGENT GENERATED: by Claude Opus 5

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ymichael added a commit that referenced this pull request Nov 18, 2026
…y switches (#7731)

## Human comments

## What was wrong

AGENTS.md says a plugin API that performs a core action must be the path
core uses, proven by one contract test table run against every surface.
Only part of that was enforced. The view-level panel table
(`test/panel-controller-contract.tsx`) covered panel tabs, not
`openTerminal`, `openFilePreview` or `openUrl`. The terminal and file
tables were hook-level and mocked `reveal`. There was no table for
ThreadScreen consumers, Markdown surfaces or single-pane layout. So
per-surface switches that turn a feature off for plugin surfaces kept
shipping. Each was a small, reasonable-looking exception that no table
asserted against:

- **#7065.** Plugin thread actions got `experimental_panel` routed to
the focused surface, but their `navigate` came from the app-level
context in `ThreadActionsProvider`, outside every view's navigation
host. From a header thread action, `experimental_openTerminal`,
`experimental_openFilePreview` and `openUrl` returned `false` and did
nothing. The issue's suspected cause (`reveal: openCompactDrawer`) is
not it: that is the same function as `openDrawer`, and terminal
selection already writes `isOpen: true`. That is also why SlopCop's
in-view test did not reproduce it.
- **#2967.** `PluginThreadChat` passed `includePluginMessageActions:
false`, so slot-registered message actions never showed in an embedded
ThreadChat.
- **#7277.** `SplitThreadArea` kept a single pane mounted across the
compact breakpoint only for the `thread` and `new-thread` kinds. A
plugin page swapped between `StandalonePaneContent` and
`WorkspacePaneContent` and lost its DOM and React state.
- **#5340.** `PluginNewThreadComposer` started an unseeded composer on
`null` (the personal project) instead of the remembered New thread
project.

### Earlier issues and fixes from the same root cause

This is the 20th fix in the class. Each earlier one patched a single
surface:

- **Fix PRs:** #1469, #1518, #2026, #3147, #3752, #3867, #3968, #4331,
#4693, #4954, #5128, #6104, #6269, #6291, #6387, #6752, #6754, #6756,
#6763 and #7060.
- **Closed issues:** #1836, #2288, #3395, #4323, #4438, #4480, #4501,
#4951, #6071, #6268, #6289 and #7015.

The open issues the tables catch today are #7065, #2967, #7277 and
#5340. #6311 is covered by the Markdown table, which already passes
because #6405 removed the closure chain.

## What changed

**Guards (written first; each failed on main for the past case named):**

- **Panel table.** `test/panel-controller-contract.tsx` gains three
rows: open a terminal, open a file preview (reusing the tab for the same
file), and open a URL in the in-app browser. Each row must select the
tab and reveal a closed panel. The table runs on the thread view, thread
header row, **thread header action** (new row), New thread screen and
plugin page. On main the header-action row failed all three (#7065).
- **ThreadScreen table.** New `ThreadScreen.surface-contract.test.tsx`
runs against the thread page and plugin ThreadChat full, compact and
timeline. It uses real timeline rows. Every row must show
slot-registered message actions, and every composer must receive the
thread's context-window usage. On main the three ThreadChat rows failed
(#2967). Context usage already passed on every row, so that half of
#2967 was fixed by #6387.
- **Markdown table.** New `markdown-surface-contract.test.tsx` runs
against assistant messages, plugin `Markdown` and plugin document
`Markdown`. It checks thread-token mentions, web-link routing through
the surface's navigation host, and `<video>` identity when the
navigation host changes. It passes on main and guards #6311 and #6756.
- **Single-pane table** in `SplitThreadArea.test.tsx`. Thread, New
thread and plugin page panes must keep their DOM nodes and unsaved state
across four breakpoint crossings. On main the plugin page row failed
(#7277).
- **#5340 test** in `PluginNewThreadComposer.test.tsx`. An unseeded
composer must start on, and submit, the project the user picked in bb's
New thread view. It failed on main.

**One owner, copies deleted:**

- `lib/app-navigation-host.tsx` gains `AppNavigationSurfaceProvider`.
Each surface now registers its *resolved* navigation host while it has
focus: the thread view, New thread, plugin page and Plugins.
`getFocusedAppPanelController` is derived from that registry. The
panel-only `focusedControllers` registry and the `isFocused` argument to
`useAppPanelController` are deleted.
- `ThreadActionCollectors` wraps collectors in
`FocusedAppNavigationSurfaceProvider`. Thread actions' `navigate.open*`
now reaches the same focused surface as their `experimental_panel`. When
no surface has focus, it falls back to the app-level host.
- `includePluginMessageActions` is deleted end to end:
`ThreadScreenTimelineHost`, `ThreadTimelineSurface`,
`ThreadTimelineRows`, `PluginThreadChat` and `ThreadDetailView`.
- `keepsSinglePane` is deleted from `SplitThreadArea`: any single pane
stays in `WorkspacePaneContent`.
- The duplicate `PLUGIN_MARKDOWN_THREAD_MENTIONS` and
`ASSISTANT_THREAD_MENTIONS` constants are merged into one
`AUTHORED_MARKDOWN_THREAD_MENTIONS` exported from
`markdown-preview.tsx`.

**Follow-up from the independent review: missing host fields and
untested panel contexts.**

- **Required host fields.** Every `ThreadScreenTimelineHost` and
`ThreadScreenComposerHost` field is now required (`ThreadScreen.tsx`),
so each surface must state each handler or an explicit `null`. A host
field a surface leaves out now fails typecheck.
- **Shared title actions and environment rules.** New
`thread-screen-hosts.ts` owns the timeline title-action resolver and the
thread environment rules (context environment, reusable environment).
ThreadDetailView and plugin ThreadChat both use it.
- **What plugin ThreadChat newly gets, matching the thread page:**
- Clicking a tool title opens the diff or file, a local file, or a side
chat. On main, `onTitleAction` was missing, so these clicks did nothing.
- The context row above the composer still receives no environment
(`contextEnvironmentId: null`), as on main, so a side chat does not
repeat its parent thread's changed-files row. An opt-in prop for it was
dropped because no plugin used it.
  - "New thread in this environment" is available.
- The unread divider is shown. It now uses the same
`useThreadUnreadDividerState` as the page, and read tracking waits for
the divider, as on the page.
- **ThreadScreen table.** The page row now mounts the real
`ThreadDetailView`, not a hand-built `ThreadScreen`. Two rows were
added: opening a changed file from its timeline title, and the composer
receiving the new-thread action and each surface's expected context
environment (the thread's on the page, none in embedded chats). On
main's `PluginThreadChat`, these fail 5 of 11 rows.
- **Panel table.** New rows for **thread message actions**, **command
palette commands** and **thread new-tab plugin actions**, alongside the
existing surface rows. `CommandPalette` now builds plugin commands
through one `buildFocusedSurfacePaletteActions`, which the table also
uses. The table gains `actionTabs` and `navigation` support flags,
because those three contexts receive only a panel. The **Plugins view**
gets a test that its panel declines every plugin tab without changing
its tabs.
- **Panel tab renderers.** `ThreadTerminalPanel`'s `onOpenLink` and
`onSelectionAddToChat` are required, so each of the three panel tab
renderers must state them. The plugin page's terminal had no
`onOpenLink`; its links now route through that page's in-app browser, as
on the thread and New thread surfaces. I did not merge the three
renderers into one. Their file-preview cases depend on different surface
scopes, and the shared parts are now enforced by types.

**SDK (backward compatible):**

- The JSDoc for `PluginMessageActionRegistration` and
`ThreadChatMessageAction` no longer says embedded ThreadChat hides slot
actions.
- `ComposerCustomization.actions` documents where actions render: the
expanded composer, not the collapsed single-line one.
- `defaultProjectId` documents the remembered-project default.
- New optional `PluginMessageActionRegistration.experimental_surfaces`
(type `ExperimentalMessageActionSurface`): `"thread-view"` is bb's
thread view and `"embedded-chat"` an embedded `ThreadChat`, matching the
SDK docs' wording (`"thread"` alone already means any thread composer in
the composer host's `surface`). Omitted, an action shows on both. The
collector fills that default and rejects an empty or unknown list. It
has an entry in `docs/api_to_audit.md`, on the Plugin Guide's message
actions card (whose stale "main timeline only" bullet is replaced) and
in the bb-plugin-authoring skill, which no longer says embedded
ThreadChat hides slot actions.
- `@get-bb/plugin-sdk` is set to 0.6.161, above main's 0.6.160.
- No wire changes and no CLI changes.

**Message action surfaces (review follow-up):**

- With decision 2, Side chat's own "Reply in side chat" also showed
inside a side chat and in other plugins' embedded chats. Its side chat
tab only exists in the thread view's panel, so on a plugin page it would
create a side chat thread and then fail to open it.
- Each `ThreadScreen` host now states `messageActionSurface`
(`ThreadDetailView` `"thread-view"`, `PluginThreadChat`
`"embedded-chat"`). The timeline reads slots through one hook,
`useSurfaceMessageActionSlots` (`lib/message-action-surface.tsx`), so
every surface filters the same way. This is a filter the registration
owns, not a per-surface switch.
- Side chat registers `experimental_surfaces: ["thread-view"]`. Every
other message action keeps showing in embedded ThreadChat.
- The ThreadScreen table gains a row: an action limited to one surface
shows only there, on all four surfaces. An SDK collector test covers the
default and the validation.

**Not deleted:** `PluginNewThreadComposer`'s
`selectionScope="component-local"`. That switch decides whether SDK
seeds (`defaultProviderId`, `defaultModel`, `defaultEnvironment`, …)
beat core's remembered picks. Switching to the `"new-thread"` scope
would override third-party plugins' seeds and write plugin picks into
core's New thread preferences, and an existing test pins that
separation. This PR fixes only the #5340 project fallback. The
seeded-but-unknown project id case resolves to personal exactly as a
stale remembered id does in core's New thread view, so it is parity and
left unchanged.

## Decisions for review

1. **Thread actions route open\* to the focused pane.** This applies to
header actions and to thread actions run from menus for other threads (a
sidebar row's menu, the New thread screen's recents on a phone, or a
plugin's `experimental_ThreadActionsMenu`). It matches how
`experimental_panel` was already routed. Run from thread A's menu while
thread B has focus:
- `experimental_openTerminal` with A's terminal returns `false`, because
B's panel accepts only B's terminals (`acceptsThreadTerminal`).
- `experimental_openFilePreview` and `openUrl` open in B's panel. A file
preview is addressed by environment and path, not by thread.
- On main, all three returned `false` from every thread action, the
header included. Opening A first and then the tab in A's panel would
need a new "open a thread with a panel tab" path (see decision 7).
2. **Embedded ThreadChat shows every slot-registered message action**,
including compact side chats. Actions that need a thread-context tab
receive the embedding page's panel. That returns `false` where the tab
does not exist, as #2967 asks.
3. **The collapsed single-line composer still leaves plugin actions
out**, as on main. It leaves out bb's own `+` menu and model picker too;
all of them show once the composer expands. An earlier version of this
PR showed plugin actions in the collapsed composer for #3358, but even
with a scrolling strip it crowded the one-line composer on phones, so
that change was reverted and #3358 stays open.
4. **An unseeded plugin NewThreadComposer starts on the remembered New
thread project.** It reads that project but never writes it.
5. **A single plugin page or Plugins pane is no longer remounted at the
compact breakpoint.** On compact it renders through the workspace pane,
with the same close button as before.
6. **"Reply in side chat" stays out of embedded ThreadChat, including
side chats.** Side chat limits its action to bb's thread view with
`experimental_surfaces: ["thread-view"]`. Embedded ThreadChat cannot
open its side chat tab, and a side chat inside a side chat is not
wanted. Other plugins' message actions still show in embedded
ThreadChat.
7. **A side-chat title on a surface whose panel can't host the side chat
opens the side chat thread itself.** Opening the source thread with the
side chat tab would need a new "open a thread with a panel tab" path;
this uses the existing thread navigation instead.
8. **Plugin ThreadChat's thread-info button is left off
(`onOpenThreadInfo: null`).** Thread info is a fixed tab in the thread
page's side panel. From a plugin page, the button would open nothing, so
it is left off.
9. **The standalone plugin model picker keeps
`commandShortcutsEnabled={false}`.** ⇧⌘M toggles the focused composer's
picker, and every composer, plugin composers included, gets it through
`ExecutionControls`. A form-control picker that also grabbed ⇧⌘M would
make the shortcut ambiguous.
10. **The plugin page's new tab keeps `showFileSearch={false}` and a
no-op `onSelect`.** A plugin page has no project, environment or thread,
so there is nothing to search and no recents to select; `onSelect`
cannot fire.
11. **The Plugins view's panel accepts no plugin tabs.** It has no
plugin tab destinations, so a plugin command run there gets a panel that
declines every tab. The new test pins this.
12. **Embedded ThreadChat now shows the unread divider and marks the
thread read once the divider is ready**, the same order as the thread
page. Before, it marked read immediately and showed no divider.

## How you verified

### Live verification (isolated source dev instance, verify-bb)

These ran on the source dev web app at this branch, before the rebase,
with a fresh data directory and the connected local host. A probe plugin
registered three header thread actions (open a terminal, a file and a
URL), a slot message action, three composer actions, and a page holding
ThreadChat full and compact plus an unseeded
`experimental_NewThreadComposer`. A Claude Code Haiku thread produced
the assistant messages. Screenshots and measurements are kept locally.

1. **Header thread actions.** Pass in the web client; the in-app browser
case was not run.
- 1400×900 with the right panel closed: "Probe open terminal" returned
`true`, the panel opened, and a zsh terminal tab was selected.
- With the panel closed again, "Probe open file" returned `true`, the
panel opened, and the README.md preview was selected.
- "Probe open URL" returned `true` and opened
`https://example.com/probe` externally. The web client has no in-app
browser, so the Electron in-app browser path was not run live; the
contract table covers it.
2. **Plugin message actions in embedded ThreadChat.** Pass.
- On the probe page, both ThreadChat full and compact show "Probe
message action" on the user and assistant messages.
- In a real side chat (compact ThreadChat, opened with "Reply in side
chat"), after one reply the assistant message shows "Probe message
action" next to "Send to main thread". After the surfaces follow-up, a
rerun on the rebased branch shows 0 "Reply in side chat" inside the side
chat; the thread page still shows it on both messages. See decision 6.
3. **Plugin actions on a phone (375×812, touch).** The collapsed
composer shows no plugin actions, as on main. After tapping it, the
expanded composer shows all three probe actions before the mic.
4. **Remembered project in an unseeded plugin composer.** Pass.
- After picking Fixture in bb's New thread view, the plugin composer
showed "Project: Fixture", and it still did after a reload.
- After picking No project in New thread, the plugin composer showed
"Project: No project".
5. **Single plugin page across the compact breakpoint.** Pass.
- I typed into the page's input and selected characters 2–6, then
resized 1024 → 767 → 768 → 700 → 1024.
- Throughout, the same input and page nodes stayed, with the same mount
id, the value "unsaved plugin form", focus, and the selection `[2,6]`.
The compact page shows the close button.

### Live verification of the review follow-up (second run, isolated dev
instance and desktop app)

The second run used a fresh dev instance from this branch (`ae6db4b0d34`
plus the side-chat fix below). The URL check also used the source
desktop app (Electron) attached to the same instance and driven over
CDP. Each check compares plugin ThreadChat on the probe plugin's page
with the thread page. The fixtures were Claude Code Haiku threads:
- an "Edits" thread that changed a workspace file (`README.md`) and a
file outside the workspace (`/tmp/.../outside-note.txt`);
- a side chat whose reply was sent back to the main thread;
- two threads that were marked read and then got an unread reply.

1. **Tool title opening a changed workspace file.** Match.
- On the thread page, clicking `README.md` opened a README.md preview
tab in the thread's panel.
- In plugin ThreadChat, it opened the same preview in the plugin page's
panel.
- On both, the git Diff tab declines this file target, so both fall back
to the file preview.
2. **Tool title opening a file outside the workspace.** Match.
`outside-note.txt` opened a host-file preview in each surface's own
panel.
3. **Side-chat title ("Message from side chat").** Mismatch found and
fixed.
- On the thread page, clicking it opened the side chat in the thread's
panel.
- In plugin ThreadChat, it did nothing: the plugin page's panel has no
thread side-chat tab.
- Fix: the shared resolver now opens the side chat thread itself when
the surface's panel declines the tab. After the fix, plugin ThreadChat
navigates to the side chat thread; the thread page is unchanged and
still opens it in its panel. Covered by `thread-screen-hosts.test.tsx`.
- Related finding, already on `main` and not caused by this PR: both
surfaces label the row "Message from Agent", with no link, until the
hidden side-chat thread is in the query cache. Sender metadata is read
only from cached threads. After a reload with the side chat tab closed,
the thread page shows the same unlinked label. Not changed here.
4. **"New thread in this environment".** Match.
- The thread page opened New thread with project Fixture and "Reuse"
selected.
   - Plugin ThreadChat, about 920 px wide, did the same.
- In a probe column about 250 px wide, the composer's environment row is
clipped. This comes from the narrow container; the side chat tab at
about 520 px shows the row.
5. **Unread divider.**
- Thread page (thread C): the "NEW" divider sits above the unread second
reply.
- Plugin ThreadChat full and compact (thread B): the divider sits in the
same place.
- On both, the thread stayed unread until there was user activity (mouse
and keyboard input), then `lastReadAt` advanced and the divider stayed
on screen. Read timing matches.
6. **Plugin-page terminal link (desktop app).** Match.
- On the plugin page, ⌘-clicking `https://example.com/terminal-link` in
a panel terminal opened an in-app browser tab ("Example Domain") in the
plugin page's panel. On main this link had no handler on the plugin
page.
- On the thread page, the same click opened the same in-app browser tab
in the thread's panel.

### Tests and checks

- After rebasing onto main (`28cdd915db4`) and dropping
`experimental_environmentContext`: `typecheck lint` pass for `@bb/app`,
`@get-bb/plugin-sdk`, side chat and plugin-api-docs; the 15 changed app
test files pass (533 tests, 16 skipped); plugin SDK (439), side chat
(27) and plugin-api-docs (75) tests pass; the plugin SDK version check
passes. A live rerun on the rebased build showed "Probe message action"
in both the thread page and embedded ThreadChat, with "Reply in side
chat" only on the thread page.


- Each guard was run against main's version of the changed component and
failed as described above. All guards pass with the fix.
- A targeted run of the 35 affected test files passed after the review
follow-up: 1,112 tests, with 16 skipped.

- `pnpm exec turbo run typecheck lint --filter=@bb/app`: pass. The
composer plugin lint shows 4 warnings, all of which were already there.
- `node apps/app/scripts/check-bundle-budget.mjs` after the rebase: the
boot payload is 418.6 KB brotli against a 419.1 KB budget.
- The first CI run's other failures were 15 s timeouts in `@bb/logger`
(Windows) and `@bb/db` resolved-item pruning. This PR touches neither
package.
- Not run on a native iOS or Android device, and not in the Electron
in-app browser.
- After rebasing on main and adding message action surfaces: the 15
affected app test files pass (651 tests, 16 skipped);
`@get-bb/plugin-sdk` typecheck, lint and tests pass (39 files);
side-chat and plugin-api-docs tests pass; `typecheck lint` pass for
`@bb/app` and both plugins; the boot bundle budget passes.

Fixes #7065
Part of #2967. Gaps 1 and 2 are covered; gap 3, the per-chat identity
seam for content scripts, is not in this PR.
Fixes #7277
Part of #5340. The unseeded-project half is fixed; the unknown-seed half
is kept as parity, as explained above.

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

> AGENT GENERATED

---------

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.

Plugin apps cannot reuse bb's provider/model picker

3 participants