mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5284] [CLOSED] feat(agents): match the reference extractor's merge semantics and guards #6708
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#6708
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/5284
Author: @GetBeholder
Created: 8/19/2026
Status: ❌ Closed
Base:
staging← Head:feat/beholder-merge-parity📝 Commits (6)
ab4fc54feat(agents): validate Beholder extractions before they reach stated33a65bstyle(agents): format the vendored validator tablesaf7f6c4feat(agents): match the reference extractor's merge semantics77fef32feat(agents): discard characters the extractor invented60e5160Merge branch 'staging' into feat/beholder-merge-parityaaee151fix(agents): stop the normalizer overwriting fields a delta omitted📊 Changes
7 files changed (+5342 additions, -30 deletions)
View changed files
📝
packages/server/src/services/agents/agent-executor.ts(+52 -4)📝
packages/server/src/services/agents/beholder-state.ts(+161 -26)➕
packages/server/src/services/agents/beholder-validator-data.ts(+1251 -0)➕
packages/server/src/services/agents/beholder-validator.ts(+806 -0)➕
scripts/regressions/beholder-merge-parity.regression.ts(+193 -0)➕
scripts/regressions/beholder-validator-cases.json(+2784 -0)➕
scripts/regressions/beholder-validator-parity.regression.ts(+95 -0)📄 Description
Linked issue
No separate issue — continues the Beholder parity work behind #5251, #5280 and #5281. Stacked on #5281; review that first.
Why this change
Five ways tracked state drifted from what the story actually said. Each survives schema validation, so none of them errors — the state just quietly stops matching the fiction, and because it is fed back into the next extraction and the next response, it stays wrong.
{"item":"blazer","damage":"damaged"}— "the blazer is torn" — dropped the navy the blazer was already known to be. Same class as the wounds bug in #5241, on the other field."boots"appended a second entry beside a stored"boot"and the character was wearing two.missingwas trusted. Amputation is the field the extractor misfires on most, and a wrong one cascades and keeps being restated.wornlist is how "took it all off" is expressed; pruning removed it along with lists that were only emptied by stripping an invalid item.What changed
worn_removematches canonically too: removing "boots" clears a stored "boot".bareempties the stack; a garment added clears a stalebare. Slots the delta did not touch are left alone, because only a fresh assertion resolves the contradiction.stripModelMissing— model-emittedmissingis dropped before anything else sees it, matching the reference, which makes it manual-only. The slot editor and directives still set it.dropHallucinatedCharacters— a character is kept when it is the persona, already tracked, or named in the narration; anything else is dropped and logged. A tracked character survives a turn that never names it, since a pronoun-only sentence attributes by context.keepOriginallyEmptyin the validator — the model's own clears survive pruning, while a list emptied by stripping still collapses to a no-op so a bad emission cannot wipe a stack.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:
scripts/regressions/beholder-merge-parity.regression.ts(new, passing) — covers all five: colour surviving a damage update, co-located garments surviving, plural folding onto the stored singular with the surface form kept, canonicalworn_remove, bare emptying the stack and a garment clearing a stale bare,missingstripped with the rest of the slot intact, an explicit clear surviving the validator, a strip-emptied list not surviving, and the invented-character guard (whole-word matching, regex-significant names, persona and tracked names kept).an update keeps fields the delta did not re-emit; reverting canonical identity fails with"boots" updates the stored "boot" instead of stacking; removing the reconciliation fails withgoing bare empties the worn stack.keepOriginallyEmptychanges pruning without moving any oracle case.tsc -b ../shared && tsc --noEmit→ 0 errors), prettier clean, and the four existing Beholder regressions still pass.Not verified: behaviour against a live model. The judgement worth a maintainer's eye is
stripModelMissing— it is a deliberate capability removal (the model can no longer report amputation at all), taken from the reference because the false-positive rate there is worse than the missing feature.Summary by CodeRabbit
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.