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.
[codex] Avoid shell for system executables (#2950)
Julius Marminge300f7fd11d61
diff --git a/apps/server/src/diagnostics/ProcessDiagnostics.ts b/apps/server/src/diagnostics/ProcessDiagnostics.tsindex f56bf2165..b8ace8ccb 100644--- a/apps/server/src/diagnostics/ProcessDiagnostics.ts+++ b/apps/server/src/diagnostics/ProcessDiagnostics.ts@@ -280,7 +280,6 @@ const runProcess = Effect.fn("runProcess")(const child = yield* spawner.spawn(ChildProcess.make(input.command, input.args, {cwd: process.cwd(),- shell: process.platform === "win32",}),);const [stdout, stderr, exitCode] = yield* Effect.all(diff --git a/apps/server/src/environment/Layers/ServerEnvironmentLabel.ts b/apps/server/src/environment/Layers/ServerEnvironmentLabel.tsindex 7dc6bc34a..b07425b93 100644--- a/apps/server/src/environment/Layers/ServerEnvironmentLabel.ts+++ b/apps/server/src/environment/Layers/ServerEnvironmentLabel.ts@@ -59,7 +59,6 @@ const runFriendlyLabelCommand = Effect.fn("runFriendlyLabelCommand")(function* (command,args,timeoutBehavior: "timedOutResult",- shell: process.platform === "win32",}).pipe(Effect.option);diff --git a/apps/server/src/project/Layers/RepositoryIdentityResolver.test.ts b/apps/server/src/project/Layers/RepositoryIdentityResolver.test.tsindex a47181c86..1c985cd85 100644--- a/apps/server/src/project/Layers/RepositoryIdentityResolver.test.ts+++ b/apps/server/src/project/Layers/RepositoryIdentityResolver.test.ts@@ -23,7 +23,6 @@ const git = (cwd: string, args: ReadonlyArray<string>) =>return yield* processRunner.run({command: "git",args: ["-C", cwd, ...args],- shell: process.platform === "win32",});}).pipe(Effect.provide(ProcessRunner.layer));diff --git a/apps/server/src/project/Layers/RepositoryIdentityResolver.ts b/apps/server/src/project/Layers/RepositoryIdentityResolver.tsindex 926c1d0c2..4fdaa71de 100644--- a/apps/server/src/project/Layers/RepositoryIdentityResolver.ts+++ b/apps/server/src/project/Layers/RepositoryIdentityResolver.ts@@ -94,7 +94,6 @@ const resolveRepositoryIdentityCacheKey = Effect.fn("resolveRepositoryIdentityCacommand: "git",args: ["-C", cwd, "rev-parse", "--show-toplevel"],timeoutBehavior: "timedOutResult",- shell: process.platform === "win32",}).pipe(Effect.option);if (topLevelResult._tag === "None" || topLevelResult.value.code !== 0) {@@ -119,7 +118,6 @@ const resolveRepositoryIdentityFromCacheKey = Effect.fn("resolveRepositoryIdenticommand: "git",args: ["-C", cacheKey, "remote", "-v"],timeoutBehavior: "timedOutResult",- shell: process.platform === "win32",}).pipe(Effect.option);if (remoteResult._tag === "None" || remoteResult.value.code !== 0) {diff --git a/apps/server/src/terminal/Layers/Manager.ts b/apps/server/src/terminal/Layers/Manager.tsindex 82eb9502c..2eaf19ec1 100644--- a/apps/server/src/terminal/Layers/Manager.ts+++ b/apps/server/src/terminal/Layers/Manager.ts@@ -519,7 +519,6 @@ function windowsInspectSubprocess(timeout: "1500 millis",maxOutputBytes: 32_768,outputMode: "truncate",- shell: process.platform === "win32",timeoutBehavior: "timedOutResult",});}).pipe(diff --git a/packages/ssh/src/command.ts b/packages/ssh/src/command.tsindex 06aa1109e..44cc047aa 100644--- a/packages/ssh/src/command.ts+++ b/packages/ssh/src/command.ts@@ -16,6 +16,7 @@ import { SshCommandError, SshInvalidTargetError } from "./errors.ts";const PUBLISHABLE_T3_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u;const DEFAULT_SSH_COMMAND_TIMEOUT_MS = 60_000;const MAX_SSH_ERROR_OUTPUT_LENGTH = 4_000;+export const SSH_COMMAND = process.platform === "win32" ? "ssh.exe" : "ssh";const encoder = new TextEncoder();@@ -192,15 +193,14 @@ const runSshCommandInScope = Effect.fn("ssh/command.runSshCommand.inScope")(funcconst spawner = yield* ChildProcessSpawner.ChildProcessSpawner;yield* Effect.logDebug("ssh.command.start", {...sshTargetLogFields(target),- command: ["ssh", ...args],+ command: [SSH_COMMAND, ...args],hasStdin: input.stdin !== undefined,timeoutMs: input.timeoutMs ?? DEFAULT_SSH_COMMAND_TIMEOUT_MS,});const child = yield* spawner.spawn(- ChildProcess.make("ssh", args, {+ ChildProcess.make(SSH_COMMAND, args, {env: environment,- shell: process.platform === "win32",stdin: {stream: stdinStream(input.stdin),endOnDone: true,@@ -212,7 +212,7 @@ const runSshCommandInScope = Effect.fn("ssh/command.runSshCommand.inScope")(funcEffect.mapError((cause) =>new SshCommandError({- command: ["ssh", ...args],+ command: [SSH_COMMAND, ...args],exitCode: null,stderr: "",message:diff --git a/packages/ssh/src/tunnel.ts b/packages/ssh/src/tunnel.tsindex 88a30960e..029b76448 100644--- a/packages/ssh/src/tunnel.ts+++ b/packages/ssh/src/tunnel.ts@@ -36,6 +36,7 @@ import {remoteStateKey,resolveSshTarget,runSshCommand,+ SSH_COMMAND,targetConnectionKey,} from "./command.ts";import {@@ -1068,7 +1069,7 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input:`${input.localPort}:127.0.0.1:${input.remotePort}`,hostSpec,];- const tunnelCommand = ["ssh", ...args];+ const tunnelCommand = [SSH_COMMAND, ...args];const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;const scope = yield* Scope.Scope;yield* Effect.logDebug("ssh.tunnel.spawn.start", {@@ -1081,9 +1082,8 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input:});const child = yield* spawner.spawn(- ChildProcess.make("ssh", args, {+ ChildProcess.make(SSH_COMMAND, args, {env: childEnvironment,- shell: process.platform === "win32",stdin: {stream: Stream.empty,endOnDone: true,diff --git a/packages/tailscale/src/tailscale.ts b/packages/tailscale/src/tailscale.tsindex c8d9cab46..cdb549232 100644--- a/packages/tailscale/src/tailscale.ts+++ b/packages/tailscale/src/tailscale.ts@@ -10,6 +10,7 @@ export const DEFAULT_TAILSCALE_SERVE_PORT = 443;export const TAILSCALE_STATUS_TIMEOUT_MS = 1_500;export const TAILSCALE_SERVE_TIMEOUT_MS = 10_000;export const TAILSCALE_PROBE_TIMEOUT_MS = 2_500;+const TAILSCALE_COMMAND = process.platform === "win32" ? "tailscale.exe" : "tailscale";export class TailscaleCommandError extends Data.TaggedError("TailscaleCommandError")<{readonly command: readonly string[];@@ -136,11 +137,7 @@ export const readTailscaleStatus: Effect.Effect<const args = ["status", "--json"];const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;const child = yield* spawner- .spawn(- ChildProcess.make("tailscale", args, {- shell: process.platform === "win32",- }),- )+ .spawn(ChildProcess.make(TAILSCALE_COMMAND, args)).pipe(Effect.mapError((cause) =>tailscaleCommandError(@@ -215,11 +212,7 @@ const runTailscaleCommand = (Effect.gen(function* () {const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;const child = yield* spawner- .spawn(- ChildProcess.make("tailscale", args, {- shell: process.platform === "win32",- }),- )+ .spawn(ChildProcess.make(TAILSCALE_COMMAND, args)).pipe(Effect.mapError((cause) =>tailscaleCommandError(