mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5678] [MERGED] feat(sidecar): add a second, independent local model slot for agents #6880
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6880
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5678
Author: @GetBeholder
Created: 8/30/2026
Status: ✅ Merged
Merged: 8/30/2026
Merged by: @GetBeholder
Base:
staging← Head:feat/utility-sidecar📝 Commits (10+)
052d61efeat(sidecar): add a second, independent local model slot for agents544eda9fix(sidecar): start the utility slot on demand and stop misnaming the connection201df77chore: drop an accidentally committed node_modules symlinkd704538fix(i18n): keep en.json key order alphabetical83f12fffix(test): import shared from source in the utility-sidecar regression53a0851fix(sidecar): rate-limit the utility slot routes4077751feat(sidecar): put the utility model on the GPU by defaulte9e3eb2fix(sidecar): reject bad model ids, keep the process in step, name the real connectiond9bf5b3Merge branch 'staging' into feat/utility-sidecar937778afix(sidecar): wait for the process to exit, and recheck identity after a shared start📊 Changes
13 files changed (+1469 additions, -18 deletions)
View changed files
📝
packages/client/src/components/agents/AgentEditor.tsx(+47 -1)📝
packages/client/src/localization/locales/en.json(+2 -0)📝
packages/server/src/middleware/rate-limit.ts(+12 -0)📝
packages/server/src/routes/generate/retry-agents-route.ts(+78 -9)📝
packages/server/src/routes/index.ts(+2 -0)➕
packages/server/src/routes/utility-sidecar.routes.ts(+178 -0)📝
packages/server/src/services/generation/agent-resolution.ts(+51 -8)➕
packages/server/src/services/utility-sidecar/utility-sidecar.provider.ts(+98 -0)➕
packages/server/src/services/utility-sidecar/utility-sidecar.service.ts(+588 -0)📝
packages/shared/src/constants/defaults.ts(+8 -0)📝
packages/shared/src/index.ts(+1 -0)➕
packages/shared/src/types/utility-sidecar.ts(+111 -0)➕
scripts/regressions/utility-sidecar.regression.ts(+293 -0)📄 Description
Linked issue
Closes #
Why this change
Some agents are built around a small purpose-trained model rather than a general one — an extractor whose output is graded against a schema, where a 0.8B model tuned for the job beats a large general one and costs nothing to run.
There is nowhere to put such a model. The sidecar holds exactly one, and that one is the model the operator chose for generation, scene analysis and trackers. Installing an agent's model into it displaces their choice, so in practice those agents have no local path at all and must be pointed at a paid connection.
What changed
A second, parallel slot. Everything in it is additive; nothing about the existing sidecar changes.
Isolation. Its own config file, its own model directory under
data/models/utility, its ownllama-serveron its own dynamically allocated port. The one thing it shares is the installed llama.cpp runtime, read-only: it usessidecarRuntimeService.getCurrentInstall()and refuses to start when the runtime is absent, rather thanensureInstalled(), which would download and rewrite shared state the main slot depends on. It never reads or writessidecar-config.json, never touches models outside its own subdirectory, and never stops or restarts the main process.Routing. When the slot is up and holding a model whose id matches an agent, it answers for that agent; otherwise the agent's configured connection is used exactly as before. The rule is one pure function (
utilitySlotServesAgent) shared by both agent resolution paths rather than duplicated in each. A configured-but-down slot falls back rather than failing the run.Saying which model answered.
GET /api/utility-sidecar/routing/:agentTypereturns the verdict and the reason for it, so a UI can name the model that will actually run instead of inferring it from the connection list. This matters more than it looks: an agent answered by the wrong model fails in ways that read as a bad model rather than a wrong setting.Explicit selection. The agent editor offers the slot as a connection, but only once a model for that agent is installed — an option that cannot answer is worse than no option. Chosen-but-not-serving is reported as unavailable rather than quietly answered by a different model, because the two need different prompts.
Updates by version, not size. A requantization can land on the same byte count, and the operator is being asked to spend a download, so comparison is by blob id. When the ids cannot be compared the answer is
indeterminaterather than an implied "current".Settings expose hardware only — context size, GPU layers, parallel slots, each clamped before it reaches
llama-server. Sampling is deliberately absent: an extractor is graded against a schema, and a temperature dial on it turns a working install into a subtly broken one. Defaults are CPU-only so a first run cannot quietly contend with the main sidecar for VRAM.All writes sit behind
requirePrivilegedAccess.Validation
scripts/regressions/utility-sidecar.regression.tsadded and passingextension-security,mari/db-execution-security) reproduce identically on the unmodified base commit and are environmentaltsc --noEmitclean forpackages/serverandpackages/clientprettier --check "packages/**/*.{ts,tsx}"cleanDATA_DIRand drove the whole feature end to end (below)CONTRIBUTING.mdManual verification notes
Driven against a real engine on an isolated
DATA_DIR, seeded with a main sidecar holding a different model so displacement would show up:data/models/utility/beholder/.../../escape.gguf, an absolute path, and a non-.gguffile each rejected with 400, and nothing was written outside the utility directory.updateAvailable: false,indeterminate: false.llama-serveron its own allocated port, launched with-ngl 0, so it does not contend with the main sidecar for VRAM by default./api/generate/retry-agents— all five lane passes answered by the local model. The debug stream showsutility-sidecaras the only model used.sidecar-config.json, its model file and its runtime record are byte-for-byte identical (sha256) after install, start, an agent run and a restart.Three faults were found this way and are fixed in the second commit: the slot did not survive a restart (routing required an already-running process, so a restart silently returned the agent to its paid connection); the run warned that it was billing the default gpt-5.5 connection while the local model was actually answering; and the main generation path's built-in agent loop had no override at all. The first two are exactly the kind of thing the code reads correctly and the running system does not.
Docs and release impact
UI evidence (if applicable)
Server-side feature; the client change is one conditional
<option>in the agent editor, shown only when a model for that agent is installed.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.