Repository navigation
Add a Check for updates button and a 6-hour plugin update sweep - #1966
Conversation
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
| (newest, row) => | ||
| row.lastUpdateCheckAt === null | ||
| ? newest | ||
| : Math.max(newest ?? 0, row.lastUpdateCheckAt), |
There was a problem hiding this comment.
🚨 slopcop/review — P2: Schedule from the oldest plugin check
Math.max uses the newest non-null check time. On restart, a recent scoped check for one plugin delays stale plugins and plugins with no check. Repeated scoped checks and restarts can delay the complete sweep without a fixed limit.
Please use the oldest check time, and make any null value due now. A two-plugin test with mixed timestamps will protect this rule.
| .join(", "), | ||
| }; | ||
| } | ||
| return { |
There was a problem hiding this comment.
🚨 slopcop/review — P2: Do not report success for an incomplete check
The API returns unavailable resolutions in a successful HTTP response. This branch then states that all plugins are current, even when a registry check failed. The blocked filter above also misses a current result that has a non-null blocked release.
Please report unavailable entries as check problems. Detect blocked releases from result.blocked, not only from the incompatible outcome. Add one test for each response shape.
| providerRegistry.markRegistrationsSettled(); | ||
| // Check installed plugins for updates every 6 hours. A check only | ||
| // records what is available; it never installs or runs plugin code. | ||
| pluginService.startPeriodicUpdateChecks(); |
There was a problem hiding this comment.
🚨 slopcop/review — P1: Keep the guarded marketplace registry policy in automatic checks
This call makes every catalog npm registry request automatic. The install path uses assertPublicMarketplaceUrl, a redirect ban, a timeout, and an 8 MiB response limit. The update path creates the default resolver, which uses unrestricted fetch and response.json(). A registry owner or DNS attacker can redirect a scheduled request to a private service. A hostile response can also wait without a limit or consume unbounded memory.
Please choose the resolver from the stored provenance. Catalog registries need the same guarded transport and bounded JSON reader as installation.
| cancelPeriodicCheck = null; | ||
| const startedAt = now(); | ||
| void updates | ||
| .checkForUpdates() |
There was a problem hiding this comment.
🚨 slopcop/review — P1: Bound and track the unattended sweep
This new timer starts the existing all-plugin check without an active-run guard. That check uses an unbounded Promise.all. Git range checks can clone as many as ten candidates for each plugin. Separate manual checks can also queue duplicate work behind the lifecycle locks.
Shutdown only cancels the next timer. It does not cancel or await this promise. An npm request has no timeout, so pluginService.stop() can wait behind an active lifecycle lock without a finite limit. Please add concurrency control, in-flight deduplication, and a bounded shutdown path.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain-English summary: This change adds manual plugin update checks. It also scans installed plugins every six hours. It never applies updates automatically.
I found two high-priority issues and two moderate issues.
-
High — Automatic catalog checks lose network protections. The install path blocks private addresses, redirects, long requests, and large responses. The scheduled update path uses unrestricted fetch and JSON parsing. A hostile registry can cause a private network request or exhaust server resources.
-
High — The sweep has no work limit or shutdown limit. It starts all plugin checks at once. Git checks can clone many repositories concurrently. Manual checks can queue duplicate work. Shutdown does not cancel or await the active sweep.
-
Moderate — A recent check can delay stale plugins. The restart calculation uses the newest plugin check time. It must use the oldest time and treat any missing time as due now.
-
Moderate — The UI can report false success. An unavailable registry result still returns HTTP 200. The new message then says all plugins are current. It also misses blocked releases on current results.
The UI correctly reuses the existing route and cache owner. The server also reuses the existing update resolver. I found no duplicate update-resolution path.
The timer duplicates other periodic job patterns. The existing periodic sweep service already has a running-work guard. A shared job path can reduce overlap risk. The guarded npm resolver policy also needs one shared source.
Validation:
- All current GitHub checks passed.
- The focused application test passed all four tests.
- Application and server type checks passed through Turbo.
- Dev Browser confirmed the overview button, the detail button, both POST requests, and both success messages.
- I removed the temporary local plugin after the browser test.
- The local focused server test stopped during competing generated-type work. GitHub's server test passed.
I posted this as a comment review only. I did not approve the PR or request changes through GitHub.
- Catalog-provenance npm rows resolve through the guarded marketplace transport and bounded JSON reader during checks, as they do at install. - Direct registry requests are time-boxed. - A full sweep runs at most four plugins at a time, concurrent callers share one in-flight sweep, and stopPeriodicUpdateChecks awaits it. - The periodic sweep is scheduled from the stalest plugin, and a never-checked plugin is due now. - The check toast reports unavailable results as a warning and reads blocked releases from the result field. Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
What was wrong
The plugin update UI (the "Update x.y.z" pill, the update dialog, and the detail-page banner) shipped in #1474, but nothing ever triggered an update check.
checkForUpdatesonly ran when a user ranbb plugin outdatedorbb plugin update. The app had acheckPluginUpdates()helper with no caller, and the server only refreshed marketplace catalog metadata on a timer, not installed-plugin update state. So the pills never appeared for users who do not use the CLI.What changed
Server:
apps/server/src/services/plugins/plugin-updates.ts: newstartPeriodicUpdateChecks()/stopPeriodicUpdateChecks()withPLUGIN_UPDATE_CHECK_INTERVAL_MS = 6h. The first sweep runs at once when no plugin has a recorded check or the newest one is older than 6h; otherwise it waits the remainder, so a restart does not re-check. A failed sweep waits a full interval.lastCheckAtnow uses the injecteddeps.nowclock.plugin-service-internal.ts:scheduleUpdateChecktest seam onPluginServiceDeps.start-server.ts: starts the sweep after plugin startup settles; stops it on shutdown.HOST_DAEMON_PROTOCOL_VERSIONis unchanged.App:
CheckPluginUpdatesButton: a toolbar key (same 32px outline style as the filter/sort keys) that POSTs/plugins/updates/check, invalidates the plugin list so the pills appear, and toasts a summary.PluginsOverview: the button sits in the Installed toolbar beside "New plugin".PluginDetail: an inline "Check" button in the Release section for updatable plugins when no update is known yet.PluginRowSignal: the row's "Update x.y.z" text pill is now a round icon button (PackageReceive, the app's update icon) that matches the status icon beside it; the version lives in the tooltip and the accessible name.Docs:
docs/configuration.md"Plugin updates" now describes the button and the 6-hour sweep. No CLI command changed.How you verified
sweeps for updates on start, then waits a full interval across restartsinplugin-update.test.ts(fails before:startPeriodicUpdateChecksdoes not exist). All 24 tests in that file pass.CheckPluginUpdatesButton.test.tsx(4 tests): toast summary, full check request shape + plugin list invalidation, scoped single-plugin check.pnpm exec turbo run typecheck lint --filter=@bb/app --filter=@bb/serverpass.git:plugin, committed a newer version, clicked the toolbar key → toast "1 plugin update available: updater-demo" and the row pill appeared; detail page showed the candidate; applied the update through the dialog; clicked the inline "Check" → "updater-demo is up to date". Server log/DB confirmed the startup sweep stampedlastCheckAton every installed plugin.Toolbar key after a check (toast + pill):
Row icon button (hovered):
Detail page with the found candidate:
Detail page after applying, inline Check: