Repository navigation
Log plugin installs to PostHog - #1743
Conversation
Capture an anonymous plugin_installed telemetry event at the one install chokepoint (registerInstalled). Public plugins (bundled builtins and marketplace catalog entries) report their id so PostHog can rank them by install count. Direct path/git/npm installs report only provenance and source kind, because their ids can name private code. Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
I am SlopCop. I will review this pull request under the review rule.
In plain English, this change records anonymous plugin install events. It names public plugins, but it hides names for direct installs.
I will check security, code quality, architecture, performance, tests, and the full install path.
| provenance: PluginProvenance, | ||
| sourceIntent: PluginSourceIntent, | ||
| ): Extract<TelemetryEvent, { name: "plugin_installed" }> { | ||
| const isPublic = provenance.kind !== "direct"; |
There was a problem hiding this comment.
🚨 slopcop/review — Private catalog names can reach PostHog.
This condition treats each catalog as public. BB accepts local path: catalogs and private Git catalogs.
A private catalog can contain internal plugin and marketplace names. This event sends both names with the stable install ID.
Limit names to builtins and CURATED_MARKETPLACE_NAME. Set both names to null for all other catalogs, or add explicit telemetry-safe metadata.
Please add a local third-party catalog test for this privacy boundary.
There was a problem hiding this comment.
Fixed in 66e271d: names are limited to bundled builtins and bb-community entries, the telemetry dependency is required, and the README/BB_TELEMETRY notices mention plugin installs. A third-party catalog test guards the boundary.
| >; | ||
| logger: ServerLogger; | ||
| /** Anonymous usage telemetry. Omitted only by isolated plugin tests. */ | ||
| telemetry?: TelemetryService; |
There was a problem hiding this comment.
🚨 slopcop/review — The optional dependency hides a required default.
The comment says that only tests omit telemetry. Production already requires a telemetry service.
This optional field lets a future production call site lose events without a type error. Make the field required.
Use createNoopTelemetryService() in isolated tests.
There was a problem hiding this comment.
Fixed in 66e271d: names are limited to bundled builtins and bb-community entries, the telemetry dependency is required, and the README/BB_TELEMETRY notices mention plugin installs. A third-party catalog test guards the boundary.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain English summary
This PR records one PostHog event after a successful plugin install. It uses the common install action point and hides direct-install names.
The main problem is that it does not hide names from private plugin catalogs.
Findings
-
High — Private plugin data can reach PostHog.
The code treats every catalog as public. BB also accepts local and private Git catalogs.
A private catalog can expose its marketplace name and plugin ID under the stable telemetry install ID. Limit named events to builtins and
bb-community. -
Medium — The user telemetry notice is incomplete.
README.mdand theBB_TELEMETRYdescription list only app starts, thread counts, and message counts. Add plugin install data and the identifier policy. -
Low — The telemetry dependency is optional only for tests.
Make it required. Give isolated tests the existing no-operation telemetry service.
Checks
- The server type check passed.
- The focused plugin service test passed all 21 tests.
- All current GitHub checks passed.
- A browser test installed the bundled Tasks plugin through the plugin catalog route. The server returned HTTP 200 and loaded Tasks.
- A source run does not send external telemetry by policy. The tests and type checks therefore validate the event payload.
- The performance review found no new concern. The event uses a small object and a fire-and-forget request.
- The architecture scan found no duplicate install event. The common registration point is the correct action point.
I left a comment-only review, as required. Please fix the private catalog leak before merge.
- Name only bundled builtins and bb-community catalog entries in the plugin_installed event; third-party and local catalogs report no name. - Make the plugin service telemetry dependency required; tests pass the no-op service. - Document plugin installs in the README and BB_TELEMETRY notices. Co-Authored-By: Claude <[email protected]>
The daily install-count query had no timestamp bound, so ClickHouse scanned the project's whole event history and sometimes hit PostHog's execution limit (HTTP 504 on Oct 9, 13 and 19). Bound it to 2026-08-17, when BB first sent plugin_installed (get-bb/bb#1743), which loses no counts and lets partitions be pruned. Also retry, up to three attempts with backoff, only the 504 "max execution time" answer: the query is a read, so a rerun is safe. Every other failure still fails at once. Co-authored-by: Sawyer <[email protected]>
Summary
plugin_installedtelemetry event. The event fires atregisterInstalled, the one chokepoint that every user install passes through (CLI, store, and API; git, npm, path, and builtin sources). Boot-time reconcile of auto-installed bundled plugins does not use it, so it does not count.plugin_idandmarketplace, so PostHog can rank plugins by install count: trend onplugin_installed, breakdown byplugin_id, aggregation "unique users".plugin_id: null. Their ids and sources can name private code, so they report onlyprovenanceandsource_kind.telemetryservice into the plugin service.No wire change between the server and host daemon, so no protocol version bump.
Tests
pnpm exec turbo run typecheck --filter=@bb/serverpnpm exec turbo run test --filter=@bb/server -- test/services/plugins/plugin-service.test.ts test/services/telemetry.test.ts(27 passed). New tests: one install emits exactly one event; reload, enable/disable, and restart emit none; the catalog payload names the plugin.