[GH-ISSUE #7208] [Issue]: Character Tracker silently discards updates returned at the result root #4024

Closed
opened 2026-10-21 06:09:38 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @bahaynes on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7208

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When the Character Tracker model returns its incremental update as { "updates": [...], "removed": [...] } at the root of the result, instead of under presentCharacters, the whole update is thrown away. The run is still recorded as successful. Custom Tracker already accepts this shape; Character Tracker does not.

Expected behavior

A root-level { updates, removed } envelope from Character Tracker is merged into the present characters, the same way Custom Tracker accepts a root envelope as fields.

Actual behavior

parseAgentResponse (packages/server/src/services/agents/agent-executor.ts) only re-wraps a root envelope for custom_tracker_update. For character_tracker_update the result keeps the envelope at the root. In generate.routes.ts, the Character Tracker merge then finds no presentCharacters, logs character-tracker emitted no presentCharacters; keeping existing snapshot at debug level, and skips the update.

Because the run counts as a success, nothing reaches the user. The next turn feeds the stale snapshot back to the model, which tends to revert moods and outfits.

Steps to reproduce

  1. Enable Character Tracker in a Roleplay chat. It reproduced most often when batched with World State.
  2. Play some turns, then look at the stored runs: mari db select agent_runs --where "row.agentType === 'character-tracker'".
  3. Some successful runs have updates / removed at the top level of resultData, with no presentCharacters. The tracker panel does not change on those turns.

On one chat with the default package prompt, 13 of 25 Character Tracker runs had the root shape and were discarded.

Environment

  • Marinara Engine version: 2.4.6 (staging)
  • Install type: docker
  • OS + version: NixOS (Linux 6.18)
  • Browser or app shell: n/a (server side)

Logs, screenshots, or video

Nothing is logged at info level. At debug level each discarded turn logs
[generate] character-tracker emitted no presentCharacters; keeping existing snapshot.

From the stored agent_runs on my instance (Jul 10 – Oct 6): 91 of 1,278 Character Tracker runs (7%)
had the envelope at the root and were discarded, all recorded as success: true, across 7 of 11 chats
(worst chat: 31 of 68 runs). Most were { updates, removed } or { updates } with an array.

A discarded result, values redacted:

{
  "updates": [
    { "characterId": "<characterId>", "name": "<name>", "emoji": "<emoji>",
      "mood": "<mood>", "thoughts": "<thoughts>", "outfit": "<outfit>" }
  ],
  "removed": []
}

Additional context

The batch and incremental hints never show the envelope's parent key, so models reasonably emit it at the root.

A minimal fix mirrors the existing Custom Tracker tolerance in parseAgentResponse:

if (resultType === "character_tracker_update" && isTrackerRowsUpdate(data) && !("presentCharacters" in data)) {
  const { updates, removed } = data;
  data = { ...data, presentCharacters: { updates, removed } };
}

I've been running this locally with a regression in agent-runtime.regression.ts covering both the individual and batched paths, and can open a PR against staging if that's welcome.

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 @bahaynes on GitHub (Oct 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7208 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When the Character Tracker model returns its incremental update as `{ "updates": [...], "removed": [...] }` at the root of the result, instead of under `presentCharacters`, the whole update is thrown away. The run is still recorded as successful. Custom Tracker already accepts this shape; Character Tracker does not. ## Expected behavior A root-level `{ updates, removed }` envelope from Character Tracker is merged into the present characters, the same way Custom Tracker accepts a root envelope as `fields`. ## Actual behavior `parseAgentResponse` (`packages/server/src/services/agents/agent-executor.ts`) only re-wraps a root envelope for `custom_tracker_update`. For `character_tracker_update` the result keeps the envelope at the root. In `generate.routes.ts`, the Character Tracker merge then finds no `presentCharacters`, logs `character-tracker emitted no presentCharacters; keeping existing snapshot` at debug level, and skips the update. Because the run counts as a success, nothing reaches the user. The next turn feeds the stale snapshot back to the model, which tends to revert moods and outfits. ## Steps to reproduce 1. Enable Character Tracker in a Roleplay chat. It reproduced most often when batched with World State. 2. Play some turns, then look at the stored runs: `mari db select agent_runs --where "row.agentType === 'character-tracker'"`. 3. Some successful runs have `updates` / `removed` at the top level of `resultData`, with no `presentCharacters`. The tracker panel does not change on those turns. On one chat with the default package prompt, 13 of 25 Character Tracker runs had the root shape and were discarded. ## Environment - Marinara Engine version: 2.4.6 (staging) - Install type: docker - OS + version: NixOS (Linux 6.18) - Browser or app shell: n/a (server side) ## Logs, screenshots, or video Nothing is logged at info level. At debug level each discarded turn logs `[generate] character-tracker emitted no presentCharacters; keeping existing snapshot`. From the stored `agent_runs` on my instance (Jul 10 – Oct 6): 91 of 1,278 Character Tracker runs (7%) had the envelope at the root and were discarded, all recorded as `success: true`, across 7 of 11 chats (worst chat: 31 of 68 runs). Most were `{ updates, removed }` or `{ updates }` with an array. A discarded result, values redacted: { "updates": [ { "characterId": "<characterId>", "name": "<name>", "emoji": "<emoji>", "mood": "<mood>", "thoughts": "<thoughts>", "outfit": "<outfit>" } ], "removed": [] } ## Additional context The batch and incremental hints never show the envelope's parent key, so models reasonably emit it at the root. A minimal fix mirrors the existing Custom Tracker tolerance in `parseAgentResponse`: if (resultType === "character_tracker_update" && isTrackerRowsUpdate(data) && !("presentCharacters" in data)) { const { updates, removed } = data; data = { ...data, presentCharacters: { updates, removed } }; } I've been running this locally with a regression in `agent-runtime.regression.ts` covering both the individual and batched paths, and can open a PR against `staging` if that's welcome. ## 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 06:09:38 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 7, 2026):

Claude is taking this issue for @SpicyMarinara. I checked for linked, open and draft PRs first; none exist. The fix will target staging. Thank you for the precise report.

<!-- gh-comment-id:6032973914 --> @SpicyMarinara commented on GitHub (Oct 7, 2026): Claude is taking this issue for @SpicyMarinara. I checked for linked, open and draft PRs first; none exist. The fix will target `staging`. Thank you for the precise report.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 7, 2026):

Fixed on staging by #7222. Ships to main with the next promotion.

<!-- gh-comment-id:6035035715 --> @SpicyMarinara commented on GitHub (Oct 7, 2026): Fixed on `staging` by #7222. Ships to `main` with the next promotion.
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#4024
No description provided.