Repository navigation
Per-machine warm worktree counts, on a shared settings list - #8112
Merged
ymichael merged 11 commits intoNov 24, 2026
Merged
Conversation
A project's warm worktree count applied to every machine with a checkout. Each machine can now keep its own count, which wins over the project's, from the settings page, the setWarmPoolHostSize RPC, or `bb worktree pool set <project-id> <size> --host <host-id>` (`project` follows the project's count again). Co-Authored-By: Claude Opus 5.5 <[email protected]>
One hairline for the project list instead of a nested second one. Each machine is a single line with its name, a short ready count and its picker; paths move to a tooltip, the base branch and the per-project explainer are gone, and the intro is shorter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Core settings pages used SettingsSection/SettingsRowList from apps/app, which plugins cannot import, so each plugin settings section hand-rolled its own list: a hairline rail (warm worktrees, concurrency limit), an inner bordered box (keep awake, ACP registry) or a copy of core's classes. settings-section moves to @bb/shared-ui (and the plugin component registry) unchanged, and gains SettingsList, SettingsListItem and SettingsListMessage: the settings card with an optional sub-heading, and rows with a title, middot-joined meta, badge, description, leading and trailing controls, a per-row error and nested rows for per-machine or per-account overrides. Warm worktrees, concurrency limit, keep awake and the ACP agent registry now build on them, and section headings move to the settingsSection slot's title and description. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Machines are SettingsListItems with their main and extra folders nested under them, replacing the hand-rolled hairline and folder entries. Add folder and Set up move into the machine row's control slot (named per machine), the status dot becomes an Offline note, and a missing folder shows as an error line. SettingsListRows is the list without the card, for sections that already sit in a SettingsSection. The plugin-authoring detail moves into the settingsSection slot reference so frontend-hooks-and-ui.md stays within the 500-line cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A row is now a grid: leading, title line and control share the first row, and the description and error sit under the title in the text column, so a long error never runs under the control. Nested items hang off a hairline aligned with the parent's leading icon (or its title), lists can drop dividers where items nest, and SettingsListAction is the "Add …" row at the end of a nested group. Project Folders goes back to an Add folder row per machine, with no dividers between machines; warm worktrees and keep awake drop dividers too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rail sat flush under the parent title's first letter, reading as a border. It now hangs a few pixels into the title, with the nested rows indented past it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Below 30rem of list width, a row's control drops under its title and details, aligned with the title, so text keeps the full width; switches stay trailing as in SettingsWithControl. The query sits on the list, so nested rows switch with their parents. Titles and meta wrap instead of truncating, each middot stays glued to the text before it, and badges follow the meta so a wrapped line never starts with a separator. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An overflow menu is icon-sized, so like a switch it stays beside the title instead of dropping under it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The per-machine counts were full form selects: a heavy column of boxes on desktop and a zig-zag of stacked fields on narrow screens. SETTINGS_INLINE_SELECT_CLASS is a borderless value-plus-chevron trigger that stays trailing at every width (dropdowns join switches and menus as compact controls); inherited values render muted. Meta items no longer break mid-item and rows are 32px minimum to match the controls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/add-per-host-worktree-warming-counts-thr_jtqwi3qw8p
branch
November 24, 2026 19:40
ymichael
added a commit
that referenced
this pull request
Nov 24, 2026
…per-machine pools Main added 0169 and per-machine warm pool counts (#8112). The branch's migrations become 0170 (setup_folder_paths) and 0171 (additional path entries). Pool folders are stored next to the project's and machines' counts, and the settings list shows the folder choices as nested rows under a project that keeps warm worktrees. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 24, 2026
… them up and keep them warm (#8065) ## Human comments ## What was wrong #8007 added `additionalPaths` so an environment provider can give a thread extra folders, but no provider returned any, and nothing let an environment take a project folder out of the thread's workspace. A worktree thread in a multi-folder project could only branch the main repository: every other repository in `bb project folder` stayed a shared checkout that all threads wrote to. Setup scripts also ran only in the main workspace, and warm worktrees could not carry extra repositories. ## What changed **Core contract (experimental, documented in `docs/api_to_audit.md`).** - `additionalPaths` becomes a list of `{ path, replaces? }` entries (domain: `replaces: string | null`, filled once when the create result is parsed). `replaces` names the project folder an entry stands in for. `mergeWorkspaceFolderPaths` (`workspace-folder-paths.ts`) is the one place that builds the session's folders: project folders minus the replaced ones, plus each entry's `path`. A replaced folder stays out even when its replacement is missing, so a thread never falls back to writing the shared checkout. Migration 0171 converts recorded `additional_paths` strings into entries that replace nothing. `bb environment show` prints `Folder: <path> (replaces project folder <folder>)`. - `setup(path, { folders })`: a create can name the extra folders it made. Core stores them (`environments.setup_folder_paths`, migration 0170), runs each folder's `.bb-env-setup.sh` once, in order, before the main one (each as its own hook operation, `…:setup:folder:<i>`), and runs teardown in the main workspace first, then the folders in reverse. A create fails if it set up a folder it did not return in `additionalPaths`. After `adopt`, `folders` may name only folders the adopted environment recorded: core forgets their finished setup records (`forgetFinishedEnvironmentHookOperations`) and runs them again, then the main one. Recovery inspects and acknowledges each folder's hooks. - Plugin SDK 0.6.197. No daemon wire change: hooks already run per path, and the daemon still receives the merged folder list. **Worktree provider (`plugins/environment-git-worktree`).** - Inputs gain `folders: string[]` (default `[]`). `validate`/`create` refuse a folder that is not one of the project's folders on that machine. - New host RPC `createFolders` (`host/folders.ts`): each folder must be the top folder of a repository with a commit, and no two (including the main checkout) may share a git common dir. It makes a worktree of each folder next to the main one, detached at that repository's default base. If one fails, everything made is removed. - Create and restore pass the new folder worktrees to `setup`, so their setup scripts run before the main worktree's. - Removal removes every worktree in the environment's directory and deletes each repository's bb-owned branch under the #7242 rules. - Picker: "Also branch:" lists the machine's project folders that are git repositories (`listBranchableFolders`). - Warm pools: folders are set per machine (each checkout has its own folder paths), on the settings page under each machine or with `bb worktree pool folders <project-id> <folder>... [--host <host-id>]`, and stored next to #8112's per-machine counts. Members are created with those folders and handed only to a create that branches exactly that set. On handoff the provider checks each folder worktree like the main one, fast-forwards any that is behind its remote, renames the placeholder in every worktree, and calls `setup(main, { folders: moved })`, so only moved folders (and then the main worktree) are set up again. Reconcile replaces members whose folder set differs or whose folder worktree left the placeholder or its base. - Settings: each machine's folder checkboxes sit under it and are shown only while it keeps warm worktrees; a chosen folder that is no longer a git project folder there is flagged. Ladle stories cover every state. **Storage retention.** An environment's `additionalPaths` count as bb-owned (never offered as external worktrees), their uncommitted changes block automatic recovery of an interrupted cleanup, and their size is added to the leftover worktree's. **Docs.** README, the worktree skill, the bb guide's environments and projects chapters, and the plugin-authoring references. ## How you verified - New and updated tests: `environment-holds.test.ts` (folder setups run in order before the main one and teardowns in reverse; setup after adopt reruns only named recorded folders; unrecorded folder refused; unreturned set-up folder fails the create), `provider-orchestration.test.ts` (entries canonicalized, relative `replaces` rejected), `thread-runtime-config.test.ts`, `environment-additional-path-entries-migration.test.ts`, `host.test.ts` (real git folder worktrees), `server.test.ts`, `warm-pools.test.ts` (folder handoff, exact-set matching, fast-forward and re-setup of a behind folder, reconcile replacement, per-machine folder config), `storage.test.ts` (folder worktree changes block recovery and folder worktrees are never external; both fail without the fix). - `pnpm exec turbo run typecheck lint --filter='...[origin/main]'` passes; affected package tests pass locally. - Live on an isolated `pnpm start:worktree` instance with real repositories whose setup/teardown scripts log their order: a create with `docs` and `api` ran setup docs → api → app and teardown app → api → docs, removing every worktree and branch; a warm pool branching `api` set up api → app, was handed to a thread branching `api` without new setup and with the branch renamed in both repositories; a thread branching nothing missed and built fresh; after a push to `api`'s remote, the handoff fast-forwarded the `api` worktree to the new commit and reran setup api → app; the settings checkboxes saved per machine. > 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 24, 2026
Squashed rebase of #8086 onto main. The import action sits next to "Add folder" as a SettingsListAction in the machine row that #8112 introduced. Plugin SDK 0.6.200. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 25, 2026
Squashed rebase of #8086 onto main. The import action sits next to "Add folder" as a SettingsListAction in the machine row that #8112 introduced. Plugin SDK 0.6.203. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 25, 2026
Squashed rebase of #8086 onto main. The import action sits next to "Add folder" as a SettingsListAction in the machine row that #8112 introduced. Plugin SDK 0.6.208. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 26, 2026
Squashed rebase of #8086 onto main. The import action sits next to "Add folder" as a SettingsListAction in the machine row that #8112 introduced. Plugin SDK 0.6.208. 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
A project's warm worktree count applied to every machine with a checkout of that project. A project checked out on a laptop and a build machine could only keep the same number of warm worktrees on both, or none on either, so you could not keep a big pool on a beefy machine without paying for it on a small one.
What changed
plugins/environment-git-worktree/warm-pools.ts: the storedwarm-poolsconfiguration gains ahostsmap per project (entries saved before this change still parse;hostsdefaults to{}). A machine's count is its own count if set, otherwise the project's. Reconcile, refill, discard and handoff all use the per-machine count, so a machine set to 0 drops its idle members and builds fresh worktrees, and a machine with its own count keeps its pool while the project's count is Off. Status addssize(the count in effect) andhostSize(the machine's own count,nullwhen it follows the project) to each checkout.server.ts: newsetWarmPoolHostSizeRPC (size: nullfollows the project again; rejected for a machine with no checkout of the project).bb worktree pool setgains--host <host-id>, and with it the sizeproject. Status text now marks which machines have their own count.warm-pool-settings.tsx: a project on more than one machine lists each machine as one row (Build box · 2 ready) with its own picker: Project (N) (muted while it follows the project) or Off/1–4. Split into a presentationalWarmPoolSettingsContentwith a Ladle story (plugins/Warm worktrees, registered inapps/app/.ladle/config.mjs). The heading moves to the slot'stitle/description.Shared settings list. Core settings pages built on
SettingsSection/SettingsRowListinapps/app, which plugins cannot import, so every plugin settings section hand-rolled its own list (a hairline rail, an inner bordered box, or a copy of core's classes).settings-section.tsxmoves unchanged fromapps/app/src/components/uito@bb/shared-ui/settings-section(25 core imports updated) and joins the plugin component registry (npx shadcn add @bb/settings-section).SettingsList(the settings card, optional sub-heading),SettingsListItem(title, middot-joinedmeta,badge,description,leading, trailingcontrol, per-rowerror, nested child items) andSettingsListMessage(loading/empty/error rows). Nested rows align under the parent's title.SettingsListRowsis the list without the card, for sections already inside aSettingsSection.dividers={false}drops dividers where items nest;SettingsListActionis the "Add …" row.settings/Settings listshows every shape. Plugin-authoring docs describe the primitives.app.tsx: the base-branch picker's ready count uses the machine's count in effect.docs/worktrees.md,docs/configuration.md, the plugin'sworktreeskill and README.No server/daemon wire change: this is plugin RPC and plugin KV only.
How you verified
pnpm exec turbo run test typecheck lint --filter=bb-plugin-environment-git-worktree: 199 tests pass. New tests inwarm-pools.test.ts: a machine set to 0 discards its members, persistshosts, and builds fresh worktrees, then refills once set back to follow the project; a machine with its own count keeps and hands off its member while the project is Off; a count for a machine without a checkout is rejected.pnpm exec turbo run typecheck lint --filter='...[origin/main]'(97 tasks) and tests for shared-ui, plugin-registry, bb-guide and the four migrated plugins pass, as do the app tests covering the moved file (theme anatomy, settings search anchors, machines/projects/plugin settings).pnpm start:worktreeinstance with two enrolled machines: changed counts from the UI and CLI and watched each machine fill to its own count; clicked through keep awake (enable, Specific hosts, uncheck a host) and confirmedbb keep-awake status; checked the concurrency limit and ACP registry pages render.🤖 Generated with Claude Code