Skip to content

Commit aa2d385

Browse files
authored
fix(server): restore CODEX_HOME tilde expansion for Codex launches (#2255)
1 parent e25db3a commit aa2d385

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

apps/server/src/provider/Layers/CodexProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { ServerSettingsError } from "@t3tools/contracts";
2828
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
2929
import { buildServerProvider } from "../providerSnapshot.ts";
3030
import { CodexProvider } from "../Services/CodexProvider.ts";
31+
import { expandHomePath } from "../../pathExpansion.ts";
3132
import { ServerSettingsService } from "../../serverSettings.ts";
3233
import packageJson from "../../../package.json" with { type: "json" };
3334

@@ -222,7 +223,7 @@ const probeCodexAppServerProvider = Effect.fn("probeCodexAppServerProvider")(fun
222223
command: input.binaryPath,
223224
args: ["app-server"],
224225
cwd: input.cwd,
225-
...(input.homePath ? { env: { CODEX_HOME: input.homePath } } : {}),
226+
...(input.homePath ? { env: { CODEX_HOME: expandHomePath(input.homePath) } } : {}),
226227
}),
227228
);
228229
const client = yield* Effect.service(CodexClient.CodexAppServerClient).pipe(

apps/server/src/provider/Layers/CodexSessionRuntime.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
CODEX_DEFAULT_MODE_DEVELOPER_INSTRUCTIONS,
3131
CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS,
3232
} from "../CodexDeveloperInstructions.ts";
33+
import { expandHomePath } from "../../pathExpansion.ts";
3334

3435
const PROVIDER = "codex" as const;
3536

@@ -683,7 +684,9 @@ export const makeCodexSessionRuntime = (
683684
.spawn(
684685
ChildProcess.make(options.binaryPath, ["app-server"], {
685686
cwd: options.cwd,
686-
...(options.homePath ? { env: { ...process.env, CODEX_HOME: options.homePath } } : {}),
687+
...(options.homePath
688+
? { env: { ...process.env, CODEX_HOME: expandHomePath(options.homePath) } }
689+
: {}),
687690
shell: process.platform === "win32",
688691
}),
689692
)

0 commit comments

Comments
 (0)