Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Join Windows shell paths with win32 semantics so the branch works off-Windows

[._.]/ Adam Eivy4c00e67d1233
diff --git a/server/lib/interactiveShellResolver.js b/server/lib/interactiveShellResolver.js
index 7f5b533928..ee4e64c39e 100644
--- a/server/lib/interactiveShellResolver.js
+++ b/server/lib/interactiveShellResolver.js
@@ -39,9 +39,18 @@
*/
import { existsSync, readdirSync } from 'fs';
-import { join } from 'path';
+import { win32 } from 'path';
import { findCommandOnPath } from './processEnv.js';
+// The Windows branch below assembles WINDOWS paths, so it joins with win32
+// semantics rather than the host's. On Windows the two are identical; off it,
+// the platform `join` would splice Windows path fragments with `/` and produce
+// `C:\Program Files/PowerShell/7/pwsh.exe` — which never matches a real path and
+// makes the win32 branch untestable from a POSIX host, the exact thing the
+// injectable `platform` exists to allow. Same reasoning as `win32.basename` in
+// shellCd.js.
+const { join } = win32;
+
/**
* `%ProgramFiles%\PowerShell\<major>\pwsh.exe` for every installed major
* version, newest first. Enumerated rather than hard-coding `7` so a future
diff --git a/server/lib/interactiveShellResolver.test.js b/server/lib/interactiveShellResolver.test.js
index f9d044b9ff..3330d55add 100644
--- a/server/lib/interactiveShellResolver.test.js
+++ b/server/lib/interactiveShellResolver.test.js
@@ -26,6 +26,16 @@ describe('resolveInteractiveShellWith on Windows', () => {
.toBe('C:\\Program Files\\PowerShell\\7\\pwsh.exe');
});
+ it('builds Windows paths with backslashes even when the host is POSIX', () => {
+ // The win32 branch is reachable from any host (that is what injectable
+ // `platform` is for), so it must join with win32 semantics. The platform
+ // `join` produced `C:\Program Files/PowerShell/7/pwsh.exe` on Linux — a path
+ // that matches nothing, silently falling through to cmd.exe.
+ const picked = win({ exists: () => true });
+ expect(picked).toBe('C:\\Program Files\\PowerShell\\7\\pwsh.exe');
+ expect(picked).not.toContain('/');
+ });
+
it('picks the newest installed pwsh major, comparing numerically not as strings', () => {
// '10' must beat '7'; a lexical sort would pick '7'.
expect(win({