Use Effect child process for editor launches#2659
Merged
Merged
Conversation
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Contributor
ApprovabilityVerdict: Needs human review This PR replaces the 'open' npm package with a custom browser/editor launch implementation including WSL detection and platform-specific PowerShell encoding. This is a significant runtime behavior change that replaces a mature library with new custom code, warranting human review for cross-platform compatibility. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Contributor
Author
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 78a2cec. Configure here.
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
- Rename the exported layer to `layer` - Import the service namespace explicitly at call sites - Keep server startup and WS wiring aligned with the new shape - Co-authored-by: codex <codex@users.noreply.github.com>
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.

What Changed
apps/server/src/open.tsfromnode:child_processcallbacks to Effect'sChildProcessSpawnerservice.Optioninstead of nullable values where applicable.open.test.tsto verify launches through aLayer.mockchild-process spawner instead of running a real process.Why
This keeps the open/editor launch path closer to idiomatic Effect: process spawning now flows through Effect dependency injection and tests can mock just the child-process layer while preserving the rest of the runtime behavior.
UI Changes
Not applicable.
Checklist
Note
Replace
opennpm package with Effect child process spawning for editor and browser launchesopenpackage dependency and replaces it with directChildProcessSpawnercalls in open.ts, giving the server full control over process lifecycle.resolveBrowserLaunchto select the correct URL-open command per platform:openon macOS, PowerShell with-EncodedCommandon Windows, Windows PowerShell via WSL when not in SSH/container, andxdg-openon other Linux.launchAndUnrefas a shared internal effect that spawns a detached child process, unrefs it, and maps failures toOpenError.launchDetached(used for editor launches) now quotes args on Windows and setsdetached: truewith ignored stdio.stdio: ignoreanddetached: truesemantics instead of relying on theopenpackage defaults.Changes since #2659 opened
detachedoption totruefor Windows browser process launches [78a2cec]OpenInEditorInputtoLaunchEditorInputandOpenErrortoExternalLauncherErrorin the@t3tools/contractspackage, updating theWsShellOpenInEditorRpcRPC definition to use the new payload and error schemas [e6d0166]OpentoExternalLauncher, including the service tag identifier, interface (OpenShapetoExternalLauncherShape), and layer export (OpenLivetoExternalLauncherLive), with method renames fromopenBrowsertolaunchBrowserandopenInEditortolaunchEditor[e6d0166]launchDetachedfunction tolaunchEditorProcesswithin the external launcher module, updating the Effect.fn label and error mapping while preserving the command availability check, spawn options, and win32 quoting behavior [e6d0166]ExternalLauncherservice,ExternalLauncherShapeinterface,ExternalLauncherErrorerror class, andlaunchEditor/launchBrowsermethod names instead of their previousOpen-prefixed counterparts [e6d0166]ExternalLaunchermodule to use namespace export pattern [9e37f0d]ExternalLauncheracross consuming modules [9e37f0d]Macroscope summarized c0bf391.
Note
Medium Risk
Changes cross-platform process spawning for browser/editor launch and updates the RPC/contracts surface, which could affect startup behavior and client integrations if command resolution or platform detection regresses.
Overview
Replaces the
Openmodule with a newExternalLauncherservice (apps/server/src/process/externalLauncher.ts) that launches browsers and editors via Effect’sChildProcessSpawner(detached + ignored stdio), and wires it through runtime layers, startup browser auto-open, and theshell.openInEditorwebsocket RPC.Removes the
opennpm dependency and adds explicit, platform-specific browser command resolution (open/xdg-open/PowerShell, including WSL handling). Updates contracts/RPC schemas by renamingOpenInEditorInput→LaunchEditorInputandOpenError→ExternalLauncherError, and adjusts tests to mock the spawner and cover the new browser-launch mapping.Reviewed by Cursor Bugbot for commit 9e37f0d. Bugbot is set up for automated code reviews on this repo. Configure here.