Better support for workflows that involve multiple source directories#7738
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.
nabalone
left a comment
There was a problem hiding this comment.
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++) |
There was a problem hiding this comment.
[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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
[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.
There was a problem hiding this comment.
I'm investigating the non-use CommandLineParser now...
There was a problem hiding this comment.
Because of when these intial args are needed, it seems the complexity cost of unifying them would be a net loss.
71f43b6 to
2945318
Compare
…vExes # Conflicts: # src/BloomExe/Edit/EditingModel.cs # src/BloomExe/Workspace/WorkspaceView.cs # src/BloomExe/web/BloomServer.cs # src/BloomExe/web/ReactControl.cs
c682aad to
30a13c5
Compare
30a13c5 to
5fe9c37
Compare
| 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}" | ||
| ); | ||
| } |
There was a problem hiding this comment.
📝 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).
Was this helpful? React with 👍 or 👎 to provide feedback.
This change is