The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 14:00 UTC
fix(shared): preserve Windows shell PATH priority (#8748)
Utkarsh Patil committed
Sep 1, 2026 at 05:18 UTC
929f7e6479d00754dee4e4554b24b25478b8064d
2 files changed
+8
-6
packages/shared/src/shell.test.ts
+5
-5
@@ -460,7 +460,7 @@ effectIt.layer(NodeServices.layer)("resolveSpawnCommand", (it) => {
460
});
461
462
effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
463
- it.effect("returns the baseline no-profile PATH patch when node is already available", () =>
463
+ it.effect("uses known CLI directories as a fallback without changing shell PATH priority", () =>
464
Effect.gen(function* () {
465
const readEnvironment = vi.fn(
466
(_names: ReadonlyArray<string>, options?: { loadProfile?: boolean }) =>
@@ -483,6 +483,8 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
483
),
484
).toEqual({
485
PATH: [
486
+ "C:\\Shell\\Bin",
487
+ "C:\\Windows\\System32",
488
"C:\\Users\\testuser\\AppData\\Roaming\\npm",
489
"C:\\Users\\testuser\\AppData\\Local\\Programs\\nodejs",
490
"C:\\Users\\testuser\\AppData\\Local\\Volta\\bin",
@@ -490,8 +492,6 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
492
"C:\\Users\\testuser\\.local\\bin",
493
"C:\\Users\\testuser\\.bun\\bin",
494
"C:\\Users\\testuser\\scoop\\shims",
493
- "C:\\Shell\\Bin",
494
- "C:\\Windows\\System32",
495
].join(";"),
496
});
497
expect(readEnvironment).toHaveBeenCalledTimes(1);
@@ -532,6 +532,7 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
532
PATH: [
533
"C:\\Profile\\Node",
534
"C:\\Windows\\System32",
535
+ "C:\\Shell\\Bin",
536
"C:\\Users\\testuser\\AppData\\Roaming\\npm",
537
"C:\\Users\\testuser\\AppData\\Local\\Programs\\nodejs",
538
"C:\\Users\\testuser\\AppData\\Local\\Volta\\bin",
@@ -539,7 +540,6 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
540
"C:\\Users\\testuser\\.local\\bin",
541
"C:\\Users\\testuser\\.bun\\bin",
542
"C:\\Users\\testuser\\scoop\\shims",
542
- "C:\\Shell\\Bin",
543
].join(";"),
544
FNM_DIR: "C:\\Users\\testuser\\AppData\\Roaming\\fnm",
545
FNM_MULTISHELL_PATH: "C:\\Users\\testuser\\AppData\\Local\\fnm_multishells\\123",
@@ -576,11 +576,11 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
576
),
577
).toEqual({
578
PATH: [
579
+ "C:\\Windows\\System32",
580
"C:\\Users\\testuser\\AppData\\Roaming\\npm",
581
"C:\\Users\\testuser\\.local\\bin",
582
"C:\\Users\\testuser\\.bun\\bin",
583
"C:\\Users\\testuser\\scoop\\shims",
583
- "C:\\Windows\\System32",
584
].join(";"),
585
FNM_DIR: "C:\\Users\\testuser\\AppData\\Roaming\\fnm",
586
});
packages/shared/src/shell.ts
+3
-1
@@ -728,7 +728,9 @@ export const resolveWindowsEnvironment = Effect.fn("shell.resolveWindowsEnvironm
728
}).PATH;
729
const mergedPath = mergePathValues(shellPath, inheritedPath, "win32");
730
const knownCliPath = resolveKnownWindowsCliDirs(env).join(WINDOWS_PATH_DELIMITER);
731
- const baselinePath = mergePathValues(knownCliPath, mergedPath, "win32");
731
+ // Preserve the order a user's shell uses. These directories fill gaps when
732
+ // desktop apps launch without the full interactive-shell PATH.
733
+ const baselinePath = mergePathValues(mergedPath, knownCliPath, "win32");
734
const baselinePatch: Partial<NodeJS.ProcessEnv> = baselinePath ? { PATH: baselinePath } : {};
735
const baselineEnv = mergeWindowsEnv(env, baselinePatch);
736