Repository navigation
Deduplicate cold-load network requests - #2672
Conversation
…th-dev-browser-thr_2fun4nxmap
## What was wrong PR #2616 removed the `host.list_branches` command from the host daemon contract and its dispatch table, but one call to it stayed behind in `host-branches-dispatch.test.ts`. `main` is red: `tsc` reports TS2820 for the unknown command type, and the test itself throws `onlineRpcHandlers[command.type] is not a function`. ## What changed - `apps/host-daemon/test/command/host-branches-dispatch.test.ts` dispatches `host.inspect_git_source` with `remoteRefresh: "blocking"`, like the other tests in the same describe block. A blocking refresh keeps the promise pending until the fetch ends, which is what this test waits for. ## How you verified - `pnpm exec turbo run typecheck test --filter=@bb/host-daemon` passes, 45 test files. The repaired test runs instead of throwing. > AGENT GENERATED Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
This PR gives early app startup and React one shared QueryClient.
It joins matching system config and plugin inventory requests. It also fixes the pending-interaction freshness policy.
I found two event paths that still need work.
- A
config-changedevent can start two config requests. The second refresh cancels the first request. - A persisted page restore can reuse the plugin inventory for 30 seconds. The page can miss plugin changes during the freeze.
I found no confirmed security defect. The product has no supported same-page server or user transition.
The focused app suite passed all 88 tests. All GitHub CI checks passed.
I could not complete browser QA. The checkout-specific dev server stayed in the plugin SDK type build for 20 minutes.
Please add one test for each event sequence. The inline comments give the exact cases.
|
@slopcop ready for re-review at f69b465. Addressed only the two demonstrated issues:
Validation:
Complexity audit: runtime delta is +20/-2 lines. One cache-owner operation and one lifecycle dependency were introduced; no new cache, flag, retry manager, or global mutable state. No code comments were added. The reviewer-deferred residuals and side channels remain unchanged. |
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
This pull request gives system configuration and plugin inventory one shared cache. This removes duplicate start requests from separate owners.
It also preserves active plugin frontends after an inventory failure. It restores the shared freshness default for pending interactions.
I found four issues that should be fixed before merge:
- High: A
plugins-changedevent can join an older inventory request. The old result can clear invalidation and retain stale plugin code. - High: A failed inventory refresh can retain registrations, CSS, and content scripts after an authorization or revocation failure.
- Medium: A later configuration event can join an older request. The app can then retain old settings or local helper ports.
- Medium: A quick remount can miss a pending interaction because the new two-second freshness value prevents the baseline request.
The shared QueryClient is the correct architectural owner. I found no second production owner for either new shared query.
The old fetchPluginList wrapper now has no production caller. You can remove it as a small follow-up cleanup.
Three focused Turbo runs passed the changed query and cache tests. The largest run passed 58 tests.
The browser test loaded the shell once. Plugin rebuilds and a slow provider request prevented a stable end-to-end request-count result.
The final GPT-5.6 review gate confirmed the four defects and returned REQUEST CHANGES. I am posting a comment review, as required.
|
Addressed the four latest review findings in 0d32f9e.
Validation:
Complexity audit: runtime delta is +65 net lines across the four fixes. One cache-owner operation and one local query-cache subscription were added. There is no new global cache, retry manager, feature flag, or code comment. |
|
Simplified the plugin refresh path in 6c8a0c2. The serialized frontend reconciliation module now owns the full refresh sequence: wait for the current boot/reconcile, mark the shared plugin inventory stale, then reconcile or reboot torn-down state. The lazy loader and page-lifecycle adapter only request reconciliation. The cache owner still joins an unrelated in-flight inventory query before invalidating, so the demonstrated stale-response race remains covered. Complexity delta for this pass: 21 additions, 84 deletions; runtime code is 13 net lines smaller; the page-lifecycle interface shrank from four operations to two; no new helper, cache, flag, retry manager, or code comment. Validation:
|
Human comments
What was wrong
Cold app loads had multiple owners for the same system-config and plugin-list resources, while pending-interaction query options accidentally overwrote the shared QueryClient freshness default with
undefined. The plugin frontend loader also interpreted a failed shared query as an authoritative empty installation set, and overlapping initial-connection atom refreshes repeated local daemon discovery.What changed
The app now has one shared QueryClient for React and non-React owners, with stable shared query options for system config and the installed-plugin list. Plugin frontend reconciliation reuses that query and preserves active frontends when inventory loading fails. Pending interactions inherit the app freshness default unless callers provide an override, while stale remounts still revalidate. The redundant local-daemon connection refresh was removed, cache writers use the raw installed-plugin array shape, and narrow regressions cover each ownership and failure boundary.
There are no wire, daemon protocol, CLI, guide, or public Plugin SDK changes.
Review requested from @slopcop.
How you verified
The regressions failed before the fixes and pass afterward. Browser verification used the copied production repro database and confirmed one cold request each for system config, plugins, thread include, interactions, daemon status, and workspace targets. Hosts and sidebar retain their intentional initial-connect race-closing revalidation.
pnpm exec turbo run test --filter=@bb/app --force: 443 files passed; 3,510 tests passed and 3 skippedpnpm exec turbo run typecheck --filter=@bb/app --force: passedpnpm exec turbo run build --filter=@bb/app --force: passedpnpm exec turbo run lint --filter=@bb/app --force: 0 errorsoxfmt --checkandgit diff --check: passedFixes: none