openclaw/src
Kevin ONeill 77ec7b4adf fix: include .env file vars in gateway service environment on install
When building the gateway install plan, read and parse
~/.openclaw/.env (or $OPENCLAW_STATE_DIR/.env) and merge those
key-value pairs into the service environment at the lowest
priority — below config env vars, auth-profile refs, and the
core service environment (HOME, PATH, OPENCLAW_*).

This ensures that user-defined secrets stored in .env (e.g.
BRAVE_API_KEY, OPENROUTER_API_KEY, DISCORD_BOT_TOKEN) are
embedded in the LaunchAgent plist (macOS), systemd unit (Linux),
and Scheduled Task (Windows) at install time, rather than
relying solely on the gateway process loading them via
dotenv.config() at startup.

Previously, on macOS the LaunchAgent plist never included .env
vars, which meant:
- launchctl print did not show user secrets (hard to debug)
- Child processes spawned before dotenv loaded had no access
- If the same key existed in both .env and the plist, the stale
  plist value won via dotenv override:false semantics

Dangerous host env vars (NODE_OPTIONS, LD_PRELOAD, etc.) are
filtered using the same security policy applied to config env
vars.

Fixes #37101
Relates to #22663
2026-03-22 21:55:58 -07:00
..
acp fix(acp): preserve hidden thought replay on session load 2026-03-22 19:48:19 -07:00
agents fix(exec): accept runtime failure kind in formatter 2026-03-22 21:54:02 -07:00
auto-reply fix(ci): resync generated baselines and line runtime seam 2026-03-22 19:53:26 -07:00
bindings
bootstrap refactor: centralize node startup tls planning 2026-03-21 15:58:42 -07:00
browser fix(browser): add ChildProcessWithoutNullStreams cast for @types/node compat 2026-03-22 18:39:24 -07:00
canvas-host test: fix no-isolate canvas and timer regressions 2026-03-22 12:10:08 -07:00
channels fix(whatsapp): remove outbound runtime cycle 2026-03-22 21:04:14 -07:00
cli fix: keep status --json stdout clean (#52449) (thanks @cgdusek) 2026-03-22 21:51:08 -07:00
commands fix: include .env file vars in gateway service environment on install 2026-03-22 21:55:58 -07:00
compat
config perf(reply): lazy-load session store writes 2026-03-22 19:32:24 -07:00
context-engine refactor: consolidate core runtime state helpers 2026-03-22 18:09:45 +00:00
cron refactor(plugins): move remaining channel and provider ownership out of src 2026-03-22 19:13:25 -07:00
daemon test: trim test startup overhead 2026-03-21 23:30:51 +00:00
docs
gateway fix: finish gateway probe auth landing (#52513) (thanks @CodeForgeNet) 2026-03-22 19:14:44 -07:00
hooks refactor(cli): separate json payload output from logging 2026-03-22 23:19:17 +00:00
i18n
image-generation refactor(plugins): move remaining channel and provider ownership out of src 2026-03-22 19:13:25 -07:00
infra fix(ci): resync generated baselines and line runtime seam 2026-03-22 19:53:26 -07:00
interactive
line refactor(plugins): move remaining channel and provider ownership out of src 2026-03-22 19:13:25 -07:00
link-understanding perf(core): narrow sandbox status imports for error helpers (#51897) 2026-03-21 15:40:45 -07:00
logging refactor(cli): separate json payload output from logging 2026-03-22 23:19:17 +00:00
markdown
media test: stabilize vitest no-isolate suites 2026-03-22 14:28:43 -07:00
media-understanding fix(ci): resync generated baselines and line runtime seam 2026-03-22 19:53:26 -07:00
memory refactor(plugins): move remaining channel and provider ownership out of src 2026-03-22 19:13:25 -07:00
node-host test: harden vitest no-isolate coverage 2026-03-22 10:48:21 -07:00
pairing refactor(gateway): share interface discovery helpers 2026-03-22 15:02:43 -07:00
plugin-sdk fix(plugin-sdk): fast-path root diagnostic subscriptions 2026-03-22 21:07:11 -07:00
plugins feat(web-search): add bundled Exa plugin (#52617) 2026-03-22 20:57:33 -07:00
process fix(ci): restore cli runtime mocks and timeout exits 2026-03-22 23:43:58 +00:00
routing refactor: share normalized account lookups 2026-03-22 19:01:52 +00:00
scripts fix(image): deprecate legacy skill and clarify auth 2026-03-22 18:42:18 -07:00
secrets fix: harden image auth env lookups (#52552) (thanks @vincentkoc) 2026-03-22 18:42:18 -07:00
security fix: restore repo-wide gate after exec safe-bin refactor 2026-03-22 17:28:04 +00:00
sessions
shared refactor(plugins): finish provider and whatsapp cleanup 2026-03-22 19:13:25 -07:00
terminal
test-helpers refactor(gateway): share interface discovery helpers 2026-03-22 15:02:43 -07:00
test-utils test(env): normalize path expectations on windows 2026-03-22 16:08:49 -07:00
tts fix(ci): repair tts and matrix refactor fallout 2026-03-22 20:12:01 -07:00
tui perf: expand base vitest thread lanes 2026-03-22 11:59:38 -07:00
types
utils refactor: centralize channel plugin registry lookups 2026-03-22 18:09:45 +00:00
web-search
wizard perf: reduce runtime and test startup overhead 2026-03-21 20:18:16 +00:00
bundled-web-search-registry.ts feat(web-search): add bundled Exa plugin (#52617) 2026-03-22 20:57:33 -07:00
channel-web.ts
docker-build-cache.test.ts
docker-image-digests.test.ts
docker-setup.e2e.test.ts
dockerfile.test.ts
entry.respawn.test.ts fix: handle Linux nvm CA env before startup (#51146) (thanks @GodsBoy) 2026-03-21 11:06:31 -07:00
entry.respawn.ts refactor: centralize node startup tls planning 2026-03-21 15:58:42 -07:00
entry.test.ts
entry.ts fix: handle Linux nvm CA env before startup (#51146) (thanks @GodsBoy) 2026-03-21 11:06:31 -07:00
entry.version-fast-path.test.ts
extensionAPI.test.ts
extensionAPI.ts
globals.ts
index.test.ts perf: reduce runtime and test startup overhead 2026-03-21 20:18:16 +00:00
index.ts
install-sh-version.test.ts
library.ts
logger.test.ts
logger.ts
logging.ts
param-key.ts
poll-params.test.ts fix(poll-params): treat zero-valued numeric poll params as unset (#52150) 2026-03-22 18:39:31 +08:00
poll-params.ts fix(poll-params): treat zero-valued numeric poll params as unset (#52150) 2026-03-22 18:39:31 +08:00
polls.test.ts
polls.ts
runtime.ts refactor(cli): separate json payload output from logging 2026-03-22 23:19:17 +00:00
utils.test.ts
utils.ts
version.test.ts
version.ts