Skip to content

[recipes] Load .env into wiki-compiler child processes#235

Open
mlava wants to merge 1 commit intoNateBJones-Projects:mainfrom
mlava:contrib/mlava/wiki-compiler-env-fix
Open

[recipes] Load .env into wiki-compiler child processes#235
mlava wants to merge 1 commit intoNateBJones-Projects:mainfrom
mlava:contrib/mlava/wiki-compiler-env-fix

Conversation

@mlava
Copy link
Copy Markdown

@mlava mlava commented Apr 23, 2026

Contribution Type

  • Repo improvement (bug fix in an existing recipe)

What does this do?

Fixes an env-resolution mismatch in recipes/wiki-compiler/compile-wiki.mjs. The spawnNode() helper was passing process.env to child scripts, so any variable set in .env or .env.local (and loaded by the parent via loadEnv()) was silently dropped before reaching the spawned subprocess. The parent would read OPENROUTER_API_KEY from .env and run fine; the child would see undefined and fail or skip silently.

The fix is a one-line change: children now also receive loadEnv() (which merges .env, .env.local, and process.env), matching the env resolution the rest of the script already uses.

Requirements

None — no new dependencies, no schema changes. Affects only the existing wiki-compiler recipe.

Checklist

  • I've read CONTRIBUTING.md
  • I tested this on my own Open Brain instance
  • No credentials, API keys, or secrets are included

Checklist items that don't apply:

  • README / metadata.json updates — this is a one-line bug fix inside an existing recipe, no surface-level docs change needed

spawnNode passed process.env to spawned scripts, which only contains
variables present when the parent node process started. Users relying
on a .env or .env.local file at the repo root had those values silently
dropped in subprocesses, while the parent process loaded them via
loadEnv(). Use loadEnv() for children too so env resolution matches
between parent and spawned scripts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the recipe Contribution: step-by-step recipe label Apr 23, 2026
@github-actions
Copy link
Copy Markdown

Hey @mlava — welcome to Open Brain Source! 👋

Thanks for submitting your first PR. The automated review will run shortly and check things like metadata, folder structure, and README completeness. If anything needs fixing, the review comment will tell you exactly what.

Once the automated checks pass, a human admin will review for quality and clarity. Expect a response within a few days.

If you have questions, check out CONTRIBUTING.md or open an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

recipe Contribution: step-by-step recipe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant