From dd335cbc7609b03d12df7fa825257b8baa538dcd Mon Sep 17 00:00:00 2001 From: Bhuvanesh Sridharan Date: Wed, 8 Apr 2026 08:37:29 +0530 Subject: [PATCH] fix: inherit process.env in app-server spawn when no explicit env is provided (#159) `SpawnedCodexAppServerClient.initialize()` passes `this.options.env` to `spawn()`, but no caller ever sets `env` in options. In Node.js, passing `undefined` for `env` gives the child process **no** environment variables, breaking any model provider that relies on env vars (e.g. DATABRICKS_TOKEN). Fall back to `process.env` when `this.options.env` is not set, matching the existing pattern in `broker-lifecycle.mjs` and `codex-companion.mjs`. Co-authored-by: Isaac Co-authored-by: Bhuvanesh Sridharan --- plugins/codex/scripts/lib/app-server.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/codex/scripts/lib/app-server.mjs b/plugins/codex/scripts/lib/app-server.mjs index 7a075a4..127c837 100644 --- a/plugins/codex/scripts/lib/app-server.mjs +++ b/plugins/codex/scripts/lib/app-server.mjs @@ -188,7 +188,7 @@ class SpawnedCodexAppServerClient extends AppServerClientBase { async initialize() { this.proc = spawn("codex", ["app-server"], { cwd: this.cwd, - env: this.options.env, + env: this.options.env ?? process.env, stdio: ["pipe", "pipe", "pipe"], shell: process.platform === "win32" ? (process.env.SHELL || true) : false, windowsHide: true