mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5677] [MERGED] feat(agents): let an operator correct Beholder's physical state #6879
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#6879
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/5677
Author: @GetBeholder
Created: 8/30/2026
Status: ✅ Merged
Merged: 8/30/2026
Merged by: @GetBeholder
Base:
staging← Head:fix/beholder-state-write📝 Commits (4)
5274983feat(agents): let an operator correct Beholder's physical statea7a6a03fix(agents): guard the Beholder state write and report a lost runf9f1400Merge branch 'staging' into fix/beholder-state-write1150493fix(agents): rate-limit the Beholder state write📊 Changes
2 files changed (+43 additions, -0 deletions)
View changed files
📝
packages/server/src/middleware/rate-limit.ts(+11 -0)📝
packages/server/src/routes/agents.routes.ts(+32 -0)📄 Description
Pull request
Linked issue
Closes #
Why this change
Beholder shows what the extractor believes about each character. When it is wrong there is currently no way to fix it.
The state a chat carries forward is the
resultDataof the agent's last successful run, andloadPriorBeholderStatebuilds the next prompt from that same record. So a correction has to land there or it means nothing — anything stored elsewhere would look right in the panel and then be narrated away on the following turn.The existing
PATCH /runs/:runIdcannot serve this. Both the listing and the patch reach runs through an inner join onagentConfigs, which a package agent's runs do not satisfy, so the client cannot discover the run id in the first place. Verified against a running Engine:GET /runs/:chatId/customreturns zero rows for a chat with Beholder state.What changed
One route, beside the
GETthat already reads this state:PUT /api/agents/beholder-state/:chatId— normalizes the submitted state, refuses it with 400 if it does not survive normalization, 404s when there is no run to correct yet, and otherwise updates the last successful Beholder run'sresultData.Nothing else is touched, and nothing outside the Beholder agent's own area of the routes file.
Package and security impact
beholderThe body is normalized with
normalizeBeholderStatebefore storage, so a malformed or hostile payload is rejected rather than written into the state the prompt is built from.Validation
tsc --noEmit -p packages/server/tsconfig.jsoncleanPUTreturns 200 and the followingGETreflects the changeManual verification notes
Tested by pointing an isolated Engine (own port, own DATA_DIR) at a build of this branch with the Beholder package installed, then driving the panel in a browser: open a slot, edit it, Apply, and confirm both that
GET /beholder-state/:chatIdreturns the edit and that the panel redraws with it. Also confirmed the 400 path by submitting a state that does not normalize.Documentation impact
UI evidence (if applicable)
The consuming UI ships in the Beholder package, not the Engine; screenshots belong with that change.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.