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 <bhuvanesh.sridharan@databricks.com>
This commit is contained in:
Bhuvanesh Sridharan 2026-04-08 08:37:29 +05:30 committed by GitHub
parent 62c351a7bf
commit dd335cbc76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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