Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

perf(desktop): probe the Windows shell environment concurrently (#5878)

Tyler8de0aa24d9b0
diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.ts b/apps/desktop/src/shell/DesktopShellEnvironment.ts
index f1b252f29..bd8aa6654 100644
--- a/apps/desktop/src/shell/DesktopShellEnvironment.ts
+++ b/apps/desktop/src/shell/DesktopShellEnvironment.ts
@@ -379,10 +379,18 @@ const installWindowsEnvironment = Effect.fn("desktop.shellEnvironment.installWin
function* (
config: ShellEnvironmentConfig,
): Effect.fn.Return<void, never, ChildProcessSpawner.ChildProcessSpawner> {
- const noProfile = yield* readWindowsEnvironment(["PATH"], { loadProfile: false });
- const profile = yield* readWindowsEnvironment(WINDOWS_PROFILE_ENV_NAMES, {
- loadProfile: true,
- });
+ // Concurrent, not sequential: these two probes are independent (only their
+ // results are combined below) and each spawns its own PowerShell. Run in
+ // series they sit at offset 0 of desktop.startup, before anything else, and
+ // launch traces measured them at 2718ms then 2066ms — the entire 4.8s
+ // startup span, of which desktop.bootstrap is ~30ms.
+ const [noProfile, profile] = yield* Effect.all(
+ [
+ readWindowsEnvironment(["PATH"], { loadProfile: false }),
+ readWindowsEnvironment(WINDOWS_PROFILE_ENV_NAMES, { loadProfile: true }),
+ ],
+ { concurrency: 2 },
+ );
const mergedPath = mergePaths("win32", [
trimNonEmpty(profile.PATH),
trimNonEmpty(knownWindowsCliDirs(config.env).join(";")),