mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5251] [MERGED] feat(agents): run Beholder as five narrow passes for per-lane extractors #6692
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#6692
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/5251
Author: @GetBeholder
Created: 8/19/2026
Status: ✅ Merged
Merged: 8/19/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/beholder-local-5pass📝 Commits (5)
82b024cfeat(agents): run Beholder as five narrow passes for per-lane extractors2cad5e5fix(agents): harden the Beholder lane path after revieweb40044fix(agents): require lane replies to match the extraction contract6fc7ad8Merge branch 'staging' into feat/beholder-local-5pass8da270fMerge branch 'staging' into feat/beholder-local-5pass📊 Changes
3 files changed (+446 additions, -1 deletions)
View changed files
📝
packages/server/src/services/agents/agent-executor.ts(+155 -1)📝
packages/server/src/services/agents/beholder-state.ts(+134 -0)➕
scripts/regressions/beholder-lane-passes.regression.ts(+157 -0)📄 Description
Linked issue
Follow-up to #5204 (the delta protocol) — extends it so a locally hosted per-lane Beholder extractor can be used as well as a SOTA model. Stacked on #5241; review that first (this branch contains its commits).
Why this change
Beholder currently issues one call asking for the whole physical state, which is right for a SOTA model. A locally hosted Beholder model is trained per lane — it answers about worn items, wounds, held items, species, or bare/missing flags one at a time. Handing it a single whole-state prompt is off-distribution for it, and it returns partial or malformed JSON.
This adds a second, opt-in execution shape so both kinds of model work behind the same agent, chosen by which prompt template the user picks.
What changed
parseBeholderLanePrompts()splits a prompt template that marks each lane with a[worn],[wounds],[holding],[species], or[flags]heading on its own line. It returnsnullunless all five lanes are present with non-empty bodies, so any ordinary single-prompt template falls through to the existing one-call path untouched.executeBeholderLanePasses()runs one call per lane with the same user message, thenmergeBeholderLaneDeltas()unions the five narrow deltas into one{changed, delta}payload. The lanes own disjoint slot fields, so the union is field-level and conflict-free. The merged delta then goes through the existingresolveBeholderStateResponsepath — nothing downstream changes.worn_removeis now honoured inmergeSlotDelta: the worn lane emits it for partial takeoff (the single-prompt path only ever clears a slot withworn: []). Named garments are subtracted by the same identitymergeWornItemsuses.{"tail": {}}) are anatomy hints, not state, so they no longer mark a turn as changed.No schema, storage, API, or client change. No new settings: the switch is the existing per-agent prompt-template selector, so a package can offer "single prompt" and "five passes" as two options.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Rather than tick boxes I did not earn: I have not exercised this against a live model in the app.
pnpm installfails in my environment at theonnxruntime-nodepostinstall, so I could not run the fullpnpm checkor launch the app. A maintainer should confirm a real end-to-end turn before merge.What I did verify locally, working around the broken install:
tsc -b ../shared && tsc --noEmitforpackages/serveragainst this branch's ownpackages/shared: 0 errors.scripts/regressions/beholder-lane-passes.regression.tsand ran it (exit 0). It covers: a single-prompt template and a partial template both parsing tonull(i.e. the existing path is preserved); a full five-lane template parsing into its five prompts; whitespace-tolerant headings; an empty lane body rejected; all-lanes-quiet producing a no-op; the five deltas unioning across the same and different slots; empty anatomy stubs not counting as a change; the unioned delta resolving against prior state withselfmapped back to the persona; andworn_removedropping a named garment while keeping the others.beholder-wound-merge.regression.tsfrom #5241 still passes.Note that
pull-request-checks.ymldoes not run the regression suite (onlyregression:launcher-updateandregression:android-local-auth), so neither regression file executes in CI as things stand.Sequencing note
A package that offers a five-pass template must require an Engine version containing this change — otherwise the whole multi-lane template is sent as one system prompt. Happy to follow up in
Marinara-Agentsonce this lands and the minimum version is known.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.