From 62f52fc5343363f079de0de150ea0fdbb92590b3 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Thu, 15 Jan 2026 20:43:40 +0000 Subject: [PATCH 1/5] fix(server): spawn opencode shims via Windows shells --- packages/server/src/workspaces/runtime.ts | 44 +++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/server/src/workspaces/runtime.ts b/packages/server/src/workspaces/runtime.ts index 6861f385..5754d4b7 100644 --- a/packages/server/src/workspaces/runtime.ts +++ b/packages/server/src/workspaces/runtime.ts @@ -5,6 +5,41 @@ import { EventBus } from "../events/bus" import { LogLevel, WorkspaceLogEntry } from "../api-types" import { Logger } from "../logger" +const WINDOWS_CMD_EXTENSIONS = new Set([".cmd", ".bat"]) +const WINDOWS_POWERSHELL_EXTENSIONS = new Set([".ps1"]) + +function buildSpawnSpec(binaryPath: string, args: string[]) { + if (process.platform !== "win32") { + return { command: binaryPath, args, options: {} as const } + } + + const extension = path.extname(binaryPath).toLowerCase() + + if (WINDOWS_CMD_EXTENSIONS.has(extension)) { + const comspec = process.env.ComSpec || "cmd.exe" + // cmd.exe requires the full command as a single string. + // Using the ""