[PR #6556] [MERGED] feat(agents): install and manage a purpose-built decision model #7228

Closed
opened 2026-10-23 04:17:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6556
Author: @kolacheee
Created: 9/23/2026
Status: ✅ Merged
Merged: 9/23/2026
Merged by: @kolacheee

Base: staging ← Head: feat/decision-managed-installer


📝 Commits (10+)

  • ed5a47b fix(agents): keep the decision model when a selection is refused
  • f946623 feat(agents): give each decision model its own operating point and wire shape
  • 5af2b92 feat(agents): install and run a managed decision model
  • 8ae248c feat(agents): install a decision model from the Local Model section
  • 40b6f54 feat(agents): install a decision model by pasting its repository
  • 3889edf test(agents): cover the decision installer end to end
  • 61b91c2 fix(agents): ask the decision sidecar in the language it speaks
  • 3823a1e fix(agents): address the local review of the decision installer
  • 3684347 fix(agents): stop a pasted repository writing outside its own directory
  • e9a87b0 fix(agents): close a prototype bypass in the pasted-model gate

📊 Changes

37 files changed (+4785 additions, -61 deletions)

View changed files

📝 CHANGELOG.md (+10 -0)
📝 docs/agents/custom-agents.md (+21 -2)
📝 e2e/agent-activation-questions.e2e.ts (+8 -2)
➕ e2e/decision-sidecar-installer.e2e.ts (+79 -0)
📝 packages/client/src/components/agents/ActivationQuestionFields.tsx (+23 -0)
📝 packages/client/src/components/agents/AgentEditor.tsx (+50 -4)
📝 packages/client/src/components/layout/ModalRenderer.tsx (+8 -1)
📝 packages/client/src/components/modals/CreateConnectionModal.tsx (+5 -3)
➕ packages/client/src/components/modals/DecisionModelModal.tsx (+532 -0)
📝 packages/client/src/components/panels/ConnectionsPanel.tsx (+14 -0)
📝 packages/client/src/hooks/use-decision-model.ts (+17 -1)
➕ packages/client/src/hooks/use-decision-sidecar.ts (+137 -0)
📝 packages/client/src/lib/support-diagnostics.ts (+13 -0)
📝 packages/client/src/localization/locales/en.json (+55 -0)
➕ packages/server/src/assets/decision-runtime-requirements.in (+8 -0)
➕ packages/server/src/assets/decision-runtime-requirements.lock (+682 -0)
📝 packages/server/src/middleware/rate-limit.ts (+19 -0)
📝 packages/server/src/routes/decision.routes.ts (+314 -8)
📝 packages/server/src/routes/generate.routes.ts (+1 -0)
📝 packages/server/src/services/decision/decision-default.ts (+67 -3)

...and 17 more files

📄 Description

Linked issue

Closes #6555

Why this change

#6530 scoped three phases for activation questions. #6531 shipped the gate, #6540 let an existing local chat model answer it. This is the third: the managed Open-Jev installation that #6530 said would need its own capability and hardware validation.

A general local chat model answers these questions well, but only for people who already run one. If your chat model is a hosted connection, gating an agent today means loading a multi-gigabyte GGUF for a job that is one yes or no. A purpose-built decision model is a smaller process that answers in a single forward pass.

It is not the more accurate option, and this PR does not pretend otherwise. On eight roleplay cases, same question, same machine, Open-Jev 2B is worse than the Gemma 4 E4B already installed. It is faster and slightly smaller, the UI says exactly that, and it stays off by default.

This PR also carries the /select fix from #6540: that PR shipped with the selection written before the slot was checked, so a refused selection silently dropped the user to None. It is the first commit here rather than its own PR because this branch already rewrites that route.

What changed

  • A managed decision sidecar: a pinned Python runtime installed through uv, a hash-locked dependency set (--require-hashes), and a third process slot beside the main and utility sidecars, with its own lifecycle, log file, start policy and stop control.
  • The installer is built to the Local Model section's grammar rather than a new one. Same modal shape as ModelDownloadModal, same download and progress language, same place in Connections. Three gates before anything downloads: a warning, a confirmation carrying this machine's verdict, and a separate step naming the 10 GB, the 5 GB of VRAM and the licences (MIT source, Apache-2.0 adapter).
  • A preflight that checks compute capability and driver version, not just whether an NVIDIA card is present. Pascal and older cannot run this runtime whatever memory they have. Without the check, the download is offered and then fails at load, after 10 GB.
  • A box for pasting a model's repository. It is inspected first, and installed only when the repository's own manifest declares a runtime this build ships. A repository is refused if its id or ref is not a plain path, if a listed file would land outside its own snapshot directory, or if the commit moves between the inspection and the install.
  • Per-model calibration. Probabilities are not comparable between models: a general local model answers a clear scene change at 0.99 while Open-Jev answers the same turn at 0.2, so one fixed 0.5 made the second kind skip every relevant turn while appearing to work. Each catalog entry carries its own default threshold and question shape, the editor seeds new questions from the selected model, and it offers to put the recommended value back on an existing one.
  • The decision sidecar is asked over /v1/systemone, not /v1/chat/completions. The resolved slot now carries which protocol it speaks, because a System One server rejects a chat request outright.
  • Diagnostics gain the decision slot: it is reported whether or not anything is installed, so the report's shape does not change with the user's setup, and the consent record says which verdict the user was shown when they turned it on.

The Python child gets an allowlisted environment rather than the server's own. uv's cache is pruned after a successful install, which is the difference between the 10 GB the dialog promises and the 16 GB it left before.

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

pnpm check green. pnpm regression:node 355/355, including decision-local-models.regression.ts extended to cover the System One wire shape, per-model calibration, the artifact-to-runtime gate including a prototype-key probe, repository and ref validation, the traversal guard, and every preflight verdict row from recorded nvidia-smi output. A new e2e/decision-sidecar-installer.e2e.ts walks the enable, confirm, size-and-licence and install steps.

Manual verification notes

Linux, NVIDIA RTX 5090 Laptop (24463 MiB, driver 615.71.09), against a decoupled install on port 7820 with its own DATA_DIR, so the live install was untouched.

  1. Turned the sidecar on from Connections. Confirmed the warning, the machine verdict and the size-and-licence step each appear in order and that backing out of any of them leaves the setting off.
  2. Installed Open-Jev 2B for real. The runtime bootstrap, the hash-locked dependency install and the 4.56 GB download all completed. Measured the result at 10 GB on disk after the cache prune, against 16 GB before it.
  3. Started the process and pressed Test on the Decision model setting. decisionProbability: 0.9103503583607067, latencyMs: 1083.
  4. Ran the same eight roleplay cases against Open-Jev and against a Gemma 4 E4B. Open-Jev at the shipped 0.5 threshold answered 4/8 with every positive wrong; at its own 0.1 default with the task-object question shape it answered 7/8. That measurement is what the calibration change is for.
  5. Pasted a repository into the box: one with a manifest naming a runtime this build ships (installable), one without (refused, with the reason), one with a traversal path in its file list (refused), and one id of the form ../name (refused before any request).
  6. Removed the model and confirmed the disk is reclaimed and the dropdown entry returns to "not installed" rather than disappearing.
  7. Checked the modal in light and dark, at mobile width, with no GPU present (the whole section reports the platform reason instead of offering a download) and with the process stopped mid-install.

One note for CI: image-dimension-limit.regression.ts timed out once in a full-suite run on this branch, after printing its own pass line, then passed three times alone and on a full re-run. It looks like the 30-second per-file budget under load rather than anything this branch touches.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

docs/agents/custom-agents.md gains the decision model section. #6532 is already open for that file on docs-i18n.

UI evidence (if applicable)

The installer deliberately has no new visual grammar: it reuses the Local Model section's modal, progress and button language so the two read as one feature. Screenshots on request.

Summary by CodeRabbit

  • New Features

    • Added an experimental, optional Decision Sidecar for installing and running supported local decision models, including repository inspection, model removal, startup options, and GPU selection on multi-GPU systems.
    • Setup is off by default and requires acknowledgements and confirmations. Before installation, Marinara checks hardware and storage compatibility; setup uses about 10 GB of disk space and 5 GB of GPU memory.
    • Local setup requires Linux, an NVIDIA GPU with compute capability 7.5 or newer, and driver 580 or newer. If local models are unsupported, setup offers a Decision connection.
    • Activation-question thresholds now reflect the selected model’s calibration, with an option to restore its recommended value. Added support for task-shaped decision questions and improved local model status reporting.
  • Bug Fixes

    • Preserved existing decision-model selections when a replacement model cannot be used.

🔄 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/6556 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/23/2026 **Status:** ✅ Merged **Merged:** 9/23/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/decision-managed-installer` --- ### 📝 Commits (10+) - [`ed5a47b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ed5a47b75bb6fe1df571a3f2ddf5b0cfc748ddb2) fix(agents): keep the decision model when a selection is refused - [`f946623`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f946623d77342ce1b37721f04abf74b0ba3bffd0) feat(agents): give each decision model its own operating point and wire shape - [`5af2b92`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5af2b924e5c9f3d66cf6cdd3dba5a467c830d486) feat(agents): install and run a managed decision model - [`8ae248c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8ae248cc6b42f7b3ec48894ceaa4f9ce38b699bf) feat(agents): install a decision model from the Local Model section - [`40b6f54`](https://github.com/Pasta-Devs/Marinara-Engine/commit/40b6f54c2d0a93f30ded3411f3afad9fd0822549) feat(agents): install a decision model by pasting its repository - [`3889edf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3889edfac95240ccad30d590eb4c4ce75d0f2ea6) test(agents): cover the decision installer end to end - [`61b91c2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/61b91c294dad1380b35d301493c6c37240307564) fix(agents): ask the decision sidecar in the language it speaks - [`3823a1e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3823a1ef51120c9a235ce52c854b8c3d2a03414c) fix(agents): address the local review of the decision installer - [`3684347`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3684347ccf8acc73389c39ee8395c83e2e31e676) fix(agents): stop a pasted repository writing outside its own directory - [`e9a87b0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e9a87b0b2ea2401708d98c6bfca2134c73003168) fix(agents): close a prototype bypass in the pasted-model gate ### 📊 Changes **37 files changed** (+4785 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+10 -0) 📝 `docs/agents/custom-agents.md` (+21 -2) 📝 `e2e/agent-activation-questions.e2e.ts` (+8 -2) ➕ `e2e/decision-sidecar-installer.e2e.ts` (+79 -0) 📝 `packages/client/src/components/agents/ActivationQuestionFields.tsx` (+23 -0) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+50 -4) 📝 `packages/client/src/components/layout/ModalRenderer.tsx` (+8 -1) 📝 `packages/client/src/components/modals/CreateConnectionModal.tsx` (+5 -3) ➕ `packages/client/src/components/modals/DecisionModelModal.tsx` (+532 -0) 📝 `packages/client/src/components/panels/ConnectionsPanel.tsx` (+14 -0) 📝 `packages/client/src/hooks/use-decision-model.ts` (+17 -1) ➕ `packages/client/src/hooks/use-decision-sidecar.ts` (+137 -0) 📝 `packages/client/src/lib/support-diagnostics.ts` (+13 -0) 📝 `packages/client/src/localization/locales/en.json` (+55 -0) ➕ `packages/server/src/assets/decision-runtime-requirements.in` (+8 -0) ➕ `packages/server/src/assets/decision-runtime-requirements.lock` (+682 -0) 📝 `packages/server/src/middleware/rate-limit.ts` (+19 -0) 📝 `packages/server/src/routes/decision.routes.ts` (+314 -8) 📝 `packages/server/src/routes/generate.routes.ts` (+1 -0) 📝 `packages/server/src/services/decision/decision-default.ts` (+67 -3) _...and 17 more files_ </details> ### 📄 Description ## Linked issue Closes #6555 ## Why this change #6530 scoped three phases for activation questions. #6531 shipped the gate, #6540 let an existing local chat model answer it. This is the third: the managed Open-Jev installation that #6530 said would need its own capability and hardware validation. A general local chat model answers these questions well, but only for people who already run one. If your chat model is a hosted connection, gating an agent today means loading a multi-gigabyte GGUF for a job that is one yes or no. A purpose-built decision model is a smaller process that answers in a single forward pass. It is not the more accurate option, and this PR does not pretend otherwise. On eight roleplay cases, same question, same machine, Open-Jev 2B is worse than the Gemma 4 E4B already installed. It is faster and slightly smaller, the UI says exactly that, and it stays off by default. This PR also carries the `/select` fix from #6540: that PR shipped with the selection written before the slot was checked, so a refused selection silently dropped the user to None. It is the first commit here rather than its own PR because this branch already rewrites that route. ## What changed - A managed decision sidecar: a pinned Python runtime installed through `uv`, a hash-locked dependency set (`--require-hashes`), and a third process slot beside the main and utility sidecars, with its own lifecycle, log file, start policy and stop control. - The installer is built to the Local Model section's grammar rather than a new one. Same modal shape as `ModelDownloadModal`, same download and progress language, same place in Connections. Three gates before anything downloads: a warning, a confirmation carrying this machine's verdict, and a separate step naming the 10 GB, the 5 GB of VRAM and the licences (MIT source, Apache-2.0 adapter). - A preflight that checks compute capability and driver version, not just whether an NVIDIA card is present. Pascal and older cannot run this runtime whatever memory they have. Without the check, the download is offered and then fails at load, after 10 GB. - A box for pasting a model's repository. It is inspected first, and installed only when the repository's own manifest declares a runtime this build ships. A repository is refused if its id or ref is not a plain path, if a listed file would land outside its own snapshot directory, or if the commit moves between the inspection and the install. - Per-model calibration. Probabilities are not comparable between models: a general local model answers a clear scene change at 0.99 while Open-Jev answers the same turn at 0.2, so one fixed 0.5 made the second kind skip every relevant turn while appearing to work. Each catalog entry carries its own default threshold and question shape, the editor seeds new questions from the selected model, and it offers to put the recommended value back on an existing one. - The decision sidecar is asked over `/v1/systemone`, not `/v1/chat/completions`. The resolved slot now carries which protocol it speaks, because a System One server rejects a chat request outright. - Diagnostics gain the decision slot: it is reported whether or not anything is installed, so the report's shape does not change with the user's setup, and the consent record says which verdict the user was shown when they turned it on. The Python child gets an allowlisted environment rather than the server's own. `uv`'s cache is pruned after a successful install, which is the difference between the 10 GB the dialog promises and the 16 GB it left before. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` `pnpm check` green. `pnpm regression:node` 355/355, including `decision-local-models.regression.ts` extended to cover the System One wire shape, per-model calibration, the artifact-to-runtime gate including a prototype-key probe, repository and ref validation, the traversal guard, and every preflight verdict row from recorded `nvidia-smi` output. A new `e2e/decision-sidecar-installer.e2e.ts` walks the enable, confirm, size-and-licence and install steps. ### Manual verification notes Linux, NVIDIA RTX 5090 Laptop (24463 MiB, driver 615.71.09), against a decoupled install on port 7820 with its own `DATA_DIR`, so the live install was untouched. 1. Turned the sidecar on from Connections. Confirmed the warning, the machine verdict and the size-and-licence step each appear in order and that backing out of any of them leaves the setting off. 2. Installed Open-Jev 2B for real. The runtime bootstrap, the hash-locked dependency install and the 4.56 GB download all completed. Measured the result at 10 GB on disk after the cache prune, against 16 GB before it. 3. Started the process and pressed Test on the Decision model setting. `decisionProbability: 0.9103503583607067`, `latencyMs: 1083`. 4. Ran the same eight roleplay cases against Open-Jev and against a Gemma 4 E4B. Open-Jev at the shipped 0.5 threshold answered 4/8 with every positive wrong; at its own 0.1 default with the task-object question shape it answered 7/8. That measurement is what the calibration change is for. 5. Pasted a repository into the box: one with a manifest naming a runtime this build ships (installable), one without (refused, with the reason), one with a traversal path in its file list (refused), and one id of the form `../name` (refused before any request). 6. Removed the model and confirmed the disk is reclaimed and the dropdown entry returns to "not installed" rather than disappearing. 7. Checked the modal in light and dark, at mobile width, with no GPU present (the whole section reports the platform reason instead of offering a download) and with the process stopped mid-install. One note for CI: `image-dimension-limit.regression.ts` timed out once in a full-suite run on this branch, after printing its own pass line, then passed three times alone and on a full re-run. It looks like the 30-second per-file budget under load rather than anything this branch touches. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [x] 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) `docs/agents/custom-agents.md` gains the decision model section. #6532 is already open for that file on `docs-i18n`. ## UI evidence (if applicable) The installer deliberately has no new visual grammar: it reuses the Local Model section's modal, progress and button language so the two read as one feature. Screenshots on request. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added an experimental, optional Decision Sidecar for installing and running supported local decision models, including repository inspection, model removal, startup options, and GPU selection on multi-GPU systems. - Setup is off by default and requires acknowledgements and confirmations. Before installation, Marinara checks hardware and storage compatibility; setup uses about 10 GB of disk space and 5 GB of GPU memory. - Local setup requires Linux, an NVIDIA GPU with compute capability 7.5 or newer, and driver 580 or newer. If local models are unsupported, setup offers a Decision connection. - Activation-question thresholds now reflect the selected model’s calibration, with an option to restore its recommended value. Added support for task-shaped decision questions and improved local model status reporting. - **Bug Fixes** - Preserved existing decision-model selections when a replacement model cannot be used. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:17:43 +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#7228
No description provided.