[GH-ISSUE #5242] [Issue]: Beholder wounds delta replaces co-located wounds instead of merging #2901

Closed
opened 2026-10-21 05:57:49 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @GetBeholder on GitHub (Aug 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5242

Originally assigned to: @GetBeholder on GitHub.

Summary

mergeSlotDelta in packages/server/src/services/agents/beholder-state.ts replaces a slot's entire wounds list whenever a delta contains wounds. Because the Beholder delta prompt emits only what changed this turn, a new wound on an already-wounded slot silently erases the wounds it did not re-mention.

Expected behavior

A delta adding one wound to a slot should leave that slot's existing wounds intact, the same way worn is merged by identity via mergeWornItems / wornItemIdentity.

Actual behavior

The prior wounds are dropped. Only the wounds named in the latest delta survive.

Steps to reproduce

  1. Enable the Beholder agent (delta protocol, package >= 1.1.0) in a Roleplay chat.
  2. Have a turn establish a wound, e.g. head -> { "text": "fractured skull", "severity": "critical" }. Confirm it appears in the Beholder physical-state panel.
  3. In a later turn, injure the same slot differently (e.g. a blow to the nose) so the model emits head.wounds: [{ "text": "broken nose", "severity": "serious" }].
  4. Observe the panel: the fractured skull is gone; only the broken nose remains.

Environment

  • Marinara Engine version: staging (v2.4.4, commit efbbf3cb3)
  • Install type: source
  • OS + version: Linux
  • Browser or app shell: n/a - server-side agent state merge

Logs, screenshots, or video

Not applicable - the defect is deterministic in the merge logic:

// packages/server/src/services/agents/beholder-state.ts
if (wounds.length > 0) {
  // Wound arrays are authoritative for a changed slot: the protocol has
  // no stable wound identity, so a non-empty delta replaces the list.
  next.wounds = wounds;
  used = true;
}

The stated premise ("no stable wound identity") does not hold for this protocol: the injury text is a usable identity, exactly as item is for worn entries directly above.

Additional context

Introduced alongside the delta-merge work in #5204. worn, holding, bare, and missing are all handled correctly; only wounds replaces. Full-snapshot responses are unaffected (they do not pass through mergeSlotDelta).

Distinct-wound healing (removing one of several co-located wounds) is not expressible in the current delta protocol; wholesale wounds: [] clearing plus a manual edit remains the interim path either way. So merging is a strict improvement with no regression.

Fix proposed in the linked PR.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @GetBeholder on GitHub (Aug 19, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5242 Originally assigned to: @GetBeholder on GitHub. ## Summary `mergeSlotDelta` in `packages/server/src/services/agents/beholder-state.ts` replaces a slot's entire `wounds` list whenever a delta contains wounds. Because the Beholder delta prompt emits **only what changed this turn**, a new wound on an already-wounded slot silently erases the wounds it did not re-mention. ## Expected behavior A delta adding one wound to a slot should leave that slot's existing wounds intact, the same way `worn` is merged by identity via `mergeWornItems` / `wornItemIdentity`. ## Actual behavior The prior wounds are dropped. Only the wounds named in the latest delta survive. ## Steps to reproduce 1. Enable the Beholder agent (delta protocol, package >= 1.1.0) in a Roleplay chat. 2. Have a turn establish a wound, e.g. `head` -> `{ "text": "fractured skull", "severity": "critical" }`. Confirm it appears in the Beholder physical-state panel. 3. In a later turn, injure the same slot differently (e.g. a blow to the nose) so the model emits `head.wounds: [{ "text": "broken nose", "severity": "serious" }]`. 4. Observe the panel: the fractured skull is gone; only the broken nose remains. ## Environment - Marinara Engine version: `staging` (v2.4.4, commit efbbf3cb3) - Install type: source - OS + version: Linux - Browser or app shell: n/a - server-side agent state merge ## Logs, screenshots, or video Not applicable - the defect is deterministic in the merge logic: ```ts // packages/server/src/services/agents/beholder-state.ts if (wounds.length > 0) { // Wound arrays are authoritative for a changed slot: the protocol has // no stable wound identity, so a non-empty delta replaces the list. next.wounds = wounds; used = true; } ``` The stated premise ("no stable wound identity") does not hold for this protocol: the injury `text` is a usable identity, exactly as `item` is for worn entries directly above. ## Additional context Introduced alongside the delta-merge work in #5204. `worn`, `holding`, `bare`, and `missing` are all handled correctly; only `wounds` replaces. Full-snapshot responses are unaffected (they do not pass through `mergeSlotDelta`). Distinct-wound *healing* (removing one of several co-located wounds) is not expressible in the current delta protocol; wholesale `wounds: []` clearing plus a manual edit remains the interim path either way. So merging is a strict improvement with no regression. Fix proposed in the linked PR. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:57:49 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2901
No description provided.