[PR #8669] [MERGED] fix(packages): package runtimes use the host's .env instead of creating one #8735

Closed
opened 2026-11-07 17:39:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8669
Author: @SpicyMarinara
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/runtime-config-env-root-2036


📝 Commits (1)

  • a108ba6 fix(packages): hand package runtimes the host's .env path

📊 Changes

2 files changed (+73 additions, -4 deletions)

View changed files

📝 packages/server/src/services/capability-packages/capability-module-runtime.service.ts (+7 -4)
➕ scripts/regressions/capability-runtime-env-file.regression.ts (+66 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #8668
Fixes Pasta-Devs/Marinara-Agents#2036

Why this change

  • On a source install outside Docker, every boot with Noodle logs [runtime-config] Could not auto-create .env file ... EACCES open '/.env' (Pasta-Devs/Marinara-Agents#2036).
  • Noodle 1.5.12, Conversation Calls 1.1.7 and Slurp 0.4.15 bundle the Engine's runtime-config. The Engine runs each from a runtime copy under DATA_DIR/capability-runtime-snapshots/…/server.mjs. Without MARINARA_ENV_FILE, that bundled code looks for .env four folders above server.mjs, two above the data folder, and creates one there:
    • a short DATA_DIR makes that /, which fails with EACCES;
    • a default install gets a stray, empty <engine>/packages/.env.
  • The Engine already hands package runtimes an absolute DATA_DIR before importing them. It never passed the .env path, so packages never read the host's settings file.

What changed

  • capability-module-runtime.service.ts: prepareCapabilityRuntimeEnvironment() now also sets process.env.MARINARA_ENV_FILE to the host's resolved, absolute getEnvFilePath(). It sits next to the existing DATA_DIR handoff, and both callers (start() and activatePackage()) run it before any package server.mjs is imported.
  • Bundled package code then reads the host's .env and never builds a path from its own location.
  • A MARINARA_ENV_FILE you set yourself still wins. A relative one is now pinned as the host resolved it, where bundles used to resolve it from the wrong folder.
  • New regression scripts/regressions/capability-runtime-env-file.regression.ts. It bundles runtime-config into a snapshot-shaped folder, prepares the environment and imports the bundle in a child process. It then checks that no .env appears two folders above the data folder and that the host's .env is the one loaded. It fails without the fix.
  • No package needs a rebuild or a version bump; this fixes the already-released packages.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

What the agent ran locally:

  • node ./scripts/pnpm-runner.mjs check and check:e2e-types pass.
  • 15 regressions pass: the new capability-runtime-env-file, every regression that imports capability-module-runtime (package-lifecycle, runtime-host-services, server-externals, tool-runtime, startup-inject-gate and others), plus env-watcher, request-timeouts, capability-hoisted-dependencies and capability-native-dependencies.
  • The released staging bundles of Noodle, Conversation Calls and Slurp were imported from a snapshot-shaped path. Without the handoff, each created a stray .env. With it, none did, and each loaded the host's .env.
  • Local CodeRabbit reported 0 findings.
  • An independent review agent repeated all of this and found no defects.

For a human to verify:

  • On a Linux source install (not Docker) with a short DATA_DIR such as /data and Noodle installed, manually verify that the boot log no longer shows Could not auto-create .env file … EACCES open '/.env'.
  • On a default source install, delete any stray <engine>/packages/.env, restart with Noodle, Conversation Calls and Slurp installed, and manually verify that the file doesn't come back.
  • In Docker, manually verify that packages still use /app/data/.env.

Note: older Engines can leave a stray, empty <engine>/packages/.env behind. It is gitignored and safe to delete.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No docs change: no setting or visible behavior changes except the missing warning.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8669 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/runtime-config-env-root-2036` --- ### 📝 Commits (1) - [`a108ba6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a108ba6de5551346deb691e51f297f69d26723fd) fix(packages): hand package runtimes the host's .env path ### 📊 Changes **2 files changed** (+73 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/capability-packages/capability-module-runtime.service.ts` (+7 -4) ➕ `scripts/regressions/capability-runtime-env-file.regression.ts` (+66 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #8668 Fixes Pasta-Devs/Marinara-Agents#2036 ## Why this change - On a source install outside Docker, every boot with Noodle logs `[runtime-config] Could not auto-create .env file ... EACCES open '/.env'` (Pasta-Devs/Marinara-Agents#2036). - Noodle 1.5.12, Conversation Calls 1.1.7 and Slurp 0.4.15 bundle the Engine's `runtime-config`. The Engine runs each from a runtime copy under `DATA_DIR/capability-runtime-snapshots/…/server.mjs`. Without `MARINARA_ENV_FILE`, that bundled code looks for `.env` four folders above `server.mjs`, two above the data folder, and creates one there: - a short `DATA_DIR` makes that `/`, which fails with EACCES; - a default install gets a stray, empty `<engine>/packages/.env`. - The Engine already hands package runtimes an absolute `DATA_DIR` before importing them. It never passed the `.env` path, so packages never read the host's settings file. ## What changed - `capability-module-runtime.service.ts`: `prepareCapabilityRuntimeEnvironment()` now also sets `process.env.MARINARA_ENV_FILE` to the host's resolved, absolute `getEnvFilePath()`. It sits next to the existing `DATA_DIR` handoff, and both callers (`start()` and `activatePackage()`) run it before any package `server.mjs` is imported. - Bundled package code then reads the host's `.env` and never builds a path from its own location. - A `MARINARA_ENV_FILE` you set yourself still wins. A relative one is now pinned as the host resolved it, where bundles used to resolve it from the wrong folder. - New regression `scripts/regressions/capability-runtime-env-file.regression.ts`. It bundles `runtime-config` into a snapshot-shaped folder, prepares the environment and imports the bundle in a child process. It then checks that no `.env` appears two folders above the data folder and that the host's `.env` is the one loaded. It fails without the fix. - No package needs a rebuild or a version bump; this fixes the already-released packages. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes What the agent ran locally: - `node ./scripts/pnpm-runner.mjs check` and `check:e2e-types` pass. - 15 regressions pass: the new capability-runtime-env-file, every regression that imports `capability-module-runtime` (package-lifecycle, runtime-host-services, server-externals, tool-runtime, startup-inject-gate and others), plus env-watcher, request-timeouts, capability-hoisted-dependencies and capability-native-dependencies. - The released staging bundles of Noodle, Conversation Calls and Slurp were imported from a snapshot-shaped path. Without the handoff, each created a stray `.env`. With it, none did, and each loaded the host's `.env`. - Local CodeRabbit reported 0 findings. - An independent review agent repeated all of this and found no defects. For a human to verify: - On a Linux source install (not Docker) with a short `DATA_DIR` such as `/data` and Noodle installed, manually verify that the boot log no longer shows `Could not auto-create .env file … EACCES open '/.env'`. - On a default source install, delete any stray `<engine>/packages/.env`, restart with Noodle, Conversation Calls and Slurp installed, and manually verify that the file doesn't come back. - In Docker, manually verify that packages still use `/app/data/.env`. Note: older Engines can leave a stray, empty `<engine>/packages/.env` behind. It is gitignored and safe to delete. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No docs change: no setting or visible behavior changes except the missing warning. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:19 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8735
No description provided.