Skip to content

Better support for workflows that involve multiple source directories#7738

Open
hatton wants to merge 8 commits intomasterfrom
BL-16014-MultipleDevExes
Open

Better support for workflows that involve multiple source directories#7738
hatton wants to merge 8 commits intomasterfrom
BL-16014-MultipleDevExes

Conversation

@hatton
Copy link
Member

@hatton hatton commented Mar 14, 2026

This change is Reviewable

hatton added 4 commits March 13, 2026 14:52
* an agent skill.md and scripts for starting, stopping, and connecting to Bloom.ex

* api/common/instanceInfo now gives information like the path to the exe file so that agents and tests can check that they are talking to the right bloom (vs. one in another worktree entirely)

Future:  allow multiple Blooms to be running.  e.g.
Add startup arguments for HTTP port and CDP port.
Bypass the single-instance token when given the ports.
Update the helper scripts to launch Bloom with explicit ports.
Make sure agents and tests kill the exact bloom they ran; they should be able to determine the pid.
Allows tests or agents to launch their own copies of bloom.exe on their own ports, lessoning the chance of stepping on other running versions running from different code directories.

Does not yet include any kind of principled random port choosing.
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Member Author

@hatton hatton left a comment

Choose a reason for hiding this comment

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

[GPT-5.4] Addressed the remaining feedback in ca63b5d and added line comments with the specifics.

@hatton hatton marked this pull request as ready for review March 14, 2026 22:00
Copilot AI review requested due to automatic review settings March 14, 2026 22:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves developer/automation workflows for running multiple Bloom instances (and/or multiple worktrees) by adding explicit startup port/label support, reserving a larger port block, and providing Node/Playwright tooling to launch and attach to the embedded WebView2 via CDP.

Changes:

  • Add startup parsing for --http-port, --cdp-port, --vite-port, and --label, and use these to support multi-instance startup flows.
  • Reserve a 3-port HTTP block (http, websocket, +1 extra reserved), expose common/instanceInfo, and improve Vite-dev port/origin handling.
  • Add automation scripts (watchBloomExe.mjs, go.mjs, bloom-automation helpers) and exe-backed Playwright smoke tests.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/BloomTests/ProgramTests.cs Adds unit tests for startup argument parsing and validation.
src/BloomExe/web/controllers/CommonApi.cs Adds common/instanceInfo endpoint for automation/runtime discovery.
src/BloomExe/web/ReactControl.cs Supports dynamic Vite dev ports and origin replacement; adds dev-server reachability checks.
src/BloomExe/web/BloomServer.cs Reserves a 3-port block; checks companion port availability; centralizes websocket port calculation.
src/BloomExe/Workspace/WorkspaceView.cs Replaces hard-coded websocket port math and supports Vite origin replacement in templates.
src/BloomExe/WebView2Browser.cs Makes remote debugging port configurable via --cdp-port (defaulting to 9222 only in DEBUG).
src/BloomExe/Shell.cs Updates window title to optionally show label and port summaries.
src/BloomExe/ProjectContext.cs Uses centralized websocket port accessor.
src/BloomExe/Edit/ToolboxView.cs Ensures Vite dev HTML templates use the correct origin when a non-default Vite port is chosen.
src/BloomExe/Edit/PageThumbnailList.cs Rewrites Vite dev origin in thumbnail list template when applicable.
src/BloomExe/Edit/EditingModel.cs Rewrites Vite dev origin in edit/page-list templates when applicable.
src/BloomExe/Book/Book.cs Stops hard-coding Vite origin; uses helper to build Vite dev URLs.
src/BloomBrowserUI/scripts/go.mjs New script to start Vite on a random/selected port, wait for readiness, then launch Bloom with matching --vite-port.
src/BloomBrowserUI/react_components/component-tester/playwright.bloom-exe.config.ts Adds a Playwright config for exe-backed UI tests.
src/BloomBrowserUI/react_components/component-tester/bloomExeCdp.ts Helpers to connect to Bloom’s embedded WebView2 over CDP and query workspace tab state.
src/BloomBrowserUI/react_components/TopBar/component-tests/bloom-exe-tabs.uitest.ts Adds exe-backed Playwright tests for tab switching and basic console/network observability.
src/BloomBrowserUI/react_components/TopBar/CollectionTopBarControls/component-tests/bloom-exe-collection-topbar.uitest.ts Adds an exe-backed Playwright smoke test for collection top bar controls.
src/BloomBrowserUI/package.json Adds exe and go scripts to launch watch/run and combined Vite+Exe flow.
scripts/watchBloomExe.mjs New repo-level launcher for dotnet watch run with explicit port leasing and readiness detection.
go.sh Convenience wrapper for running the combined go.mjs flow from repo root.
ReadMe.md Updates build/dev instructions to use ./go.sh; clarifies feedback env var guidance.
.github/skills/bloom-automation/webview2Targets.mjs Adds helper to list CDP targets (optionally selecting an instance via common/instanceInfo).
.github/skills/bloom-automation/switchWorkspaceTab.mjs Adds helper to attach via CDP and switch tabs by clicking the real top bar.
.github/skills/bloom-automation/killBloomProcess.mjs Adds helper to terminate Bloom/dotnet-watch processes with instance targeting.
.github/skills/bloom-automation/bloomProcessStatus.mjs Adds helper to report running Bloom/watch processes and endpoint reachability.
.github/skills/bloom-automation/bloomProcessCommon.mjs Shared automation utilities: port leasing, instance discovery, process classification, and endpoint helpers.
.github/skills/bloom-automation/SKILL.md Documents the new Bloom exe CDP automation workflow and helper commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { fileURLToPath } from "node:url";

const standardBloomStartingHttpPort = 8089;
const standardBloomPortIncrement = 2;
errorMessage = $"Bloom requires a value after {optionName}.";
return true;
}

Comment on lines +845 to +849
&& StartupCdpPort.Value <= StartupHttpPort.Value + 2
)
{
errorMessage =
"Bloom's --cdp-port must not overlap the reserved HTTP block (http, http+1, http+2).";
Comment on lines +1489 to +1496
{
for (var i = 0; !success && i < kNumberOfPortsToTry; i++)
{
BloomServer.portForHttp = kStartingPort + (i * kNumberOfPortsWeNeed);
success =
AreReservedCompanionPortsAvailable(BloomServer.portForHttp)
&& AttemptToOpenPort();
}
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