Skip to content

Fix project and plugin startup races - #3183

Merged
SawyerHood merged 3 commits into
get-bb:mainfrom
MacHatter1:fix/startup-projects-and-plugins
Sep 9, 2026
Merged

SawyerHood merged 3 commits into
get-bb:mainfrom
MacHatter1:fix/startup-projects-and-plugins

Conversation

@MacHatter1

@MacHatter1 MacHatter1 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

Project reads called thread-creation default resolution, which requires an available provider. The server accepts requests before plugin initialization finishes, so project lists, sidebar bootstrap, and execution-default reads could return HTTP 409 during startup. Separately, a browser could cache the initial “not loaded” plugin snapshot and miss the transient plugins-changed event before its WebSocket connected, leaving plugin frontends unavailable until manually reloaded.

What changed

Project read routes now return persisted execution defaults without requiring provider registration. Thread-creation validation remains in place. Every WebSocket connection invokes the existing plugin-change handler to refresh plugin queries and reconcile frontends, covering both initial connections and reconnects. Plugins now report a neutral starting status through the existing API, SDK, and CLI while initialization is pending. The sidebar shows loading placeholders on first launch and retains remembered panel labels until server startup and frontend reconciliation finish. The plugin SDK is bumped to 0.4.51 so the changed generated status type reaches npm consumers. No server/daemon wire changes.

How you verified

Reproduced on a fresh worktree from origin/main at 6cdb4ba before applying the fixes: the project-startup regression failed with HTTP 409, initial-connection and reconnect frontend regressions failed, and the manual-reload control passed. After applying the fixes:

  • Server tests: 45 passed via pnpm exec turbo run test --filter=@bb/server -- test/public/public-project-startup.test.ts test/public/public-threads.defaults.test.ts test/threads/thread-default-policy.test.ts.
  • App tests: 119 passed via pnpm exec turbo run test --filter=@bb/app -- src/hooks/plugin-startup-recovery.test.ts src/hooks/realtime-cache-effects.test.ts src/hooks/system-cache-effects.test.ts src/lib/plugin-frontend-reload.test.ts src/lib/plugin-frontend-lazy.test.ts.
  • pnpm exec turbo run typecheck --filter=@bb/app --filter=@bb/server, formatting, and git diff --check passed.
  • Installed eight additional plugins in an isolated source app. All 24 enabled plugins ran after a cold restart. Two startup probes successfully read projects, sidebar bootstrap, and execution defaults before provider plugins loaded, recovering the persisted project with one initialization per boot.
  • A controlled browser race served the initial unavailable-plugin snapshot and delayed WebSocket connection. Releasing the connection recovered all 16 frontends without a page or plugin reload. Opened both probe panels, Tasks, and ThreadChat demo through browser clicks after restart.

Live coverage is the source web app, not the packaged desktop app. The controlled proxy produced an unrelated daemon-status CORS error; direct-app panel checks had no page exceptions. The verification inventory also reports a pre-existing unmapped browser CLI family on the unchanged base.

Independent review of b1a11fa: restoring the pre-fix project route and connection handler reproduced HTTP 409 on sidebar bootstrap and failed frontend recovery on initial connection and reconnection; the reload-notification control passed. The final implementation passed 77 selected server tests, 189 selected app tests, and app/server typechecks. These independent reproductions used server and simulated-browser test harnesses.

Close-out validation after rebasing and the SDK version bump: SDK build and npm publication guard passed; app/server typechecks passed; 46 selected app tests and 35 selected server tests passed. The working tree and commit-range private-name scan was clean.

AGENT GENERATED

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Thanks @MacHatter1 for the PR. This repo needs approval before a PR. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ) and explain what you want to open a PR for and why. A maintainer then adds you to the allow list. This PR now closes on its own. Reopen it or open a new one after approval.

@github-actions github-actions Bot closed this Sep 6, 2026
@SawyerHood SawyerHood reopened this Sep 9, 2026
@SawyerHood
SawyerHood force-pushed the fix/startup-projects-and-plugins branch from b1a11fa to 7ed3b03 Compare September 9, 2026 17:14
@SawyerHood
SawyerHood merged commit a86e829 into get-bb:main Sep 9, 2026
14 checks passed
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.

2 participants