fix(desktop): skip slow powershell profile load if node is available - #6301
fix(desktop): skip slow powershell profile load if node is available#6301mohamedmastouri-hue wants to merge 18 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
One finding on the Windows shell-environment fast path: the {} placeholder for a skipped profile probe drops the EnvironmentPatch type and silently disables FNM hydration, and this backend behavior change has no focused test.
Convention referenced: If backend behavior changes, require focused tests (change discipline). The existing Windows test still exercises only the profile-loading path, because it runs against the real NodeServices filesystem where ...\node.exe never exists; the new skip branch is untested.
Posted via Macroscope — Effect Service Conventions
ApprovabilityVerdict: Needs human review This PR changes Windows startup behavior by conditionally skipping PowerShell profile probes based on file system checks. While the performance intent is clear, the new heuristics gate significant behavior and could have edge cases (e.g., other node version managers). The author is also new to this file. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Two issues in the new Windows startup tests: the added cases are currently unreachable (never registered with the test runner), and once registered they depend on real filesystem lookups with Windows path separators, so they cannot pass on non-Windows CI. Since this PR changes Windows startup behavior, the focused tests need to actually run and be platform-independent.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
One retained finding after the restructure into Effect.all: the skipped-profile branch still yields an untyped {}, which widens the tuple element and breaks the later profile.PATH / profile.FNM_DIR reads. Details inline.
Posted via Macroscope — Effect Service Conventions
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Effect service conventions review: one change-discipline finding on the removed concurrency rationale. The service definition, layer, dependency acquisition (yield* FileSystem.FileSystem), and error modeling all look consistent with the conventions, and the new tests are now registered at describe level and platform-independent.
Posted via Macroscope — Effect Service Conventions
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
Dismissing prior approval to re-evaluate 989bfa7
…dmastouri-hue/t3code into fix-windows-startup-delay
There was a problem hiding this comment.
One finding on the new Windows fast-path tests: the knownWindowsCliDirs case does not exercise the path it claims to. Production code changes look consistent with the service conventions (dependency acquired via yield* FileSystem.FileSystem, namespace imports, preserved concurrency rationale).
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
One finding: the fast-path pre-check is fine as an Effect service change (dependency acquired via yield* FileSystem.FileSystem, requirement surfaced in the Effect.fn.Return type, make/layer unchanged), but the Windows path-separator rewrite in knownWindowsCliDirs changes production behavior beyond the perf fix.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 030ff8a. Configure here.
There was a problem hiding this comment.
One convention issue: the new FileSystem usages in the test file have no corresponding namespace import.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
One import-convention violation found in the changed test file. See the inline comment.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
One convention issue found: the test provides a FileSystem tag from a different package than the service under test requires.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
One finding in the test harness: the conditional Effect.provideService leaves FileSystem.FileSystem in the helper's declared requirements, so every it.effect call site in this file no longer typechecks.
Posted via Macroscope — Effect Service Conventions

Fixes #4403 by skipping the slow PowerShell profile load if node.exe is already found in the no-profile path.
Note
Medium Risk
Changes Windows PATH and FNM-related env hydration at startup; early exit may omit profile-only variables when PowerShell is skipped, though fnm users still get full probes.
Overview
Windows desktop startup can now avoid spawning PowerShell entirely when
node.exeis discoverable from known CLI directories and the currentPATH, and no fnm wrapper is present.installWindowsEnvironmentadds a filesystem pre-check (with quoted-path trimming), setsPATHfrom the static merge, and returns early. If fnm is detected alongside Node, the existing two concurrent PowerShell probes still run. When probes run, PATH merging is reordered so profilePATHis layered on top of known dirs, no-profilePATH, and the inherited env.Tests gain optional mock
FileSystemwiring and three cases covering skip vs concurrent probes vs Node only inknownWindowsCliDirs.Reviewed by Cursor Bugbot for commit 5306f4b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Skip PowerShell profile load on Windows when node is statically discoverable
installWindowsEnvironmentnow checks fornode.exein known CLI directories and the current PATH before spawning any PowerShell processes.node.exeis found and nofnmwrapper is present, PATH is set from the static merge and the function returns early, avoiding slow PowerShell profile loads.fnmis detected alongsidenode.exe, two PowerShell probes (one with-NoProfile, one with profile) still run concurrently as before.Macroscope summarized 5306f4b.