mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5280] [MERGED] feat(agents): give Beholder the reference extractor's exact input #6701
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#6701
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/5280
Author: @GetBeholder
Created: 8/19/2026
Status: ✅ Merged
Merged: 8/19/2026
Merged by: @GetBeholder
Base:
staging← Head:feat/beholder-normalize-prose📝 Commits (3)
bfdd694feat(agents): normalize prose and stop truncating it for Beholder3453961feat(agents): give Beholder the reference extractor's exact input60c39f3fix(agents): decode entities once and strip tags to a fixed point📊 Changes
5 files changed (+371 additions, -3 deletions)
View changed files
📝
packages/server/src/services/agents/agent-executor.ts(+40 -3)➕
packages/server/src/services/agents/beholder-normalizer.ts(+151 -0)📝
packages/server/src/services/agents/beholder-state.ts(+40 -0)➕
scripts/regressions/beholder-normalizer.regression.ts(+79 -0)➕
scripts/regressions/beholder-user-message.regression.ts(+61 -0)📄 Description
Linked issue
No separate issue — corrective follow-up to #5251 (merged), which added the Beholder execution path this feeds.
Why this change
Beholder was being handed an input that does not match what its extractor reads.
The Agent went through the shared scaffolding: the prompt wrapped in
<role>/<lore>/<agents>, an output-format block and other context appended, the tracked state buried in the system message, and chat history passed as separate turns — each stripped of tags and cut at 2000 characters.A strong general model reads past all of that. A small purpose-trained extractor cannot: it was fitted to one exact input shape and treats surrounding text as part of the task. Three concrete gaps:
*She tugs her coat tighter.*was reaching the model verbatim.What changed
beholder-normalizer.ts(new) — port of the reference normalizer from GetBeholder/Beholder-ME (AGPL-3.0-only, same origin as the rest of the Agent). Step order preserved deliberately: it is a contract with the model, not a formatting preference.buildBeholderUserMessage()— the exact training layout:Persona:/Current state:/Narration:, state keyed by character with the persona asself, serialized compactly, and omitted entirely when nothing is tracked yet rather than sent as{}.buildBeholderMessages()— builds the two messages directly, bypassing the shared builder: raw prompt as system, one user message, narration normalized and not truncated. Used by both the single-prompt and per-lane paths.Also hardens the normalizer against a backtracking hazard inherited from the reference: two dialogue patterns had a character class containing a space followed by
\s*, which is ambiguous and backtracks polynomially on long runs of spaces — reachable precisely because this PR removes the length cap. The class already absorbs those spaces and the captured name is trimmed, so the accepted language is unchanged.No schema, storage, API, or client change.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Boxes left for a human —
pnpm installfails in my environment at theonnxruntime-nodepostinstall (it rejects CUDA 13), so I cannot run the fullpnpm checkor the app.What I did run:
tsc -b ../shared && tsc --noEmitforpackages/server→ 0 errors. Prettier clean.beholder-normalizer.regression.ts(new) — asterisk actions, markdown emphasis,snake_caseleft alone, block markup, BBCode, HTML with<br>as a break, entity decoding, OOC removal, stage directions, labeled and ALLCAPS dialogue with terminal-punctuation fixes, whitespace collapse, empty input, and a mixed realistic turn. It also asserts already-canonical prose passes through byte-identical — the normalizer must never rewrite what the extractor was trained on.beholder-user-message.regression.ts(new) — pins the layout byte-for-byte, plusselfmapping, compact (never indented) state, the state block omitted on a cold start, no persona line when there is no persona, and verbatim narration.beholder-lane-passesandbeholder-wound-mergeregressions still pass.Not verified: behaviour against a live model in the app. The judgement worth a maintainer's eye is letting one agent opt out of the shared scaffolding — the alternative keeps Beholder on a shape its extractor was not trained for.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.