Repository navigation
Give plugins bb's Archive and Delete flows, and route core's through them - #7961
Merged
ymichael merged 2 commits intoNov 21, 2026
Merged
Conversation
ExperimentalPluginActionContext held sdk, navigate, panel and composer as handles, and spread requestArchive/requestDelete beside them as top-level verbs. Nest them as one threadRequests handle, the same object experimental_useThreadRequests() returns, so later core flows join a handle instead of growing the context. The hook now binds straight to the store. SDK 0.6.178, since 0.6.177 shipped with #7960. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/implement-thread-archive-and-delete-api-thr_q6gftaqsg5
branch
from
November 21, 2026 04:38
fa49929 to
3fd9c4f
Compare
ymichael
deleted the
bb/implement-thread-archive-and-delete-api-thr_q6gftaqsg5
branch
November 21, 2026 04:43
ymichael
added a commit
that referenced
this pull request
Nov 23, 2026
## Human comments ## What was wrong A new worktree thread on this repo waits ~24–33 s before its first turn, for `git fetch`, `git worktree add`, `.worktreeinclude` and `.bb-env-setup.sh` (mostly `pnpm install`). #7863 lets environments exist before threads and lets a provider call core's steps, but nothing yet prepares a worktree ahead of time and hands it to a thread. Builds on #7863, now merged. Size: 42 files, +3633 / −75. ## What changed **Core: plugin holds and `ctx.adopt`** - `hold: "plugin"` on `bb.sdk.environments.experimental_create`. Inside a plugin it always means the calling plugin; the plugin-facing type has no `pluginId`. - Threads cannot join a plugin-held environment: thread placement and directory changes refuse with `409 environment_held`. - Disabling or uninstalling a plugin releases its holds on environments no thread owns (on the same unregister signal that clears its queue waits), so they retire like any unused environment once their provider is available. - `ctx.adopt(environmentId, resource)` on version-2 create contexts. It hands an environment that the calling plugin holds (ready, same project and machine) to the thread being created: in one transaction it moves the thread's reservation onto that environment and records the resource the provider passes. A refused adopt changes nothing. - The plugin's hold stays until create returns. Then core clears it and records the resource create returns (for Worktree, the thread's named branch). While the hold is on, no other thread can join the environment, and core can tell after a restart that a handover was unfinished. - A provider may call `ctx.setup(path)` after `adopt`; setup runs again on the adopted environment before the thread starts. Without that call, setup does not run again. - A create that fails after `adopt` (wrong path returned, abort, bad result) fails the thread without starting it: the adopted environment goes to `error`, the hold and `create_pending` are cleared, and normal retirement removes it. - A restart between `adopt` and create returning, or a stop of the thread in that window, discards the adopted environment and resets the thread's provisioning to ask its provider for a new one. The thread then gets another warm worktree or a cold one. Before, the restart sweep finished the create from what `adopt` had recorded, which could start a thread before its fast-forward or setup had run. - Steps the provider reports after `adopt` land on the adopted environment and the thread's provisioning log. `adopt` drops the held environment's unflushed log from before the thread existed. **Worktree plugin: the warm pool** - Setting: per-project size 0–4, off by default. `bb worktree pool status|set`, a settings section and the `worktree` skill. Changing a size saves it and replies at once; the reconcile it starts runs in the background, and settings refresh from the pool's change signal. - Refill: `experimental_create({ hold: "plugin" })` at the default base, unnamed, so the member sits on placeholder branch `<prefix><envId>`. Core runs creation and setup durably. One refill at a time per machine, debounced (5 s after start, 10 s after a handoff, then every 2 min), with a 10-minute backoff after a failure. After a refill, the pool checks the new member every 2 s until its setup settles, then reconciles at once, so settings show it as ready and the next refill starts without waiting for the 2-minute tick. - Handoff, only for a default-base create. It follows a cold create's order: worktree first, setup next, branch name last, so the title wait overlaps the rest. 1. Reserve the oldest ready member under a lock scoped to the project and machine. 2. Read the remote's default base with `git ls-remote`, and fetch that commit if it is not local yet. 3. Under the git ref lock, check that the member is still on its placeholder branch and at that commit or behind it. A member that is not (the base was rewritten, or the checkout was used) is deleted and the next one is tried. 4. `ctx.adopt(member)`, recording the placeholder as the owned branch. 5. If the member is behind: `git merge --ff-only` to the remote commit, then `ctx.setup(path)` again. Both run while the title is still being generated. 6. Await `branchName()`. Under the git ref lock, write the name to the worktree's completion file, then rename the placeholder to it. 7. Return the named branch as the resource. If the remote can't be reached, the check uses the last fetched base, as a cold create's fetch fallback does, and the log says the worktree may be out of date. If the base can't be read at all, the member is kept and the thread gets a cold worktree. A refused adopt tries the next member, or a cold worktree; nothing on disk changed yet. - Settings and `bb worktree pool status` show, per checkout, how many warm worktrees are ready or being set up, and any problem as a plain sentence on its own line: a missing project folder (reported by the host as its own result), a failed check for updates, a failed setup, or a failed create, each saying when it retries. The raw error goes to the plugin log. A problem clears once a later check succeeds outside a retry backoff. - Removal deletes the recorded branch and the branch named in the completion file, so a worktree renamed just before a restart does not leak its branch. - Freshness: while a pool exists, each reconcile fetches the default base and deletes members that are no longer on it (base rewritten), failed, older than 8 h, or over the size. Members that are only behind are kept and moved forward at handoff. Turning a pool off deletes its members. - `bb.sdk.environments.list` now takes a page size (#7932); the pool pages through its members 500 at a time. - `scripts/check-branch-ref-owner.mjs` allowlists `host/handoff.ts`: its `merge-base --is-ancestor` compares a member's commit with the remote base commit and chooses no branch. **Versions**: plugin SDK 0.6.179 (one above main's 0.6.178). No migration: the PR uses the `held_by` and `create_pending` columns from #7863's 0161. `HOST_DAEMON_PROTOCOL_VERSION` is unchanged: the new host calls (`checkPoolMember`, `fastForward`, `nameHandedOffBranch`, `refreshPoolBase`) belong to the Worktree plugin's own host contract, which ships with the plugin. **Docs**: `docs/worktrees.md` (warm worktrees), `docs/configuration.md`, `docs/api_to_audit.md` (plugin holds, `adopt`), the bb-guide environments template, `backend-machines.md`, the Plugin SDK `adopt` comment, the Plugin Guide surface, the plugin README and the `worktree` skill. ### What a warm hit waits for T is the title, F is fetching and creating the worktree, S is setup. | Path | Wait before the agent starts | |---|---| | Cold (unchanged from #7863) | max(T, F + S) | | Warm hit, member current | max(T, ~0.3 s) | | Warm hit, member behind | max(T, S), plus a fast-forward; setup is usually quick when its inputs did not change | The first version of this PR replaced members whenever the default base moved. On this repo `main` moves 22.5 times a day (median gap 5.6 min), so a replay of 517 real thread starts gave hit rates of 41–63%. Members that are behind are now moved forward instead, so the remaining misses are an empty pool (bursts of threads faster than one-at-a-time refills), a rewritten base, or a busy git lock. I have not re-run the replay with this rule. A miss falls back to the cold path, so it is never slower than without a pool, and the handoff checks the remote, so a thread never starts on older code than a cold create would. ## How you verified Rebased onto main at a71ea2a. The live runs below used this handoff code on an earlier base (before #7932, #7957, #7944, #7960 and #7961), on a `pnpm start:worktree` server with a tiny local repo, a bare remote, a pushing clone, pool size 1, and an idempotent `.bb-env-setup.sh` that takes 15 s when `deps.txt` changes and returns at once otherwise. Times are from thread creation. | Run | Result | |---|---| | Warm hit, member current | provisioning completed +416 ms | | Warm hit, member behind by a commit that leaves `deps.txt` alone | fast-forwarded to the new commit; setup ran again and returned at once; provisioning completed +1.18 s | | Warm hit, member behind by a commit that changes `deps.txt` | fast-forward, then setup started 1 s later, while the title was still pending; the branch was renamed when the title arrived 1 s after that (reflog); `turn/started` +16.5 s for a 15 s setup | | `kill -9` of the server 0.6 s after spawn (adopted, setup running, branch still the placeholder) | after the automatic restart the member was destroyed (hold released, directory and placeholder branch deleted); the thread got a fresh worktree on the current commit, `turn/started` +27.6 s including ~12 s of restart; no leftover branches | | `kill -9` after the rename, before create returned (`thr_2skjwjn82w`; a temporary, uncommitted 20 s pause after the rename held the window open) | at the kill, the worktree was on `bb/rename-crash-test-thr_2skjwjn82w` with that name in its completion file, while the database still recorded the placeholder; after the restart the member was destroyed and its directory and both branches deleted (the thread's branch reflog starts fresh at the new create); the thread got a cold worktree and finished its turn at +31.1 s | | Two creates at once with one member | one takes the member, the other builds a cold worktree | | Pool of 1 grown to 3 | second member created 20:42:49 and ready 20:43:04; third created 20:43:05 (it used to wait for the next 2-minute tick) | | Project whose folder was deleted | settings and `bb worktree pool status` show "The project folder … is missing or is not a git repository." (clearing after a later successful check is covered by `warm-pools.test.ts`) | | `bb worktree pool set` with 4 projects keeping pools, one fetching from GitHub | 0.66–0.88 s, the same as a read-only `pool status` (was ~2.1 s while it waited for every pool to fetch its remote); a shrink from 2 to 1 and back still deleted and refilled a member in the background | | Settings open on a phone-width page while a pool grows from 1 to 2 | "1 preparing" after 3.3 s and "2 ready" after 14.7 s, without a reload; long status lines wrap | **Tests** - `apps/server/test/environments/environment-holds.test.ts`: - threads joining a plugin-held environment are refused, including during a handover, until create returns; - a provider's `adopt` hands its plugin's held environment to the thread, and another plugin's hold is kept; - setup runs again, before the thread starts, when the provider calls setup after adopt; - a restart before create returned discards the adopted environment and gives the thread a new one; - stopping the thread before create returned discards the adopted environment; - create returning a different path than it adopted fails the thread without starting it; - steps reported after adopt show on the thread and the environment; - disabling a plugin releases its holds. - `plugins/environment-git-worktree/host.test.ts` (real git): - a member is checked, then its placeholder renamed in place without moving the checkout; - a remote commit that has not been fetched is fetched, and a member behind it is fast-forwarded; - a member is refused after the base was rewritten, or when it is on another branch; - removal deletes the renamed branch when the record still names the placeholder; - a used checkout gets its placeholder back, and a held ref lock answers busy quickly; - an unreachable remote falls back to the last fetched base. - `plugins/environment-git-worktree/warm-pools.test.ts`: - adopt happens on the placeholder, then the branch is renamed once the title arrives; - fast-forward and setup run before the title settles; - a refused, busy or timed-out member falls back, and a refused adopt leaves the branch alone; - another create can take the next member while one waits for its title; - one member goes to only one of two simultaneous creates; - reconcile keeps members that are behind and deletes those no longer on the base, failed, too old or over the size; turning a pool off deletes its members; - a size change replies while a pool's remote check is still running (it hangs on the previous code). - turbo typecheck and lint over `...[origin/main]` (167/167 tasks). turbo test plus `check:query-costs` over the 12 changed packages (23/23 tasks): `@bb/server` 4438 passed, 3 skipped; Worktree 191; `@bb/db` 756; `@bb/cli` 1412 passed, 1 skipped; `@get-bb/plugin-sdk` 445. Plugin SDK version guard passes. > AGENT GENERATED --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 23, 2026
…dary (#7925) ## Human comments ## What was wrong Core's plugin-shaped registrations (message time, thread actions, the parent-thread segment) can import anything in the app, so nothing shows that a plugin could build the same thing, and nothing stops core from using capabilities the SDK lacks. ## What changed - **Boundary.** New lint rule `bb/core-contribution-imports` (`scripts/oxlint-plugin.mjs`, enabled in `.oxlintrc.json` for `apps/app/src/core-contributions/**`). Files there may import only public `@get-bb/plugin-sdk` entry points, the `@bb/shared-ui` subpaths that `packages/plugin-registry` publishes, React and npm packages, and each other. It bans `jotai`, `@tanstack/react-query` and `react-router`, whose plugin copies cannot see bb's store, cache or router, and allows only a default `definePluginApp` export. - **Message time** moves to `core-contributions/message-time.tsx`. `MessageTime` and its formatters move to `@bb/shared-ui/message-time`, a new registry item (`r/message-time.json`). - **Build-time SDK binding.** `vite-core-plugin-sdk-app.ts` (app, Vitest and Ladle configs) resolves `@get-bb/plugin-sdk/app` for app source to `lib/core-plugin-sdk-app.ts`, which re-exports the functions `pluginSdkAppImplementation` serves to plugins. The runtime facade installs after first paint, so core code calling an SDK member while rendering would otherwise throw. `core-plugin-sdk-app.test.ts` pins each export to that object. Tests, stories and `src/test/` keep the runtime path. Thread actions and the parent segment switch their imports to `@get-bb/plugin-sdk/app`. - **Binding guard.** TypeScript checks imports against the full SDK, but the binding exports only the members core uses, so an unbound member typechecked and was `undefined` under Vitest. New lint rule `bb/core-plugin-sdk-app-binding` reads the binding's exports and rejects app-source value imports, re-exports, and namespace, default and dynamic imports of `@get-bb/plugin-sdk/app` that reach past them. Type imports, tests, stories and `src/test/` are exempt, matching the resolver. This lands as scaffolding with one resident. Thread actions and the parent-thread segment move into `core-contributions/` in follow-ups as their SDK gaps close. Archive/Delete is already closed by #7961. Still open: - Thread actions: toasts with core's behaviour (`appToast`, `showMutationErrorToast`) and thread hrefs (`getThreadLocationPath`). - Parent-thread segment: a thread link (`NavLink`), live thread data and focus handoff, and an inline mode for `experimental_ThreadTitleText`. - Info tab: its body comes from core through private context. ## How you verified - Before: on main, adding `jotai`, `@/components/ui/app-toast` and `@bb/domain` imports to core's message-time registration passes `oxlint` (exit 0). After: each is reported, as is a named export; `@bb/shared-ui/button` and `@bb/shared-ui/lib/utils` are allowed. - Before the binding guard: importing `experimental_useRpc` from `@get-bb/plugin-sdk/app` in app source passed `tsc` and was `undefined` in Vitest. After: `packages/scripts/test/oxlint-core-plugin-sdk-app-binding.test.mjs` covers unbound named imports, namespace, default, re-export, `export *` and dynamic imports (reported) and bound members, type-only imports and the root SDK entry (allowed). - `pnpm exec turbo run typecheck lint --filter='...[origin/main]'`: 94/94. `turbo run test --filter=@bb/scripts --filter=@bb/plugin-registry` passes. - `@bb/app` vitest over `src/lib/core-plugin-sdk-app.test.ts`, `src/components/thread/timeline`, `src/lib/thread-actions`, `ThreadActionsMenu.test.tsx` and `src/components/promptbox/banner`: 58 files, 684 tests passed. - `pnpm start:worktree` production build: message time ("10:08 AM") renders in the hover action row of a real thread. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 23, 2026
## Human comments
## What was wrong
bb's own thread actions (Open in split, Copy link, Pin, Mark read,
Notify parent, Rename, Regenerate title, Archive, Delete, New thread in
environment) were registered through `experimental_threadAction`, but
from `apps/app/src/lib/thread-actions/core-thread-actions.ts`, outside
the `apps/app/src/core-contributions/` boundary. They imported private
app modules: `getThreadLocationPath` for Copy link, `appToast` for
toasts, and `showMutationErrorToast` for failed requests. So nothing
showed that a plugin could build them, and the slot docs' "core uses
this too" was only partly true. Two of those reads had no public path at
all. Plugins had no way to show bb's failed-request toast. And a
plugin's `import { toast } from "sonner"` reaches bb's toaster only
through the runtime shim, which core code bundled into the app never
passes through.
## What changed
- **The move.** The registrations now live in
`apps/app/src/core-contributions/thread-actions.ts` as a
default-exported `definePluginApp`. `bb/core-contribution-imports`
passes with no suppressions. `lib/thread-actions/core-thread-actions.ts`
only collects them into `CORE_THREAD_ACTIONS`, the same way
`plugin-slots.ts` collects message time.
- **Private imports replaced:**
- `getThreadLocationPath` →
`navigate.experimental_threadHref(thread.id)`, made absolute with `new
URL(href, location.origin)`, as that method's JSDoc already describes.
**One known difference:** `experimental_threadHref` takes only the
thread id and reads the project from bb's cache. For a thread bb has not
loaded, Copy link now copies `/threads/<id>`, which redirects to the
project route. Main copied the project URL. Every surface checked live
had the thread loaded and copied the same URL as main.
- `appToast` → `toast` from `sonner`, the path the Guide documents for
plugins.
- `showMutationErrorToast` → new `experimental_showErrorToast` (below).
- `collectCoreContributionSlots` → moved out of the file. The
contribution only default-exports its definition.
- Archive and Delete already went through
`context.threadRequests.requestArchive/requestDelete` (#7961), so they
are unchanged.
- **New API: `experimental_showErrorToast({ error, fallbackMessage }):
void`** in `@get-bb/plugin-sdk/app`. It is core's
`showMutationErrorToast`, with the same parameter names.
- No toast for an `AbortError`.
- bb's own title and body for a lifecycle error code.
- Otherwise the title is `fallbackMessage` and the description is the
server's message for an SDK error. Without a body message, the
description is the error's message without the `HTTP <status>:` prefix.
- A fixed "Could not reach the server" text for network failures.
- The JSDoc and the `docs/api_to_audit.md` entry spell this out,
including the trailing-period and "Request failed" cases.
- Core callers: Mark read/unread, Pin, Notify parent, Regenerate title,
Unarchive and the bulk forms.
- The audit entry lists in-repo callers that can migrate later. None are
migrated here, because each migration changes a visible toast:
- thread-list's hand copy `app/ui/mutation-errors.ts`;
- side-chat, push-notifications and drafts, which show `error.message`,
i.e. `HTTP 4xx: ...`.
- The test harness records calls in
`inspection.experimental_errorToasts`. Guide `apiSymbols`
(host-components card), the bb-plugin-authoring reference (still 500
lines) and the SDK version (0.6.187) are updated.
- **`sonner` for core contributions.** `vite-core-plugin-sdk-app.ts`
(Vite, Vitest and Ladle) now also resolves `sonner` imported from
`apps/app/src/core-contributions/` (not tests or stories) to
`lib/plugin-sonner.ts`. That module exports the same `createPluginToast`
instance `plugin-frontend.ts` hands to plugins, and `plugin-frontend.ts`
now imports it from there, so there is one toast object. The shim calls
`appToast` with no plugin attribution, so core's toasts and
notification-center entries are unchanged. `createPluginToast` no longer
captures sonner's `toast` at module load. It reaches sonner only through
the toaster `AppToasterView` attaches (`withSonnerToast`, plus
`readSonnerToasts` for `getHistory`/`getToasts`, which return nothing
before the toaster mounts). That keeps sonner off the boot path even
though core's thread actions load at boot.
- **V1 needed no new API.** "Open in split" and "New thread in
environment" read the compact viewport with `useIsCompactViewport` from
`@bb/shared-ui/hooks/use-compact-viewport`. That is already public as
the registry item `use-compact-viewport`, which the bundled thread-list
plugin vendors, and the boundary lint accepts it. Its value is the
slots' `isCompactViewport` prop. A second SDK hook would have been a
parallel public path, so there is none.
## How you verified
- `pnpm exec turbo run typecheck lint test --filter=@bb/app
--filter=@get-bb/plugin-sdk --filter=@bb/domain
--filter=bb-plugin-plugin-api-docs --filter=bb-plugin-bb-guide`: green.
- `pnpm exec oxlint -c .oxlintrc.json apps/app/src/core-contributions`:
0 findings, no disable comments.
- `ThreadActionsMenu.test.tsx` spies on `appToast.success` while Copy
link runs from the core contribution. It only passes if the
contribution's `sonner` import resolves to bb's toaster.
- Resolver scope, probed directly: `sonner` → `lib/plugin-sonner.ts`
only for non-test files under `src/core-contributions/`. It stays raw
for `*.test.ts`, `*.stories.tsx`, `lib/plugin-sonner.ts` itself, other
`lib/` files and look-alike folders. `@get-bb/plugin-sdk/app` resolution
is unchanged.
- Live, `pnpm start:worktree` with headless Chrome. The same scripts ran
against this branch and against main's build on the same data dir:
- Menus on the sidebar row, the context menu, the thread header, bulk
selection (3 threads, including Notify parent choices and the count
labels), the command palette's thread commands, and the compact (390 px)
header drawer. All 13 captures are identical. Open in split shows at
desktop width and is absent at compact width, where New thread in
environment appears instead.
- Action outcomes: Copy link (toast and clipboard URL), Regenerate title
(loading toast, then "Failed to regenerate title" with the server's
message), notification-center entries, the Pin, Mark read and Archive
shortcuts with Undo, Archive from the menu with Undo, Delete with its
confirmation, Notify parent → When stuck, and Open in split. All 28
outcomes are identical.
- The Copy link toast, the Regenerate title error toast and the
notification center are pixel-identical between main and the branch.
> AGENT GENERATED
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
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 own Archive and Delete flow lives in
ThreadActionsProvider(requestArchiveThreads/requestDeleteThreads). It gets the child count from the server, confirms once, removes threads optimistically, closes split panes, fixes the route, and shows one Undo toast. Plugins could reach it only for one thread, from a component, throughexperimental_useThreadActions(...).run(). Callbacks (commands, message actions, thread actions) couldn't use it at all, there was no bulk path and no Delete. The supersededexperimental_useSidebarThreadActions()told authors to use rawuseSdk().threads, which skips the confirmation and Undo. So community plugins rebuilt the dialog and Undo toast themselves (cursor-sidebar, switchboard) or archived from UI with no confirmation (jb-flow, beside, focus-board, nested-sidebar). Core's own thread actions also reached the flow through a privateuseDatahook (useLifecycleHandlers), not through anything a plugin could call.What changed
API (
@get-bb/plugin-sdk/app, SDK 0.6.178):The context carries the flows as one handle,
threadRequests, besidesdk,navigate,panelandcomposer, rather than as top-level verbs. The hook returns the same shape, and a later core flow joins the handle it belongs to instead of growing the context.Each call runs bb's flow:
listCascade, so the child count comes from the server.The promise resolves when the flow settles: done, cancelled, or failed after bb's error toast. It never rejects. A failed delete keeps the dialog open, so the promise waits for a retry or Cancel.
Core on the same path:
ThreadActionsProviderputs its flows inthreadRequestsAtom(apps/app/src/lib/thread-requests.ts), andusePluginActionContextBinderbinds every callback context and the hook to it.itemandexperimental_bulkItemincore-thread-actions.ts) now callcontext.threadRequests.requestArchive/requestDelete. That covers every thread menu, the thread list's selection menu, the row quick actions and thethread.archiveshortcut.useLifecycleHandlersis deleted.ThreadActionsContextValuekeeps its voidrequestArchiveThreads/requestDeleteThreads, so its callers are unchanged.PluginSidebarThreadActions.archive/requestDeleteare now thin aliases. The JSDoc points atexperimental_useThreadRequests()instead of rawuseSdk().threads.Environment archive stays separate (kill-test 7.2).
experimental_useArchiveEnvironmentThreadsis not the same asrequestArchive(rootIds):Both already share the code that runs after the archive (
presentArchivedThreads). This is recorded indocs/api_to_audit.md.Testing harness:
renderSlotimplements the hook and records calls ininspection.experimental_threadRequestCalls.experimental_makeActionContext(overrides?)in@get-bb/plugin-sdk/testing, next toexperimental_makePanelController. It returns a complete callback context (sdk,navigate,panel,composer,threadRequests) whose default members record their calls incontext.calls; unstubbedsdkmethods reject with the member's name. Every member added to the context used to break every test that built one by hand. Now the next member changes only the fixture, which the compiler checks against the interface.Docs:
docs/api_to_audit.mdentry for the new API, with updates to the context, thread-action, sidebar-actions and environment-archive entries.First-party tests that built callback contexts by hand now use
experimental_makeActionContext: git (command and Commit action), push-notifications, thread-list (Move), side-chat, drafts, and the SDK's command collector and harness tests.Community callers that can migrate:
wy3z/bb-cursor-suite(cursor-sidebarrow-extras.ts,thread-actions.ts),kalindudc/bb-marketplace(switchboard).threads.archivefrom UI:Johannes-Berggren/bb-plugin-jb-flow,ahkohd/bb-plugin-beside,cristoslc/bb-plugin-focus-board,euanguo/euanguo-plugins(nested-sidebar).experimental_useSidebarThreadActions().archive/requestDelete(about 28 repos), e.g.joozio/bb-plugin-work-map,grrowl/bb-lanes,grrowl/bb-tinted-threads,patleeman/gtd-sidebar,regenrek/bb-plugin-machine-sidebar.Community plugin tests that build a callback context by hand fail typechecking until they add
threadRequestsor switch toexperimental_makeActionContext. At runtime, nothing changes for installed plugins.How you verified
ThreadRequests.test.tsx(new; it can't run on main, where the API doesn't exist) covers:ThreadActionsProvider.test.tsxpasses unchanged.experimental_makeActionContextrecords its default members' calls and names unstubbedsdkcalls.ThreadActionsMenu.test.tsxandThreadCommandHandlers.test.tsxnow assert that the thread ids go to the requests. The uncached-fetch case moved intoThreadRequests.test.tsx.turbo run typecheck --filter='...[origin/main]': 109/109 passed.turbo run lint --filter='[origin/main]'passed.turbo run test --filter='[origin/main]'passed after the two doc-shape fixes.pnpm start:worktreewith headless Chrome against a parent with 4 children and a worktree environment fixture. Main is the baseline, then the branch:/, and Undo returns to the thread and restores all 5.experimental_useThreadRequests(), a Delete of a thread archived on the server, with an archived tree, fetches them and shows "Delete 2 threads? Their 4 child threads…", then settles on Cancel. An unknown id shows an error toast and no dialog.context.threadRequests.requestArchive, the same child-count dialog opens, and the promise settles only after Archive is confirmed, with one Undo toast.🤖 Generated with Claude Code