Skip to content

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.

fix(server): restore CODEX_HOME tilde expansion for Codex launches (#2255)

Hauke Schnauaa2d385a626c
diff --git a/apps/server/src/provider/Layers/CodexProvider.ts b/apps/server/src/provider/Layers/CodexProvider.ts
index 13069952a..1e48847c5 100644
--- a/apps/server/src/provider/Layers/CodexProvider.ts
+++ b/apps/server/src/provider/Layers/CodexProvider.ts
@@ -28,6 +28,7 @@ import { ServerSettingsError } from "@t3tools/contracts";
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
import { buildServerProvider } from "../providerSnapshot.ts";
import { CodexProvider } from "../Services/CodexProvider.ts";
+import { expandHomePath } from "../../pathExpansion.ts";
import { ServerSettingsService } from "../../serverSettings.ts";
import packageJson from "../../../package.json" with { type: "json" };
@@ -222,7 +223,7 @@ const probeCodexAppServerProvider = Effect.fn("probeCodexAppServerProvider")(fun
command: input.binaryPath,
args: ["app-server"],
cwd: input.cwd,
- ...(input.homePath ? { env: { CODEX_HOME: input.homePath } } : {}),
+ ...(input.homePath ? { env: { CODEX_HOME: expandHomePath(input.homePath) } } : {}),
}),
);
const client = yield* Effect.service(CodexClient.CodexAppServerClient).pipe(
diff --git a/apps/server/src/provider/Layers/CodexSessionRuntime.ts b/apps/server/src/provider/Layers/CodexSessionRuntime.ts
index fbf4aa3de..e45e1825e 100644
--- a/apps/server/src/provider/Layers/CodexSessionRuntime.ts
+++ b/apps/server/src/provider/Layers/CodexSessionRuntime.ts
@@ -30,6 +30,7 @@ import {
CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,
CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS,
} from "../CodexDeveloperInstructions.ts";
+import { expandHomePath } from "../../pathExpansion.ts";
const PROVIDER = "codex" as const;
@@ -683,7 +684,9 @@ export const makeCodexSessionRuntime = (
.spawn(
ChildProcess.make(options.binaryPath, ["app-server"], {
cwd: options.cwd,
- ...(options.homePath ? { env: { ...process.env, CODEX_HOME: options.homePath } } : {}),
+ ...(options.homePath
+ ? { env: { ...process.env, CODEX_HOME: expandHomePath(options.homePath) } }
+ : {}),
shell: process.platform === "win32",
}),
)