From 76bd75b9f050549a3a9cb699b2ad9762443c86b1 Mon Sep 17 00:00:00 2001 From: Josh Gratton Date: Sat, 13 Jun 2026 10:50:55 -0400 Subject: [PATCH] fix(server): run provider update commands through the shell on Windows Provider update executables are package-manager launcher shims (`npm` -> `npm.cmd`, `pnpm` -> `pnpm.cmd`, etc.). On Windows a bare-name spawn does not resolve PATHEXT, so `ChildProcess.spawn("npm", ...)` fails with ENOENT, surfaced to users as "Failed to run update command npm: NotFound". This broke one-click updates for every npm/pnpm/bun/vp-managed provider on the Windows backend. Spawn the maintenance command with `shell: true` on win32 so the shell resolves the shim, matching how every other provider command is already spawned (ClaudeProvider, CodexSessionRuntime, CursorProvider, GrokProvider, opencodeRuntime, AcpSessionRuntime). The update args are a fixed allowlist of package names, so there is no shell-injection surface. --- apps/server/src/provider/providerMaintenanceRunner.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/providerMaintenanceRunner.ts b/apps/server/src/provider/providerMaintenanceRunner.ts index f04e97a13e..91120b48be 100644 --- a/apps/server/src/provider/providerMaintenanceRunner.ts +++ b/apps/server/src/provider/providerMaintenanceRunner.ts @@ -76,7 +76,16 @@ const runProviderMaintenanceCommandWithSpawner = Effect.fn("ProviderMaintenanceR const collectCommandResult = Effect.fn("ProviderMaintenanceRunner.collectCommandResult")( function* () { const child = yield* input.spawner - .spawn(ChildProcess.make(input.command, [...input.args])) + .spawn( + ChildProcess.make(input.command, [...input.args], { + // The update executable is usually a launcher shim (e.g. `npm` -> + // `npm.cmd`, `pnpm` -> `pnpm.cmd`). On Windows a bare-name spawn + // does not resolve PATHEXT, so it fails with ENOENT; run through + // the shell so the shim resolves, matching how every other + // provider command is spawned on Windows. + shell: process.platform === "win32", + }), + ) .pipe( Effect.mapError( (cause) =>