mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
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#6491
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/4771
Author: @kolacheee
Created: 8/8/2026
Status: ✅ Merged
Merged: 8/8/2026
Merged by: @kolacheee
Base:
staging← Head:feat/4768-available-names📝 Commits (3)
81d281cfeat(mari): relocate Home-Mari name lists to a stable tail injection (#4768)26baf8btest(mari): pin the #4768 call-site wiring; tighten naming and commentsb9c405ftest(mari): make the #4768 wiring pin match structurally, not by fixed window📊 Changes
5 files changed (+316 additions, -41 deletions)
View changed files
📝
package.json(+1 -1)📝
packages/server/src/db/seed-mari.ts(+1 -1)📝
packages/server/src/routes/generate.routes.ts(+29 -2)📝
packages/server/src/routes/generate/professor-mari-prompt-context.ts(+71 -37)➕
scripts/regressions/professor-mari-prompt-context.regression.ts(+214 -0)📄 Description
Linked issue
Closes #4768 (cache-half of the issue)
Why this change
Home Professor Mari's prompt injected a flat
<available_names>list of every character, persona, lorebook, chat, and preset — plus any[fetch:]-loaded data — inside the system message. Two costs:desc(updatedAt), so any entity Mari herself creates or edits mid-conversation jumps to the head of its category and reorders the block. Because the block sat in the system prefix, that rewrite invalidated the static prompt prefix each turn — and with provider prompt caching enabled, forced a cache write every turn instead of a hit.The name list and fetched data are reference data, not instructions, so they don't need to live in the system message at all.
What changed
resolveProfessorMariPromptContextinto{ stablePrompt, volatileContext }. The instruction block (MARI_ASSISTANT_PROMPT) stays on the system message as a static, cacheable prefix; the name lists + fetched data becomevolatileContext.volatileContextas a tailrole:"user"message (contextKind:"injection") ingenerate.routes.ts, rebuilt each follow-up-loop iteration so a[fetch:]still surfaces its data on the follow-up turn.contextKind:"injection"keeps the normal history-trim pass from dropping it.MAX_MARI_AVAILABLE_NAMES_PER_TYPE = 100, with an overflow hint. The sort is ICU-independent (UTF-16 code-unit order), so the block is byte-identical across turns and across Node builds — that determinism is what actually stabilizes the prefix.<data_access>block so Mari fetches any item by its exact name even when it isn't shown, and never tells the user an item doesn't exist just because it's past the cap.scripts/regressions/professor-mari-prompt-context.regression.ts(wired intoregression:issues) pinning: the stable/volatile split, order-independence, the cap + overflow hint, byte-determinism, and — via a source scan — that the caller never folds the volatile half back onto the system prompt.Deliberate choices flagged for maintainer input:
[fetch:]matches the full store by exact name (not the injected list) and the overflow hint tells Mari to try — but heavy-library users lose proactive enumeration beyond 100/type, and a fuzzy reference ("my chat with the vampire guy", no exact name) to a recent-but-unlisted item may miss where recency-ordering would have surfaced it.MAX_MARI_FETCHED_PRESET_CONTEXT_CHARS). A configurable version would pull in shared schema + client UI + locale keys; happy to do that as a stacked PR if wanted.No migration needed:
MARI_ASSISTANT_PROMPTis a compiled code constant (never persisted), so existing installs pick up the new text on upgrade.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated checks already run by the author (green), listed as evidence — not a substitute for the human browser pass below:
pnpm check(TypeScript + ESLint + build) green;pnpm lintexit 0.professor-mari-prompt-contextregression green; fullpnpm regression:issueschain green (incl.open-issuesandmessage-sharding);pnpm regression:prompt,professor-mari-shell-sandbox,professor-mari-wikigreen.Still needs a human pass in a real browser with a live LLM connection (the behavior isn't observable without real generation):
[fetch:]by name still fires the fetch snackbar and Mari speaks to the fetched data on the follow-up turn (the #898 silent-Mari guard — this is the wiring most worth eyeballing).usage.cachedPromptTokensacross a turn where a character is created mid-chat — before this change the next turn's cached tokens collapse; after, they should hold.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)The changed strings are prompt text sent to a model, not user-facing UI or docs — nothing under
docs/references them, so there's no docs ordocs-i18nobligation.Summary by CodeRabbit
Improvements
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.