mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6540] [MERGED] feat(agents): answer activation questions with a local model #7219
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#7219
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/6540
Author: @kolacheee
Created: 9/22/2026
Status: ✅ Merged
Merged: 9/22/2026
Merged by: @kolacheee
Base:
staging← Head:feat/decision-local-models📝 Commits (5)
ae2a34ffeat(agents): answer activation questions with a local model2068007fix(agents): start the chosen local slot for decisions on demand9658216fix(agents): keep decision gating consistent with what is actually slow47fee5cfix(agents): refuse decision models the dropdown greys out, and keep health cheap45ee629docs(agents): say why /thinking accepts a slot with no model yet📊 Changes
30 files changed (+2677 additions, -90 deletions)
View changed files
📝
CHANGELOG.md(+4 -0)📝
docs/agents/custom-agents.md(+30 -1)📝
e2e/agent-activation-questions.e2e.ts(+12 -1)📝
packages/client/src/components/agents/AgentEditor.tsx(+7 -7)📝
packages/client/src/components/connections/DecisionDefaultControl.tsx(+213 -59)📝
packages/client/src/components/panels/ConnectionsPanel.tsx(+1 -1)📝
packages/client/src/components/panels/SettingsPanel.tsx(+6 -0)➕
packages/client/src/hooks/use-decision-model.ts(+89 -0)📝
packages/client/src/lib/support-diagnostics.ts(+99 -0)📝
packages/client/src/localization/locales/en.json(+25 -0)📝
packages/server/src/app.ts(+15 -0)➕
packages/server/src/routes/decision.routes.ts(+250 -0)📝
packages/server/src/routes/generate.routes.ts(+19 -21)📝
packages/server/src/routes/index.ts(+2 -0)➕
packages/server/src/services/decision/decision-default.ts(+118 -0)➕
packages/server/src/services/decision/decision-slots.ts(+158 -0)➕
packages/server/src/services/decision/decision-thinking-cache.ts(+80 -0)➕
packages/server/src/services/decision/logprob-answer.ts(+104 -0)➕
packages/server/src/services/decision/sidecar-decision.backend.ts(+232 -0)➕
packages/server/src/services/sidecar/sidecar-footprint.ts(+292 -0)...and 10 more files
📄 Description
Linked issue
Closes #6539
Why this change
Activation questions shipped in #6531 needed a Decision connection, which means a hosted API key. A user who runs Marinara with a local model and no paid API could not gate a custom agent at all, even though the model they already run answers the question well. Measured on the pinned llama.cpp build with a Gemma 4 E4B: 0.0000 for a turn that stays in one room, 0.9996 for one that leaves it.
Issue #6530 scoped this out on purpose as a separate phase needing its own hardware validation. This is that phase. The managed Open-Jev installer is the next one and is not in this PR.
The diagnostics half is useful on its own, before anyone touches an activation question. Support diagnostics report the browser's GPU, which says nothing about the machine running the local model when the client is a phone or another PC.
What changed
max_tokens: 1, reading the probability from the first token'stop_logprobs. No grammar orjson_schema, because a constraint can change whattop_logprobsreports. The shared state is the prompt prefix so llama-server reuses its cache across a group's questions.sidecar-footprint.ts: annvidia-smiprobe, per-slot memory figures, and the verdict logic, with the command output injected so a regression covers every verdict row on a machine with no GPU./api/healthgains a sidecar section from a cached probe, and Copy Diagnostics gains the server's GPU, one line per slot, and a combined load verdict. The health endpoint never waits onnvidia-smi; a probe that has not finished reports itself as pending.A running slot's memory is read from the process rather than estimated from the model file. That matters: a Gemma 4 E4B measured 5.2 GB on the card from an 8.2 GB file, so the size-based estimate overstates it by half. The KV-cache allowance for the not-running case is measured too, at 64.7 KiB per token, from the same GGUF loaded at 4,096 and at 32,768 tokens.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdpnpm checkgreen.pnpm regression:node351/351, including a newdecision-local-models.regression.tscovering a clean yes, a clean no, a reasoning marker as the first token, unrelated prose, missing log-probabilities, the two-failure Auto switch, per-model cache isolation, and every footprint verdict row from recordednvidia-smioutput.Manual verification notes
Run on Linux with an 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.max_tokens: 1, logprobs: true, top_logprobs: 10: for "the location, time or cast of the scene changed", a turn leaving the inn at dawn returnedyesat p=0.724 with 99.9% of the listed mass on yes/no variants; a turn about the ale returnednoat p=0.0001 with 100%.useForTrackersanduseForGameSceneboth off, selecting the primary local model and pressing Test started llama-server and answered p=0.9997. This is the fix in the second commit; the first commit calledensureReady()withoutforceStart, so that user's chosen decision model would never have started./api/decision/optionsreturned the primary slot selectable with its real model name, the utility slot greyed with "No model downloaded", and the decision sidecar greyed with "Not installed"./api/healthreported the main slot asmeasured 7.37 GB, matchingnvidia-smi's 7030 MiB exactly, with a "recommended" verdict and 18.3 GB headroom. The first call after boot correctly returnedpending: truewithout blocking.Not done: no container build, and no second machine, so the multi-GPU path where the slots' device cannot be resolved by name is covered by the regression rather than by hardware.
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)docs/agents/custom-agents.mdgains a "Use a model you already run" section and corrects the timeout text, which said 1.5 seconds for everything. Translated docs are batched as a separate[docs-i18n]follow-up.UI evidence (if applicable)
The existing activation-question e2e covers the dropdown and takes light and dark screenshots; it is extended here to assert that the Local models group is present and that unavailable entries are visible, disabled, and carry their reason.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.