Skip to content

Better support for workflows that involve multiple source directories#7738

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

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

Conversation

@hatton
Copy link
Copy Markdown
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
Copy Markdown
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

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@nabalone nabalone left a comment

Choose a reason for hiding this comment

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

I didn't really review the .mjs scripts, thinking we would notice if there's something wrong with them. But let me know if I should


var remainingArgs = new List<string>();

for (var i = 0; i < args.Length; i++)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Worded by Devin]

Suggestion: consider simplifying this hand-rolled argument loop

This codebase already uses the CommandLineParser NuGet library (imported at , used at lines 214–264 with attribute-decorated classes like HydrateParameters in ). The 120-line hand-rolled loop here is inconsistent with that existing pattern.

Duplication: The three port option blocks (lines 746–812) are near-identical copy-paste that differ only in the option name and backing property. A dictionary-driven approach or a small shared helper could cut the loop body to ~20 lines:

var portOptions = new Dictionary<string, Action>
{
["--http-port"] = v => StartupHttpPort = SetOnce(StartupHttpPort, v, "--http-port"),
["--cdp-port"] = v => StartupCdpPort = SetOnce(StartupCdpPort, v, "--cdp-port"),
["--vite-port"] = v => StartupVitePort = SetOnce(StartupVitePort, v, "--vite-port"),
};

Bug — --label swallows flags: TryParseStartupStringArgument (line 876) unconditionally accepts the next token as the value, so --label --help silently treats --help as the label. The Node.js helpers in this same PR explicitly reject values starting with -- (e.g. requireOptionValue in bloomProcessCommon.mjs), but the C# side doesn't.

Magic number: The overlap check at line 845 hard-codes + 2 instead of referencing BloomServer.ReservedPortBlockLength, as also noted in the existing Copilot review thread.

Not blocking, but worth a cleanup pass — especially the --label flag-swallowing issue.

Copy link
Copy Markdown
Contributor

@nabalone nabalone Mar 23, 2026

Choose a reason for hiding this comment

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

If we want to keep Program.cs clean I thought this might be worth doing, and an AI could do it quickly. But feel free to ignore and merge

Copy link
Copy Markdown
Member Author

@hatton hatton Mar 27, 2026

Choose a reason for hiding this comment

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

[GTP-5.4] Leaving this as-is. The cleanup/refactor suggestion is optional, and the two concrete issues it called out are already handled on the current branch: --label now rejects option-looking values, and the old + 2 overlap check is no longer present.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm investigating the non-use CommandLineParser now...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because of when these intial args are needed, it seems the complexity cost of unifying them would be a net loss.

devin-ai-integration[bot]

This comment was marked as resolved.

@hatton hatton force-pushed the BL-16014-MultipleDevExes branch from 71f43b6 to 2945318 Compare March 27, 2026 23:34
…vExes

# Conflicts:
#	src/BloomExe/Edit/EditingModel.cs
#	src/BloomExe/Workspace/WorkspaceView.cs
#	src/BloomExe/web/BloomServer.cs
#	src/BloomExe/web/ReactControl.cs
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@hatton hatton force-pushed the BL-16014-MultipleDevExes branch from c682aad to 30a13c5 Compare March 28, 2026 15:59
@hatton hatton force-pushed the BL-16014-MultipleDevExes branch from 30a13c5 to 5fe9c37 Compare March 28, 2026 16:07
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 11 additional findings in Devin Review.

Open in Devin Review

Comment on lines +567 to +574
if (StartupAutomation)
{
// Automation startup is the intentional multi-instance path.
// Since this is a developer-only situation, we won't worry about the possibility of multiple instances writing on the same collection settings or whatever.
Logger.WriteEvent(
$"Bypassing Bloom's single-instance token because automation startup was requested. {StartupRequestedPortSummary}"
);
}
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot Mar 28, 2026

Choose a reason for hiding this comment

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

📝 Info: Automation path intentionally skips single-instance token

When --automation is passed, the code skips UniqueToken.AcquireToken entirely (neither acquiring nor attempting). This means: (1) multiple --automation instances can run simultaneously, (2) a normal Bloom holding the token can coexist with automation instances, (3) automation instances skip TempFile.CleanupTempFolder() on exit since _ownsSingleInstanceToken is false. The shared-state conflicts mentioned in the comment (line 565) are real — e.g., multiple instances writing to the same Settings.Default file, or both trying to use the same collection folder — but this is accepted for the automation use case. The Ctrl-key multi-instance path (src/BloomExe/Program.cs:571-577) was also simplified: it no longer sets a RunningSecondInstance flag (which was removed entirely with zero remaining references).

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

3 participants