diff --git a/CHANGELOG.md b/CHANGELOG.md index ec9e59601..dccb02aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Changes - macOS: prompt to install the global `clawdbot` CLI when missing in local mode; install via `clawd.bot/install-cli.sh` (no onboarding) and use external launchd/CLI instead of the embedded gateway runtime. +### Fixes +- CLI/Update: preserve base environment when passing overrides to update subprocesses. (#713) — thanks @danielz1z. + ## 2026.1.10 ### Highlights diff --git a/src/process/exec.test.ts b/src/process/exec.test.ts index 3cb917c3e..b04679989 100644 --- a/src/process/exec.test.ts +++ b/src/process/exec.test.ts @@ -19,4 +19,31 @@ describe("runCommandWithTimeout", () => { expect(result.code).toBe(0); expect(result.stdout).toBe("ok"); }); + + it("merges custom env with process.env", async () => { + const previous = process.env.CLAWDBOT_BASE_ENV; + process.env.CLAWDBOT_BASE_ENV = "base"; + try { + const result = await runCommandWithTimeout( + [ + process.execPath, + "-e", + 'process.stdout.write((process.env.CLAWDBOT_BASE_ENV ?? "") + "|" + (process.env.CLAWDBOT_TEST_ENV ?? ""))', + ], + { + timeoutMs: 5_000, + env: { CLAWDBOT_TEST_ENV: "ok" }, + }, + ); + + expect(result.code).toBe(0); + expect(result.stdout).toBe("base|ok"); + } finally { + if (previous === undefined) { + delete process.env.CLAWDBOT_BASE_ENV; + } else { + process.env.CLAWDBOT_BASE_ENV = previous; + } + } + }); });