[GH-ISSUE #7858] [Issue]: Agent packages carry duplicated Engine code: host namespace, runtime services and disk cleanup #4324

Closed
opened 2026-10-21 06:14:51 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @SpicyMarinara on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7858

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Downloaded agent packages carry their own copies of Engine code, and the Engine keeps more copies of every installed package on disk than it needs. Copies with their own state cause wrong settings, wrong-chat writes, game boards that don't lock and a second Local Model process. The rest wastes disk space.

Expected behavior

  • Loading Marinara never changes saved settings. A package acts on the chat you are using.
  • There is one Local Model process, one Intiface connection, one ChatGPT login refresh and one chat-save queue, all the Engine's own.
  • Installed agents take about the space of their current and previous versions.

Actual behavior

  • Settings: nine packages save an old copy of the UI settings over the Engine's on every page load. Each save drops 85 settings. Server sync restores 79, and 6 browser-only settings are lost for good (Pasta-Devs/Marinara-Agents#1478, reproduced in a browser).
  • Page-load chat: in Calls, Noodle and Slurp, the connection switcher and the sticker and emoji settings change the chat that was open when the page loaded, not the current one.
  • Game boards (Chess, UNO, Poker, 8-Ball Pool, Tic-Tac-Toe, Rock-Paper-Scissors) never lock while the character is replying.
  • Second llama-server: Calls, Noodle and Slurp each run their own Local Model manager. Noodle image captioning and picture-prompt rewrites can start another llama-server and load the model a second time. Every start rewrites sidecar-config.json (reproduced).
  • Disk: on a fresh Engine, installing every agent uses 134 MB for 37 MB of packages (3.6 times):
    • runtime copies are made on every start and never removed after a crash or kill, and they include client.js, which the server never loads (46–56% of their bytes);
    • versions older than the previous one are only removed on uninstall.
    • Two development data folders held 467 MB and 2.2 GB of leftover runtime copies.

Steps to reproduce

  1. Install every agent, then stop the server with SIGKILL and start it again.
  2. Look in DATA_DIR/capability-runtime-snapshots: the killed run's copies are still there, each with client.js.
  3. Update a package twice: DATA_DIR/capability-packages/versions/<id> keeps all three versions.
  4. For settings, see the steps in Pasta-Devs/Marinara-Agents#1478.

Environment

  • Marinara Engine version: 2.5.0 and staging
  • Install type: source
  • OS + version: macOS
  • Browser or app shell: Chromium (Playwright)

Logs, screenshots, or video

None. The steps above show it.

Additional context

Plan (Engine side; the package rebuild is Pasta-Devs/Marinara-Agents#1487):

  • Client: one host namespace, globalThis.__MARINARA_HOST__ = { version: 1, ... }, set before any package client loads. It holds the live stores (ui, chat including pending map moves, agent, sidecar, dialog, gallery, encounter, game state, backfill), the TTS and dialog services, the shared libraries (React, React DOM, React Query, zustand, sonner, zod, i18next, react-i18next, framer-motion, tailwind-merge, clsx), the QueryClient, Modal, the emoji catalog and the API client. The guard against older packages' settings writes stays.
  • Server: new api.runtime members (services.get, commands, integrations.haptics, integrations.spotify, integrations.admission, local Whisper, chat-gallery writes and patch-style chat writes) and capability API 1.341. Package servers load shared libraries from the Engine's node_modules, and a moved install relinks that folder.
  • Disk: at startup, delete leftover runtime copies; leave client.js out of runtime copies; keep only the current and previous version of each package. User data, chats and package data folders are never touched.
  • The rebuilt packages require capability API 1.341. Older Engines never install them and keep the versions they already have.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7858 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Downloaded agent packages carry their own copies of Engine code, and the Engine keeps more copies of every installed package on disk than it needs. Copies with their own state cause wrong settings, wrong-chat writes, game boards that don't lock and a second Local Model process. The rest wastes disk space. ## Expected behavior - Loading Marinara never changes saved settings. A package acts on the chat you are using. - There is one Local Model process, one Intiface connection, one ChatGPT login refresh and one chat-save queue, all the Engine's own. - Installed agents take about the space of their current and previous versions. ## Actual behavior - Settings: nine packages save an old copy of the UI settings over the Engine's on every page load. Each save drops 85 settings. Server sync restores 79, and 6 browser-only settings are lost for good (Pasta-Devs/Marinara-Agents#1478, reproduced in a browser). - Page-load chat: in Calls, Noodle and Slurp, the connection switcher and the sticker and emoji settings change the chat that was open when the page loaded, not the current one. - Game boards (Chess, UNO, Poker, 8-Ball Pool, Tic-Tac-Toe, Rock-Paper-Scissors) never lock while the character is replying. - Second llama-server: Calls, Noodle and Slurp each run their own Local Model manager. Noodle image captioning and picture-prompt rewrites can start another llama-server and load the model a second time. Every start rewrites `sidecar-config.json` (reproduced). - Disk: on a fresh Engine, installing every agent uses 134 MB for 37 MB of packages (3.6 times): - runtime copies are made on every start and never removed after a crash or kill, and they include `client.js`, which the server never loads (46–56% of their bytes); - versions older than the previous one are only removed on uninstall. - Two development data folders held 467 MB and 2.2 GB of leftover runtime copies. ## Steps to reproduce 1. Install every agent, then stop the server with SIGKILL and start it again. 2. Look in `DATA_DIR/capability-runtime-snapshots`: the killed run's copies are still there, each with `client.js`. 3. Update a package twice: `DATA_DIR/capability-packages/versions/<id>` keeps all three versions. 4. For settings, see the steps in Pasta-Devs/Marinara-Agents#1478. ## Environment - Marinara Engine version: 2.5.0 and staging - Install type: source - OS + version: macOS - Browser or app shell: Chromium (Playwright) ## Logs, screenshots, or video None. The steps above show it. ## Additional context Plan (Engine side; the package rebuild is Pasta-Devs/Marinara-Agents#1487): - Client: one host namespace, `globalThis.__MARINARA_HOST__ = { version: 1, ... }`, set before any package client loads. It holds the live stores (ui, chat including pending map moves, agent, sidecar, dialog, gallery, encounter, game state, backfill), the TTS and dialog services, the shared libraries (React, React DOM, React Query, zustand, sonner, zod, i18next, react-i18next, framer-motion, tailwind-merge, clsx), the QueryClient, Modal, the emoji catalog and the API client. The guard against older packages' settings writes stays. - Server: new `api.runtime` members (`services.get`, `commands`, `integrations.haptics`, `integrations.spotify`, `integrations.admission`, local Whisper, chat-gallery writes and patch-style chat writes) and capability API 1.341. Package servers load shared libraries from the Engine's `node_modules`, and a moved install relinks that folder. - Disk: at startup, delete leftover runtime copies; leave `client.js` out of runtime copies; keep only the current and previous version of each package. User data, chats and package data folders are never touched. - The rebuilt packages require capability API 1.341. Older Engines never install them and keep the versions they already have. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 20, 2026):

The client part is done on staging by #7869: the globalThis.__MARINARA_HOST__ namespace, the UI settings guard, and app dialogs on the top layer. This issue stays open for the other two Engine parts, #7868 (runtime services and the capability API bump) and #7870 (package disk cleanup), and then the Agents rebuild (Pasta-Devs/Marinara-Agents#1487).

<!-- gh-comment-id:6287783678 --> @SpicyMarinara commented on GitHub (Oct 20, 2026): The client part is done on staging by #7869: the `globalThis.__MARINARA_HOST__` namespace, the UI settings guard, and app dialogs on the top layer. This issue stays open for the other two Engine parts, #7868 (runtime services and the capability API bump) and #7870 (package disk cleanup), and then the Agents rebuild (Pasta-Devs/Marinara-Agents#1487).
Author
Owner

@SpicyMarinara commented on GitHub (Oct 20, 2026):

Disk-cleanup part done on staging by #7870. The client namespace part is on staging through #7869. This issue stays open until the runtime-services part (#7868) is on staging too.

<!-- gh-comment-id:6287903458 --> @SpicyMarinara commented on GitHub (Oct 20, 2026): Disk-cleanup part done on staging by #7870. The client namespace part is on staging through #7869. This issue stays open until the runtime-services part (#7868) is on staging too.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 20, 2026):

Done on staging by #7868.

<!-- gh-comment-id:6288299280 --> @SpicyMarinara commented on GitHub (Oct 20, 2026): Done on staging by #7868.
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#4324
No description provided.