Repository navigation
Keep path plugins when bb deletes their thread storage or workspace, and say so at install - #6973
Merged
ymichael merged 3 commits intoNov 4, 2026
Conversation
…eted A path plugin installed from $BB_THREAD_STORAGE loaded from that folder, and deleting the thread (by hand or through Storage Retention) removed the folder with no warning, leaving the plugin "directory not found". Before bb deletes a thread's storage folder, or removes an orphaned one, it now copies every path plugin installed from inside it to <dataDir>/plugins/<id>/preserved-source and moves the install there through the same path-move flow as `bb plugin install path:<new dir>`, so settings, secrets and schedules are kept. If the copy fails the storage is kept and the deletion retried later. If the plugin cannot start from the copy, the copy stays on disk and the server log names it. Fixes #6971 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… at install A path plugin installed from inside a bb-managed workspace (such as a thread's worktree or personal workspace) broke when that environment was removed, just as plugins installed from thread storage did. Environment removal now copies such plugins to <dataDir>/plugins/<id>/preserved-source before the provider deletes the workspace, and keeps the workspace (the teardown fails and retries) when the copy fails. The install-time warning for these folders used to be a server log line only, and it did not cover thread storage. Installed plugins now carry a server-computed sourceNotice that says where the plugin will be copied. `bb plugin install` and `bb plugin list` print it as `note:`, the app shows it in the install toast and on Plugin details, and the server still logs it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/plugins-installed-from-thread-storage-are-delete-thr_d5g2kma75k
branch
from
November 4, 2026 23:27
7932661 to
a8b28a7
Compare
ymichael
deleted the
bb/plugins-installed-from-thread-storage-are-delete-thr_d5g2kma75k
branch
November 4, 2026 23:44
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 plugin install <path>registers a plugin by its folder and loads it from there. When an agent built and installed a plugin inside a folder bb later deletes, the plugin broke. One such folder is$BB_THREAD_STORAGE(<dataDir>/thread-storage/<threadId>), deleted with the thread. The other is a thread's provider-owned workspace (personal workspace or git worktree), deleted when the environment is removed, for example after the thread is archived. The source disappeared and the plugin became "plugin directory not found", thenmissingafter a restart.Users weren't warned either. The install-time warning from #1566 was a server log line only, and it didn't cover
thread-storage/. See #6971 (thread storage, live repro on main) and #6670 (personal workspace, lost on archive).What changed
Keep the plugin when bb deletes its folder
preservePathPluginsInside(directory). This coversrequestThreadStorageDeletion(thread delete, project delete, the lifecycle sweep, Storage Retention) and orphan cleanup.runRemovecalls it too, right before the provider'sremovedeletes a workspace it owns. This covers git worktrees and personal workspaces, whether the environment is removed by archive, delete, retirement orbb environment delete.<dataDir>/plugins/<id>/preserved-source(staged, then renamed into place). It then moves the install throughinstallPathSource, the same flow asbb plugin install path:<new dir>, so settings, secrets and schedules are kept.removeisn't called.bb plugin installcommand to run.Tell the user at install
InstalledPlugingainssourceNotice: string | null, computed by the server for path plugins:worktrees/andpersonal-workspaces/, plugin data dirs), where nothing copies it out: "…where bb can delete it. Reinstall it from a folder outside to keep it." This replaces the old log-only warning.null, becausepreserved-sourceis stable.bb plugin installandbb plugin listprint it asnote:.null, so the SDK and CLI still parse responses from older servers.Other
bb guide pluginschapter and the bb-plugin-authoring quickstart.I chose copying at deletion over copying at install. Install-time copying would break the documented in-place
bb plugin install .+bb plugin devloop.How you verified
Live,
pnpm start:worktree+ source CLI (env -u BB_CLI -u BB_SERVER_URL):thread-storage/thr_45jajad99g/…, thenbb thread delete.bb plugin reload storagedemofails withplugin directory not found: …/thread-storage/thr_45jajad99g/bb-plugin-storagedemo (reinstall). There's no warning at install.thr_he4xywtg9e):note: Installed from a thread's storage folder….bb thread delete, the folder is gone,storagedemoisrunningfrom…/plugins/storagedemo/preserved-sourcewith no note, andgreeting = "hello-from-storage"is kept.thr_7c8tcxvmbt,env_j2g4g2buh4):note: Installed from a bb-managed workspace….bb thread delete, the environment retired, then wentdestroyed/removedand the workspace folder was deleted.wsdemoisrunningfrom…/plugins/wsdemo/preserved-source, andbb plugin reload wsdemosucceeds.Tests:
provider-orchestration.test.ts:preserved-source,running, with no notice.removeisn't called and the environment staysfailedwith the error.plugin-service.test.ts:personal-workspacespath gets the "reinstall" notice; a folder a provider only attached to gets none.thread-stop-retry.test.ts: preservation runs beforethread.storage.deleteis queued, and nothing is deleted when it fails.PluginInstallJobsHost.test.ts: a plugin with a notice gets the warning toast with that notice, not the success toast.pnpm exec turbo run typecheck lint --filter='...[origin/main]': 174/174.Fixes #6971
Fixes #6670
🤖 Generated with Claude Code