Better support for workflows that involve multiple source directories#7738
Open
Better support for workflows that involve multiple source directories#7738
Conversation
* 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.
Contributor
There was a problem hiding this comment.
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(); | ||
| } |
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.
This change is