From aa2d385a626c5c659e64f7e1a5bf6b568c3b840f Mon Sep 17 00:00:00 2001 From: Hauke Schnau Date: Thu, 23 Apr 2026 06:37:58 +0200 Subject: [PATCH] fix(server): restore CODEX_HOME tilde expansion for Codex launches (#2255) --- apps/server/src/provider/Layers/CodexProvider.ts | 3 ++- apps/server/src/provider/Layers/CodexSessionRuntime.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/server/src/provider/Layers/CodexProvider.ts b/apps/server/src/provider/Layers/CodexProvider.ts index 13069952ae679e2f3ce13c7a76d653cd6723d845..1e48847c52cb99eccc67a882d8a8330b3eec0cfe 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 fbf4aa3dee4464d5519fb3d3b3c2da8846c6d1ef..e45e1825ee2b28249a9b6dd90c82937f99888a80 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", }), ) -- 2.54.0