Skip to content

refactor: Move default cluster startup to background#709

Merged
rekmarks merged 4 commits intomainfrom
rekm/move-default-cluster-startup
Dec 15, 2025
Merged

refactor: Move default cluster startup to background#709
rekmarks merged 4 commits intomainfrom
rekm/move-default-cluster-startup

Conversation

@rekmarks
Copy link
Copy Markdown
Member

@rekmarks rekmarks commented Dec 12, 2025

Moves the logic for conditionally starting the default subcluster from the kernel worker to the extension background. This is accomplished by means of making the ui-connections module agnostic of where it is used and refactoring it into internal-connections, establishing such a connection from the extension background, and using kernel RPC calls to conditionally launch the default subcluster. UI <-> kernel connections should work exactly the same as before.

The default subcluster is really just for testing, and we shouldn't enshrine it in kernel-browser-runtime, which we eventually want to use in production environments.


Note

Moves default subcluster launch from the kernel worker to the extension background via a new internal comms API, replacing ui-connections and updating consumers.

  • Extension (packages/extension/src/background.ts):
    • Add startDefaultSubcluster() using connectToKernel and RPC (getStatus/launchSubcluster) to conditionally start the default subcluster.
    • Pipe offscreen responses via a single drainPromise and await it; minor init sequencing tweaks.
  • Kernel Browser Runtime:
    • Internal Comms: Introduce internal-comms with connectToKernel, receiveInternalConnections, and comms-control-message (replaces ui-connections/ui-control-command).
    • Exports: Update src/index.ts and index.test.ts to expose new APIs.
    • Kernel Worker: Switch to receiveInternalConnections; remove first-run/default subcluster launch; keep remote comms init only.
    • RPC: Update launch-subcluster result type to nullable CapData.
    • Tests: Add/replace tests for internal comms and control message validation.
  • Kernel UI (packages/kernel-ui/src/services/stream.ts):
    • Replace establishKernelConnection with connectToKernel (adds label).
  • Tooling:
    • Adjust coverage thresholds in vitest.config.ts.

Written by Cursor Bugbot for commit 83e126b. This will update automatically on new commits. Configure here.

@rekmarks rekmarks requested a review from a team as a code owner December 12, 2025 23:38
@rekmarks rekmarks force-pushed the rekm/move-default-cluster-startup branch from 7475e4d to 83e126b Compare December 13, 2025 00:24
Copy link
Copy Markdown
Contributor

@sirtimid sirtimid left a comment

Choose a reason for hiding this comment

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

LGTM!

@rekmarks rekmarks merged commit 96138ea into main Dec 15, 2025
26 checks passed
@rekmarks rekmarks deleted the rekm/move-default-cluster-startup branch December 15, 2025 19:16
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