Repository navigation
Preserve cached plugin data when switching threads - #6308
Merged
Merged
Conversation
ymichael
added a commit
that referenced
this pull request
Oct 26, 2026
## Human comments ## What was wrong Every plugin frontend waited for the shared Pierre diff engine and syntax-highlighting dependencies, even when it never imported them. This put optional renderer code on the startup path for essential plugins such as the composer and sidebar. ## What changed Rebased onto origin/main after #6295 merged; this PR reuses its lazy SDK renderer components. Plugin builds record their shared runtime dependencies in `app.meta.json` as `runtimeSlots`. The server validates and returns those slots. Before evaluating a plugin, a generic registry loads the required lazy groups in parallel while preloading the plugin bundle. Each group uses a cached, retryable loader; Pierre's core and React bindings are the first group. Each plugin bundle URL is preloaded once, whether the boot hook, the download-ahead step, or the lazy-runtime path asks first. Older artifacts without metadata remain compatible by receiving all runtime slots. Such bundles can still trigger unnecessary Pierre downloads, so mixed installations may see smaller download savings. The normal bundled-plugin build emits the new metadata; no rebuild migration or compiled-bundle inference is introduced. The app's bundle budget adds a PluginFrontend closure that forbids Pierre and Shiki, with limits 25% above its measured 528.9 KB raw / 165.3 KB brotli. Documentation describes the runtime dependency contract and its distinction from render-time SDK component splitting. No server/daemon wire change or public SDK member is introduced. The new response field changes bundled SDK declarations; main's unpublished 0.6.81 bump (#6308) covers it, so this PR does not bump the SDK version again. If 0.6.81 is published before this merges, it needs a new bump. ## How you verified - Production bundle-budget check on the rebased branch passes: PluginFrontend closure is 528.9 KB raw / 165.0 KB brotli beyond the boot payload against the new 661.1 KB / 206.6 KB limits, with Pierre/Shiki excluded. These are combined results with #6295, not an isolated speedup measurement. - Plugin builder suite (13 tests) covers recorded `runtimeSlots`; server artifact suite (13) covers validation and the legacy all-slots fallback; CLI plugin-build suite (9) covers metadata output. - App plugin loading, retry, reload, load-order, boot, cold-renderer and bundle-budget tests pass (97 across the touched files). - Typecheck for app, server, plugin-build, CLI and demo-server passes; app and plugin-build lint pass. - Plugin SDK npm version guard passes (0.6.81 is not yet on npm). - `pnpm exec turbo run prepare:bundled --filter=bb-plugin-bb--composer` passed earlier; its emitted artifact lists `runtimeSlots` without Pierre. No new browser timing measurements were taken for this PR. > AGENT GENERATED --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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
The shared plugin keyed-query cache removed inactive rows when refreshing visible rows. After switching threads, refreshing the current thread's PR could evict the previous thread's cached PR, so switching back hid the banner until another request completed. The same cache also serves per-thread notification settings and third-party keyed RPC reads.
What changed
Retain inactive rows and their key tags during refreshes, track their invalidation separately, and refresh stale rows when consumers subscribe again while displaying their last successful values. Inactive dirty rows no longer suppress subsequent refreshes of active rows. Updated the cache documentation and optimistic-update expectations to reflect retained values. Bumped the Plugin SDK to 0.6.81 because its published runtime bundles include the cache change.
How you verified
Added a table-driven regression for manual refresh, invalidate-all, and key-tag invalidation. All three failed before the fix and pass afterward; the cases also verify immediate cached values on resubscription and repeated active-row refreshes.
pnpm exec turbo run test lint typecheck --filter=@bb/query-tags: 45 tests passed, typecheck passed, lint had no errors and two existing warnings.pnpm exec turbo run test --filter=@get-bb/plugin-sdk -- src/testing/__tests__/rpc-keyed-store-contract.test.tsx src/testing/__tests__/rpc-query-host.test.tsx: 13 tests passed.Started an isolated
pnpm start:worktreeserver and prepared two idle PR threads for manual verification. Server/daemon health and both PR lookups succeeded; browser switching has not been verified by the agent.node packages/plugin-sdk/scripts/check-npm-version-guard.mjs: passed for SDK 0.6.81.