Repository navigation
Conversation
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.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Oct 9, 2026
…thread menu actions (#5243) ## 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='...[2511116]'` (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](https://claude.com/claude-code) > AGENT GENERATED --------- Co-authored-by: Claude Fable 5.1 <[email protected]> Co-authored-by: qa <qa@x>
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 thread header menu (in core) and the thread-list plugin's row menus (dropdown, right-click, compact drawer, hover quick-action buttons) each kept their own copy of the same thread actions — split, copy link, mark read, pin, move to section, rename, archive, delete. The two copies could drift, and there was no way for a plugin to add a row to either menu. Separately, the thread-list plugin had moved
organizationModeandmanualSectionOrderinto its own KV, so core's section-move context and sidebar reveal were reading a stale copy left in core UI preferences.What changed
@get-bb/plugin-sdk/app, SDK 0.6.29):app.slots.experimental_threadAction({ id, title, resolve })—resolve({ thread, surface, metadata, rpc })returns a data description of the action (label,icon,group: open | organize | lifecycle, and eitherrunor achoiceslist withselect), ornullto hide it. It gets the plugin's ownthread_plugin_metadatarow for the thread and the plugin's RPC client; the host refetches that metadata afterrun/selectsettles.experimental_useThreadActions(target, surface)— returns the ordered core + plugin action list, so replacement thread lists render the same menu.docs/api_to_audit.md, the Plugin Guide surfaces, and the bb-plugin-authoring skill references.apps/app/src/lib/thread-actions/core-thread-actions.ts). Both the header menu and every sidebar row surface now render from the hook. The duplicated section-move submenus, the plugin's ownThreadSectionMoveProvider, and the plugin's row-action model are deleted.rowActionspreference stores action keys (core:archive,<pluginId>/<id>). Legacy bare ids (archive,pin, …) migrate tocore:<id>when read. Docs and the thread-list skill are updated.organizationModeandmanualSectionOrderare stored in core UI preferences (sidebar.*) again, with a one-time reverse migration from the plugin KV, so core reads live values.This is a cherry-pick of 299d3484b0 onto current main. Conflict resolutions: kept main's
SidebarRenameProviderwrapper and new hover-hidden class inThreadRow.test.tsx; dropped main's edit to the deleted pluginThreadSectionMoveProvider(moves now go through core'suseMoveThreadToSectionmutation); took main's cache-owner test, which no longer has the import inventory; bumped the SDK 0.6.28 → 0.6.29.How you verified
pnpm exec turbo run typecheck lint --filter=@bb/app --filter=@get-bb/plugin-sdk --filter=./plugins/thread-list --filter=./plugins/plugin-api-docs: passes (warnings only).pnpm exec turbo run teston the same filters: app 5578 passed, plugin-sdk 365, thread-list 461, plugin-api-docs 74.@bb/serverplugin-authoring-docs.test.ts: 22 passed..github/workflows/check-plugin-sdk-version.mjs: the SDK surface change comes with a version bump.🤖 Generated with Claude Code