Skip to content

fix: invoke credential resolver under daemon even when ambient env is populated - #21

Merged
OndrejDrapalik merged 2 commits into
e2b-dev:mainfrom
adi-IL:fix/daemon-env-preflight-precedence
Aug 26, 2026
Merged

OndrejDrapalik merged 2 commits into
e2b-dev:mainfrom
adi-IL:fix/daemon-env-preflight-precedence

Conversation

@adi-IL

@adi-IL adi-IL commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When running under the herdr daemon (HERDR_PLUGIN_ID or HERDR_PLUGIN_ROOT), src/config.js (resolveCredentials) is designed to demote ambient inherited E2B_API_KEY and E2B_DOMAIN so that config.toml updates take effect without requiring a daemon restart.
  • However, ensure_e2b_env in bin/lib/paths.sh previously only invoked src/resolve-env.js when either E2B_API_KEY or E2B_DOMAIN was empty (if [ -z "${E2B_API_KEY:-}" ] || [ -z "${E2B_DOMAIN:-}" ]; then).
  • If the herdr daemon process inherited both E2B_API_KEY and E2B_DOMAIN at launch, ensure_e2b_env skipped invoking the resolver entirely, retaining the stale ambient variables and bypassing the daemon config resolution rules.
  • Gated ensure_e2b_env to also invoke the resolver when HERDR_PLUGIN_ID or HERDR_PLUGIN_ROOT is set, ensuring daemon-spawned commands always resolve credentials as intended.
  • Added a regression test in test/cli.test.sh asserting that a daemon run with exported E2B_API_KEY and E2B_DOMAIN correctly resolves the configured region and credentials from config.toml.

Test Plan

  • Ran node --test test/*.test.js: 254 passed, 0 failed.
  • Ran bash test/cli.test.sh: 295 passed, 0 failed, 2 skipped.

@cla-bot cla-bot Bot added the cla-signed label Aug 21, 2026
@OndrejDrapalik
OndrejDrapalik merged commit 1e9da2a into e2b-dev:main Aug 26, 2026
6 checks passed
This was referenced Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants