Skip to content

Thread action registry: one registration shape for bb's and plugins' thread menu actions - #5243

Merged
ymichael merged 13 commits into
mainfrom
bb/thread-action-registry-v1-thr_dessxnxvus
Oct 9, 2026
Merged

ymichael merged 13 commits into
mainfrom
bb/thread-action-registry-v1-thr_dessxnxvus

Conversation

@ymichael

@ymichael ymichael commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Core's thread header menu (apps/app/src/components/thread/ThreadActionsMenu.tsx) and the thread-list plugin's row menus (plugins/thread-list/app/rows/ThreadActionsMenu.tsx) each hardcoded the same eight actions, so the two drifted and no plugin could add an entry. Earlier registry attempts paid for it per sidebar row: hooks per row (about 40 observers per row on a 100-row sidebar) or a server-side resolve with round trips and stale labels. This is step 1 of the thread action registry plan: a registry whose cost scales with the number of registered actions, never with rows. It supersedes #5145.

What changed

API (@get-bb/plugin-sdk/app, SDK 0.6.34, all experimental and listed in docs/api_to_audit.md)

  • app.slots.experimental_threadAction({ id, title, icon, group, order?, useData?, item }). useData is a hook the host runs once for the whole app, in one collector per registration under ThreadActionsProvider. item({ thread, data, sdk, navigate }) is pure and returns the action for one thread, or null. Placement (group, order) is static. The host keeps registrations sorted by group string, then order, then registration order, and menus put a separator between groups. bb's groups are experimental_THREAD_ACTION_GROUPS (1_open, 2_organize, 3_settings, 4_lifecycle).
  • An action is { label, icon, variant?, disabled?, choices?, run({ value, requestRename }) }. choices is data: a submenu on desktop, a drawer step at compact width, a popover from a row quick-action button.
  • experimental_useThreadActions(thread, { keys?, requestRename? }) returns entries whose run(value?) is already bound to the caller's rename editor, never throws, and resolves when the action settles. experimental_useThreadActionRegistrations() lists every registration's static title and icon in menu order.
  • experimental_ThreadActionsMenu and experimental_ThreadActionsContextMenu are bb's menus. The context menu opens on right-click, and on long-press at compact width. Both take inline items ({ key, group, action }) and requestRename. trigger is a render function that must spread PluginThreadActionsTriggerProps (props, ref, className) onto its button. The host logs a trigger that drops them, and the SDK test fake throws.
  • useBbNavigate().toThread(id, { split }) and toCompose({ projectId, placement, environmentId, hostId, … }). experimental_useArchiveEnvironmentThreads() returns core's own environment-archive flow.
  • The bound SDK gains optimistic threads.markRead / markUnread.
  • experimental_useSidebarThreadActions, PluginSidebarThreadActions, and the testing harness's SidebarActionCall / inspection.sidebarActionCalls are tagged @internal, like useComposerView: they are gone from the published declarations, so upgrading plugins get type errors, while the runtime keeps exporting the hook, so installed plugins and host builds of plugins that still import it keep working. Nothing in the repo calls it.
  • Archive, Delete, and bb's rename dialog fetch a thread bb has not cached (a plugin rendering the menu for a thread it fetched itself) instead of doing nothing. A registration's navigate.openThreadPanel opens in the focused thread view, as plugin commands do.

Core. bb's eight actions (Open in split, New thread in environment, Copy thread link, Mark read/unread, Pin/Unpin, Rename, Archive/Unarchive, Delete) are registrations of the public shape under the reserved bb--core owner (apps/app/src/lib/thread-actions/). The header menu, mobile recents, both sidebar row menus, and the archive keyboard command all go through the registry. The header edits its title inline from the menu and from the rename command. Core's ThreadSectionMoveProvider, useMoveThreadToSection, and useUnpinAndMoveThread are deleted.

Thread list. It registers Move to section (thread-list/move) from its own section-order and organization preferences. Rows render the host menus with a "Customize row actions" inline item and the row's inline rename. Hover quick actions come from experimental_useThreadActions with keys, and the picker lists registrations. rowActions stores <owner>/<id> keys; bare legacy ids and core/<id> migrate on read and write. The row-action model, the section-move provider, and the plugin's menu fork are deleted.

Also fixed: a pre-existing race when archiving an environment while one of its threads was in a split beside an unrelated thread. The split area's stale-pane watcher could prune the archived pane before the provider ran, and the provider then navigated away from a stale route, closing the unrelated pane (7/7 on main). The environment archive now runs as an archive_thread mutation like thread archive, so the watcher waits and the provider closes panes deterministically.

No server or daemon wire changes. Docs: docs/api_to_audit.md, docs/configuration.md, the thread-list skill, the plugin-authoring references, and the Plugin Guide surface.

Accepted deviations from main (all accepted by Michael):

  1. The header menu's Rename edits inline on desktop, as does the rename keyboard command (the dialog remains at compact width).
  2. Open in split is hidden for the thread in view and reads "Focus split" for a thread open in another split pane, on every surface.
  3. The row-actions picker lists every registration, which adds Delete and New thread in environment.
  4. Mobile recents long-press gains New thread in environment.
  5. Row quick-action buttons are labelled with the action label (Archive, Unarchive), not Archive thread / Unarchive thread.
  6. A failed sidebar inline rename shows its error in the editor, without the extra toast.
  7. A failed drag-to-pin toasts the drop's failure message instead of "Failed to pin thread.".
  8. Phone thread-menu drawers are announced as "Thread actions" instead of "Menu".

How you verified

  • One contract test table (apps/app/src/components/thread/ThreadActionsMenu.test.tsx) runs four surfaces against the same registrations: desktop dropdown, desktop context menu, compact drawer, and compact long press. It checks items and order per thread state (top-level, archived, pinned, unread child, already in view, compact), each action's effect, the surface rename editor versus bb's dialog, a throwing registration, a trigger that drops its ref or classes, and registration order.

  • Thread-list tests cover quick actions, Customize, inline rename from both menus, Move destinations and the unpin-then-move writes, and the rowActions migration. SDK harness tests cover the fake menu's trigger contract.

  • SplitThreadArea.environment-archive.test.tsx resolves the archive at the moment a pane is pruned. It failed 3/3 before the fix and passes after.

  • pnpm exec turbo run typecheck lint test --filter=@bb/app --filter=@get-bb/plugin-sdk --filter=./plugins/thread-list --filter=./plugins/plugin-api-docs --filter=@bb/server passes (lint: 0 errors). In the gate run, three install-machine-script server tests failed while a pnpm install ran alongside; the server suite passes alone (3398). turbo run typecheck --filter='...[25111165da]' (89 packages) and all plugin test suites (46 tasks) pass.

  • Manual verification in two rounds on a dev instance against main: thr_c6z735wvsd and thr_paxegndau4. The second round passed:

    • Row "..." on desktop and on archived rows, items identical to main.
    • Keyboard open, focus, and Escape.
    • Trigger accessibility attributes match main.
    • Narrow-width drawer with the Move step.
    • Picker order with Move between Pin and Rename.
    • Environment-group archive with Undo.
    • Legacy rowActions values restored, and UI and CLI writes persist the new keys.

    Its findings (the trigger's lost select-none and the split race) are fixed here.

Sidebar benchmark (BB_SIDEBAR_BENCH=1, 3,000 threads, 81 rendered rows; median of 8 alternating runs). The branch's bench mounts core's collectors and the thread-list Move registration as the app does:

metric main 2511116 this branch
mountMs 481 467.5
statusPatchMs 145 139.5
membershipRefetchMs 118 97.5
pinMs 152.5 148
React Query observers 1146 821
observers per rendered row 14.15 10.14

🤖 Generated with Claude Code

AGENT GENERATED

ymichael and others added 10 commits October 8, 2026 20:31
Core's thread header menu and the thread-list plugin's row menus each
kept their own copy of the same actions, and no plugin could add a row.
`app.slots.experimental_threadAction({ id, title, resolve })` describes a
thread action as data: a leaf with `run` or a choice list with `select`,
grouped open / organize / lifecycle. `resolve` receives the thread
target, the surface, the plugin's own thread metadata row and a
plugin-bound rpc client; the host refetches that metadata after the
action settles. `experimental_useThreadActions(target, surface)` returns
the ordered core + plugin list and is public so replacement thread lists
render the same menu.

The seven core actions are defined with the same type. Both menus render
from the hook across dropdown, context menu, compact drawer step and
sidebar quick-action button surfaces; the duplicated section-move
submenus and row action model are deleted. `rowActions` stores action
keys (`core:archive`, `<pluginId>/<id>`) with a read-side migration of
the legacy ids.

The thread-list plugin stores `organizationMode` and
`manualSectionOrder` in core UI preferences again, with a one-time
reverse migration from its KV, so the host section-move context and the
sidebar reveal read live values instead of the stale copy left behind by
the earlier migration.

Cherry-picked from 57abced onto main. The thread-list half (row menu,
customize picker, reverse preference migration) conflicted with main's
inline row-actions customizer and is dropped here; the registry rework
that follows migrates the plugin to the plan's API instead.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Cherry-picked from 37a1e76; main had already reached 0.6.33.

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

Registrations are { id, title, icon, useData?, item }: useData runs once
per registration in a host collector mounted in AppLayout, item is a pure
function of the thread and that data, so sidebar rows pay one store
subscription and a pure call per registration instead of per-row hooks.
Core's eight actions are registrations of the same shape under the core
owner; the thread-list plugin registers Move to section from its own
preferences. Header, mobile recents and sidebar rows render the host
experimental_ThreadActionsMenu / ContextMenu; row quick actions and the
customize picker read experimental_useThreadActions and
experimental_useThreadActionRegistrations. BbNavigate gains
toThread(id, { split }) and the toCompose placement options; the bound
SDK gains optimistic markRead/markUnread. Tests follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One contract table runs the desktop dropdown, desktop context menu,
compact drawer and compact long press against the same registrations:
items and order per thread state (archived, child, pinned, unread,
already open, compact), each action's effect, the surface rename editor
versus bb's dialog, and a throwing registration. The collectors now
mount inside ThreadActionsProvider, which owns the rename dialog, and the
header's inline rename covers the menu and the rename command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The row tests cover what the row still owns: quick-action buttons from
experimental_useThreadActions (order, width, pending state, missing keys),
the inline Customize item, inline rename from the menus and the Rename
button, and split on modifier-click. Move to section gets its own tests
for destinations, hidden states, and the unpin-then-move writes. The SDK
test fakes for the thread menus open on trigger click or right-click and
close after an item runs, so plugin tests exercise their rename wiring.
rowActions stores <owner>/<id> keys and migrates bare ids; the
configuration guide, thread-list skill, plugin-authoring references,
Plugin Guide surface, and api_to_audit entry describe the new API, and
experimental_useSidebarThreadActions is listed for removal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rows now read their quick actions from the registry, so the benchmark
mounts core's collectors and the thread list's Move registration the way
the app does, and reports React Query observers per rendered row
alongside the timings.

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

The thread list's row trigger was a component that dropped the props
and ref Radix's asChild trigger hands it, so row menus never opened.
experimental_ThreadActionsMenu now takes trigger as a render function
that receives PluginThreadActionsTriggerProps; the host logs when the ref
is never attached and the SDK test fake throws, so tests catch a trigger
that drops them.

Placement is static: group and order move from the evaluated action to
the registration (and inline items), the host keeps registrations in
menu order, and the row-actions picker lists them the way the menus do,
with Move between Pin and Rename as on main.

bb's own actions use the reserved bb--core owner; rowActions migrates
bare ids and core/<id> keys on read and write.

The thread list's environment-group archive moves to
experimental_useArchiveEnvironmentThreads, which returns core's own
archive flow (pane cleanup, route repair, Undo toast), so the deprecated
experimental_useSidebarThreadActions has no callers left in the repo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The row and header triggers set className after spreading the trigger
props, replacing the host's classes (select-none). They now merge
props.className. The host reports a trigger that drops host classes, and
the SDK fake throws for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Archiving an environment while one of its threads sat in a split beside
an unrelated thread could close the unrelated pane too. The environment
archive was a plain SDK call, so the split area's stale-pane watcher saw
the optimistically archived thread with no archive in flight and pruned
its pane first, moving focus and the route to the survivor. When the
archive request resolved before the provider's viewed-thread ref caught
up with that route change, closePanesForThreads found nothing to close
and the provider navigated away from the stale route, dropping the
survivor. Thread archive avoided this because it runs as an
archive_thread mutation, which the watcher waits for.

The environment archive now runs as an archive_thread mutation too, so
the watcher leaves its panes alone and the provider closes them and
moves focus deterministically. The new test resolves the archive at the
moment a pane is pruned, which reproduced the bug every run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
qa and others added 3 commits October 9, 2026 10:20
Open in split was hidden for every thread already open in a pane. It now
stays hidden only for the thread in view (the focused pane, or the route
thread without a split) and reads Focus split for a thread open in another
pane; running it focuses that pane, as openThreadInSplit already did.

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

Archive, Delete and bb's rename dialog looked the thread up in bb's
caches and silently did nothing on a miss, so a plugin rendering the
host menu for a thread it fetched itself got dead items. They now fetch
the thread on a miss and toast if that fails.

A registration's navigate came from the app-level collector, outside any
thread view, so openThreadPanel always returned false. Thread actions now
open panels through the focused thread view's opener, as plugin commands
do.

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

Like useComposerView, experimental_useSidebarThreadActions,
PluginSidebarThreadActions and the testing harness's SidebarActionCall /
inspection.sidebarActionCalls are tagged @internal: stripInternal drops
them from the published declarations, so a plugin that upgrades its SDK
gets type errors, while the runtime keeps exporting and implementing the
hook, so installed plugins and host builds of plugins that still import
it keep working. The export parity test lists it as runtime-only, and the
plugin-authoring references teach useBbNavigate, useSdk().threads and the
thread action menus in its place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit f549a09 into main Oct 9, 2026
48 checks passed
@ymichael
ymichael deleted the bb/thread-action-registry-v1-thr_dessxnxvus branch October 9, 2026 17:42
ymichael added a commit that referenced this pull request Oct 9, 2026
…5246)

## Human comments

## What was wrong

Push notifications had only server-wide channel toggles. Users could not
mute one thread, quiet the workers under a coordinator, or keep
approvals while skipping finished-turn pushes (#1446, Discord
2026-09-29). This is step 2 of the thread action registry plan,
following #5243 (merged): the first plugin registration in
`experimental_threadAction`. A per-thread setting also exposed a gap in
step 1's API. A registration had no way to know which threads are on
screen, and core had no way to read one plugin's metadata for many
threads in one request. Without those, a plugin either loads every
thread or fetches per row.

## What changed

Ten commits; the first four change core or the thread list and can be
reviewed on their own, and the last four are review follow-ups (items
7–10).

1. **Batched metadata read (core).** `POST /threads/plugin-metadata`
takes `{ pluginId, threadIds }` (1–200 ids). It runs one `WHERE
plugin_id = ? AND thread_id IN (…)` query on the table's primary key, so
no new index or migration. Archived and deleted threads are included,
and corrupt namespaces are omitted and logged. The core SDK exposes it
as `threads.experimental_listPluginMetadata({ pluginId, threadIds })`.
The plugin-bound SDKs (backend `bb.sdk`, app `useSdk()`, fake host)
default `pluginId` to the caller and accept another plugin's id, like
`getPluginMetadata` and `updatePluginMetadata`. The route trusts
`pluginId`, like the existing single-thread metadata routes, because app
requests carry no plugin identity. That is listed as an audit item for
all three routes.
2. **`useData({ threadIds })` (core).** The registry reference-counts
the thread ids named by `experimental_useThreadActions` callers: sidebar
rows on screen, the open thread's header, and open menus. It publishes
them sorted and deduplicated, once the set has been quiet for 32 ms (at
most 100 ms after the first change), so rows that mount a frame apart
during a scroll step arrive in one change. A surface counts only while
visible: `AppSidebar` wraps the thread list in
`ThreadActionSurfaceVisibility`, visible when the app body is shown and
the sidebar (or compact drawer) is open. A hidden sidebar on a settings
route therefore contributes no ids, even if a plugin list mounts rows.
The ids live in their own store that only the collectors read, so
scrolling re-renders one collector per registration, not the rows. bb's
own `useData` hooks take no arguments and are unaffected. The
registration docs make this the recommended pattern for per-thread data
until an attributes layer lands.
3. **Hidden thread list mounts no rows (thread-list plugin).**
`SidebarWindowedItems` treated a zero-height scroll container as
"realize every row", and pinned threads render outside the windowing. So
a direct load of a settings route mounted every row behind the hidden
sidebar. A zero-height container now realizes nothing, and the
IntersectionObserver realizes visible rows once a resize gives it
height. Environments without IntersectionObserver keep promote-all. The
pinned tree waits for `useSidebarListShown`, which follows the
container's height with a ResizeObserver.
4. **Select option labels (core).** `PluginSettingDescriptor` select
settings can declare `experimental_optionLabels` (value → label). The
settings form shows the label in the picker and as the current value,
while stored values, defaults, `settings.get()` and `bb plugin config
set` keep the option values. A label for a value that is not an option
is refused at define time. The level selects use it: All activity, Needs
input only, Muted, Same as default.
5. **Notification levels (push-notifications plugin).** A level is
`all`, `input-only` or `muted`. Defaults fill gaps and ancestors cap. A
thread uses its own level, else `childLevel` if it has a parent (default
`input-only`, which matches today's rule that child threads never push a
finished turn), else `defaultLevel` (default `all`). Every ancestor's
own level caps the result: muting a coordinator mutes its whole subtree,
a worker set to `all` beats the child default, and a parent set to `all`
never makes an unset worker louder. Thread plugin metadata stores only a
thread's own level, `{ own }`, and only when one is set; the limit from
ancestors is worked out on every read from the current tree (item 10).
The CLI says "limited by parent" when that ancestor is the direct parent
and "limited by an ancestor" otherwise. One pure resolver serves the
sender, the CLI and the app, so changing a default rewrites nothing. The
registration sits in `THREAD_ACTION_GROUPS.settings`; its `useData`
keeps an id-keyed cache and fetches only uncached `threadIds` through
`threadNotifications.list` (200-id batches). It applies the
`threadNotifications` realtime channel per id. After a reconnect it
refetches the threads on screen and drops cached levels for the rest, so
they load fresh when shown again. `item` resolves the level (shown as
described in item 9), and `run` calls `threadNotifications.set`. Nothing
is fetched per row. CLI: `bb push-notifications thread <thread> [--level
inherit|all|input-only|muted] [--json]`, and `status` shows both
defaults.
6. **SDK 0.6.36**, with push-notifications' `engines.bbPluginSdk` floor
raised to match.
7. **Consistent plugin id on metadata reads (core).** The bound batched
read takes an optional `pluginId`, like the single-thread reads, instead
of always forcing the caller's namespace.
8. **Reconnect staleness fix (push-notifications).** A reconnect used to
keep cached levels for off-screen threads, and the fetch when they came
back skipped ids already cached, so a level changed during the
disconnect stayed stale until reload.
9. **Current level on the menu entry (core + push-notifications).** The
submenu repeated its trigger as a heading, and its hint ("Default (All
activity)") was the same size as the choices and sat right above
"Default", so it read as an extra option. The entry itself never showed
the level. Thread actions gain `detail`, a muted second line under the
label; a quick-action button's tooltip shows "Label: detail". Desktop
submenus no longer draw `choices.heading`, because the trigger names
them; the phone drawer step and the quick-action popover still use it as
their title. `choices.hint` is now a footnote below the choices, after a
separator. Notifications sets `detail` to the effective level and
switches its icon per level: two SVGs declared in the plugin manifest,
`push-notifications/ringing` and `push-notifications/off`, plus the
built-in `BellDot` for Needs input only. The Default choice names its
fallback ("Default (Needs input only)"), and the footnote appears only
when a parent or ancestor limits the level ("Limited by a parent thread"
/ "Limited by an ancestor thread").
10. **Limits resolved from the current tree (core +
push-notifications).** Each thread used to store a copy of its quietest
ancestor's level, updated only when a level was set or a child was
created. Nesting a thread under a new parent, or archiving a parent
(which releases its unarchived children), left that copy stale. Core
gains `threads.experimental_listAncestors` (`POST /threads/ancestors`,
1–200 ids): each thread's ancestor ids from the parent up, in one
recursive query on the primary key. Push-notifications reads the
ancestors and then everyone's own level in one batched metadata call,
for the menu, the CLI and the sender. The cap push-down, the
`thread.created` copy and stored `inherit` rows are gone. Open menus are
not refreshed when an ancestor's level changes; only the written thread
is published.

No server/daemon wire changes. Docs: `docs/api_to_audit.md` (new read
entry; slot entry updated with `threadIds` and the Notifications
registration), `docs/configuration.md`, `docs/multiple-devices.md`, the
`bb guide` customization template, the plugin-authoring references, the
plugin overview, and the Plugin Guide surfaces.

Changes from the source commits (b237c68fb8, 2f9fc5d886, 2b482e6462,
8dffcd7402):
- The per-row metadata fetch and `threadNotifications.get` are gone.
- Inheritance follows Michael's rule ("defaults fill gaps, ancestors
cap") instead of "a parent's level applies to its tree".

## How you verified

- One server test table over a grandparent → parent → worker tree covers
six cases:
  - an unset worker gets the child default;
  - a worker's own `all` beats an `input-only` child default;
  - a parent set to `all` leaves an unset worker at `input-only`;
  - a muted parent mutes an unset worker;
  - a muted grandparent caps a parent set to `all` and its worker;
  - a muted grandparent caps a worker set to `all`.
- Further server tests cover:
- storage of only each thread's own level, with limits resolved from the
current tree;
- a worker moved between a muted and a loud coordinator, then detached,
follows each move, and a question notifies after the move to the loud
one;
- list by id with archived threads included, and publication of the
written thread;
- `POST /threads/ancestors` against a real database: ancestor order, one
entry per id, unknown ids dropped, 400 for 0 or 201 ids, and both move
paths (`PATCH /threads/:id` nesting and the child release when a parent
is archived);
  - CLI output;
- send-time filtering, including workers no louder than `childLevel`
under a muted default.
- App tests:
- one list call for the shown ids; only uncached ids fetched, once each,
and nothing for an empty list;
  - 250 ids split into 200 + 50;
  - an unarchived thread shows its stored level without a reload;
  - own writes, realtime updates, and a refetch after reconnect;
- threads off screen during a reconnect refetched when shown again,
picking up a changed or cleared level.
- Host tests check that:
  - `useData` gets the union of subscribed ids and drops released ones;
  - rows mounting 20 ms apart produce one change;
  - a hidden surface with 250 rows contributes no ids until shown.
- The sidebar harness mounts the real thread-list and push-notifications
plugins hidden with 250 threads. It asserts no rows, no subscribed ids,
and no `threadNotifications.list` call. Thread-list windowing tests
cover zero height realizing nothing, then realizing on resize plus
intersection.
- Route tests: a requested-ids-only response with archived and deleted
threads included, corrupt rows logged, and 400 for a bad plugin id, an
empty id list, or 201 ids. A bound-SDK test checks that the batched read
defaults to the caller's namespace and reads another plugin's with an
explicit `pluginId`.
- `pnpm exec turbo run typecheck lint test --filter=@bb/app
--filter=@get-bb/plugin-sdk --filter=./plugins/thread-list
--filter=./plugins/plugin-api-docs --filter=@bb/server
--filter=./plugins/push-notifications --filter=@bb/db --filter=@bb/sdk
--filter=@bb/server-contract` passes: app 5580, server 3399, lint 0
errors.
- `turbo run typecheck --filter='...[ea9cd40]'` (89 packages) and
every plugin's tests (46 tasks) pass. The SDK version guard passes.
- Item 9: the push-notifications app test checks `detail`, the icon, the
Default label and the footnote for a muted thread, a child limited by
its parent, a grandchild limited by an ancestor, a child on the child
default, and a top-level thread on the global default.
Push-notifications tests (41), thread-list row tests (107), and app
`ThreadActionsMenu` tests (42) pass; app/plugin lint has 0 errors; the
SDK version guard passes. On a `start:worktree` instance I took
screenshots of the desktop row menu (on Default, child on Default, set
to All activity under a muted parent, muted, Needs input only) and the
390 px phone drawer. A level set from the CLI updated the open menu
live. `@bb/app` typecheck fails only in
`lazySecondaryPanelComponents.tsx`, which comes from main (#5098) and
which this branch doesn't touch.
- Live verification of the earlier head ran in @thread:thr_kaqaxztx6m
and passed every journey. Its findings (hidden-sidebar fetch,
scroll-step stragglers, grandparent wording) are fixed here.

Request counts on a `start:worktree` instance with 240 threads (headless
Chrome 1400×900, counting `threadNotifications.list` requests and their
id counts):

| scenario | before (previous head 4fd4886) | after |
|---|---|---|
| direct load of `/settings` | 2 requests (200 + 40 ids) | 0 |
| load of `/` (34 rows) | 2 (32 + 2) | 1 (34) |
| five 400 px sidebar scroll steps | 1 request each, plus a 1-id
straggler in 3 of 5 | 1 request each (13–14 ids) |

Sidebar benchmark (`BB_SIDEBAR_BENCH=1`, 3,000 threads, 81 rendered
rows, median of 8 alternating runs in the same tree). The baseline
column is this branch with the push-notifications registration
unmounted. Core collectors and thread-list's Move are mounted in both.
The machine was noisy, so individual runs spread widely.

| metric | without Notifications | with Notifications |
|---|---|---|
| mountMs | 536.5 | 543.5 |
| statusPatchMs | 164 | 153 |
| membershipRefetchMs | 125.5 | 110.5 |
| pinMs | 164 | 150.5 |
| React Query observers | 821 | 822 |
| observers per rendered row | 10.14 | 10.15 |
| `threadNotifications.list` calls / ids requested | — | 4 / 84 (each id
once) |

The benchmark ran before the resolver and label changes; neither changes
what renders or how often. The single extra observer is the plugin's
settings query. The first cut cost about 30 ms per status patch: every
fetched batch replaced the cache, even when no requested thread had a
level, which re-evaluated every row. The cache now changes only when a
batch returns a stored level.

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

> AGENT GENERATED

---------

Co-authored-by: qa <qa@x>
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