fix(plugins): warn when installing a path plugin from a managed workspace - #1566
Open
PennybagsCX wants to merge 1 commit into
Open
fix(plugins): warn when installing a path plugin from a managed workspace#1566PennybagsCX wants to merge 1 commit into
PennybagsCX wants to merge 1 commit into
Conversation
…pace (get-bb#1565) A path-sourced plugin installed from inside a bb-managed workspace (<dataDir>/personal-workspaces/env_*/ or <dataDir>/worktrees/) is silently deleted when that environment is destroyed (e.g. when the owning thread is archived). The env teardown path in packages/host-workspace/src/provision.ts recursively removes the workspace directory with no awareness of registered plugins whose source_path lives beneath it, leaving the plugin permanently "missing (reinstall)" with its source gone. This is the cheapest of the three fixes proposed in get-bb#1565: emit a logger.warn at install time so users know the source is ephemeral and can reinstall from a stable path. It reuses the existing isBbManagedWorkspacePath predicate already used for thread path-claims, and does not change install behavior. Tested: new case in plugin-service.test.ts asserts the warning fires for an install under <dataDir>/personal-workspaces/env_*. Refs get-bb#1565
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.
Summary
Cheapest of the three fixes proposed in #1565. When a user runs
bb plugin install <path>(orinstallPath) and the resolvedsource_pathlives inside a bb-managed workspace (<dataDir>/personal-workspaces/env_*/or<dataDir>/worktrees/), emit alogger.warnso they know the source is ephemeral — it will be deleted when that environment is destroyed (e.g. when the owning thread is archived).This does not change install behavior; it only surfaces the hazard. It reuses the existing
isBbManagedWorkspacePathpredicate (already used for thread path-claims inworktree-paths.ts), so there's no new concept to maintain.Why
I lost six plugins this way on a single machine (
browser-preview,automaker,file-explorer,prime-agent-ui,terminal-dock,thread-ops), one of them twice. The natural workflow — scaffold a plugin inside the thread's env viabb plugin new, thenbb plugin install .— collides with the normal archive→env-destroy lifecycle. The plugin source is silentlyrm -rf'd byprovisionPersonalWorkspace'sdestroyFn(packages/host-workspace/src/provision.ts:762), leaving a danglingmissing (reinstall)registration.A warning at install time is high-leverage and zero-risk: it teaches the user the model the first time, before any data is lost. The destroy-time guard (option 2 in the issue) is the stronger fix and is worth doing separately, but this PR stands on its own.
Changes
apps/server/src/services/plugins/plugin-registration.ts: ininstallPathSource, after resolvingrootDir, checkisBbManagedWorkspacePath({ dataDir: deps.dataDir, path: rootDir })andlogger.warn(...)if true.apps/server/test/services/plugins/plugin-service.test.ts: new test asserts the warning fires for an install under<dataDir>/personal-workspaces/env_test/....Test plan
pnpm vitest runinapps/server— 19/19 plugin-service tests pass (including the new one)tsc --noEmitcleaneslintclean on both changed filesCloses #1565 (install-time-warning portion).