Skip to content

Add a Check for updates button and a 6-hour plugin update sweep - #1966

Merged
SawyerHood merged 6 commits into
mainfrom
bb/add-plugin-update-ui-thr_xc7ubk5ggh
Aug 19, 2026
Merged

SawyerHood merged 6 commits into
mainfrom
bb/add-plugin-update-ui-thr_xc7ubk5ggh

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

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. checkForUpdates only ran when a user ran bb plugin outdated or bb plugin update. The app had a checkPluginUpdates() 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: new startPeriodicUpdateChecks() / stopPeriodicUpdateChecks() with PLUGIN_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. lastCheckAt now uses the injected deps.now clock.
  • plugin-service-internal.ts: scheduleUpdateCheck test seam on PluginServiceDeps.
  • start-server.ts: starts the sweep after plugin startup settles; stops it on shutdown.
  • No wire change between server and host daemon; HOST_DAEMON_PROTOCOL_VERSION is unchanged.

App:

  • New 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

  • New server test sweeps for updates on start, then waits a full interval across restarts in plugin-update.test.ts (fails before: startPeriodicUpdateChecks does not exist). All 24 tests in that file pass.
  • New 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/server pass.
  • E2E in the dev app: installed a local 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 stamped lastCheckAt on every installed plugin.

Toolbar key after a check (toast + pill):

after check

Row icon button (hovered):

icon row

Detail page with the found candidate:

detail

Detail page after applying, inline Check:

detail check

AGENT GENERATED: by Claude Opus 5

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

I am SlopCop. I am reviewing this PR for security, code quality, performance, architecture, duplication, and end-to-end behavior.

(newest, row) =>
row.lastUpdateCheckAt === null
? newest
: Math.max(newest ?? 0, row.lastUpdateCheckAt),

@bb-slop-cop bb-slop-cop Bot Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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 {

@bb-slop-cop bb-slop-cop Bot Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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();

@bb-slop-cop bb-slop-cop Bot Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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()

@bb-slop-cop bb-slop-cop Bot Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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.

@bb-slop-cop bb-slop-cop Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

SawyerHood and others added 2 commits August 19, 2026 23:27
- 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]>
@SawyerHood
SawyerHood merged commit ba2e359 into main Aug 19, 2026
12 checks passed
@SawyerHood
SawyerHood deleted the bb/add-plugin-update-ui-thr_xc7ubk5ggh branch August 19, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant