[GH-ISSUE #2077] [Issue]: Inventory Tracker silently drops valid agent results (bare root envelope not applied) #1903

Closed
opened 2026-11-07 16:37:34 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @fishy1boy13 on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/2077

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The Inventory Tracker agent often returns its changes as a bare root-level envelope, {"updates":[...],"removed":[...]}, with no group name. The host only reads currencies, equipped and inventory, so a bare envelope is treated as "no change": nothing is applied, nothing is logged, and the run is still recorded as a success. In one long chat, 31 of 54 Inventory runs returned only a bare envelope (28 of them with real changes), and 2 more mixed a group-shaped part with a stray bare part. In total 30 runs carried real changes that were silently discarded. The agent's values were correct; the tracker never received them.

Correction: an earlier version of this issue said the agent could not see changes made in the user's turn, and blamed the prompt for reading only the latest assistant message. That was wrong. The agent runs on and reads the user's turn. The real cause is that the host drops bare-envelope results. The earlier text has been replaced.

Affected package

inventory-tracker (package version 1.2.1)

Expected behavior

Every change the agent returns for currencies, equipped or inventory is applied to the tracker. If a result contains none of the recognised groups, it is treated as unusable (retried, or shown as a failed run) rather than recorded as a successful no-change.

Actual behavior

  • An agent result such as {"updates":[{"name":"Coins","qty":5}]} changes nothing. The run is saved as successful and no log line is written.
  • Breakdown of the 54 Inventory runs in the affected chat (all 54 recorded success: true, none with an error):
    • 28 returned only a bare envelope with real changes
    • 3 returned only a bare envelope with empty arrays
    • 2 returned a group-shaped part plus a stray bare updates with real changes
    • 21 returned nothing to change
  • This accounts for every miss seen in that chat: purchases (a currency set to a new value in a bare payload), removals (an item listed in a bare removed), and partial application (in a mixed response I checked, the group-shaped inventory array was applied while the bare cash update in the same response was dropped).
  • Where this happens (Marinara Engine, staging): buildLockedInventoryTrackerPatch in packages/server/src/routes/generate/generate-route-utils.ts reads only data.currencies, data.equipped and data.inventory; with none of them present it returns { changed: false }. In packages/server/src/services/agents/agent-executor.ts, a bare envelope is tolerated only for single-group trackers (SINGLE_GROUP_TRACKER_KEYS: custom tracker and character tracker). The three-group Inventory tracker has no such tolerance.

Steps to reproduce

Intermittent, since it depends on the shape the model chooses:

  1. Roleplay chat with the Inventory Tracker active, a currency and a couple of items, and a small fast model on the agent connection.
  2. Play several turns with purchases, drops and pickups.
  3. After each reply compare the tracker with the story. For turns where it did not change, open the saved agent run for that message (agent run store) and compare its resultData with the tracker snapshot.
  4. Look for runs whose resultData has top-level updates / removed and none of currencies / equipped / inventory.

Environment

  • Marinara Engine version: staging build v2.5.0-4144-g1a2e4e78c
  • Package version: inventory-tracker 1.2.1
  • Install type: source
  • OS + version: Linux
  • Browser or app shell: browser
  • Agent: post_processing, contextSize 5, same connection as the chat (deepseek-v4.1-flash). This instance appends four extra currency rules (numbered 9-12) to the package prompt. They do not concern the output shape, but the unmodified package prompt has not been tested.

Logs, screenshots, or video

Generic example of a dropped result (values changed):

{"updates":[{"name":"Coins","qty":5}]}

Tracker change: none. Run status: success. The saved runs are in the agent run store; I found no route that returns a built-in tracker agent's runs, so they can only be read from the data files.

Additional context

Likely cause (my inference): the package prompt introduces the incremental format as {"updates": [rows], "removed": ["existing identity"]} without naming the group, while its legacy schema example nests rows under currencies / equipped / inventory. A model can reasonably emit the bare form, and the host does not accept it for the three-group tracker.

Suggested:

  • Package prompt (this repo): show the nested incremental shape explicitly, for example {"currencies": {"updates": [...], "removed": [...]}, "inventory": {"updates": [...]}}.
  • Host side (Marinara-Engine, separate issue, not yet filed): treat an Inventory result with unrecognised top-level keys as invalid (retry like invalid JSON) or accept the bare form, and log a warning either way.

Closed issues I found that do not cover this: Pasta-Devs/Marinara-Agents#976, Pasta-Devs/Marinara-Engine#6387 and Pasta-Devs/Marinara-Engine#5125. The Engine-side issue will be linked here once it is filed.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @fishy1boy13 on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/2077 Originally assigned to: @SpicyMarinara on GitHub. ## Summary The Inventory Tracker agent often returns its changes as a bare root-level envelope, `{"updates":[...],"removed":[...]}`, with no group name. The host only reads `currencies`, `equipped` and `inventory`, so a bare envelope is treated as "no change": nothing is applied, nothing is logged, and the run is still recorded as a success. In one long chat, 31 of 54 Inventory runs returned only a bare envelope (28 of them with real changes), and 2 more mixed a group-shaped part with a stray bare part. In total 30 runs carried real changes that were silently discarded. The agent's values were correct; the tracker never received them. > **Correction:** an earlier version of this issue said the agent could not see changes made in the user's turn, and blamed the prompt for reading only the latest assistant message. That was wrong. The agent runs on and reads the user's turn. The real cause is that the host drops bare-envelope results. The earlier text has been replaced. ## Affected package inventory-tracker (package version 1.2.1) ## Expected behavior Every change the agent returns for currencies, equipped or inventory is applied to the tracker. If a result contains none of the recognised groups, it is treated as unusable (retried, or shown as a failed run) rather than recorded as a successful no-change. ## Actual behavior - An agent result such as `{"updates":[{"name":"Coins","qty":5}]}` changes nothing. The run is saved as successful and no log line is written. - Breakdown of the 54 Inventory runs in the affected chat (all 54 recorded `success: true`, none with an error): - 28 returned only a bare envelope with real changes - 3 returned only a bare envelope with empty arrays - 2 returned a group-shaped part plus a stray bare `updates` with real changes - 21 returned nothing to change - This accounts for every miss seen in that chat: purchases (a currency set to a new value in a bare payload), removals (an item listed in a bare `removed`), and partial application (in a mixed response I checked, the group-shaped `inventory` array was applied while the bare cash update in the same response was dropped). - Where this happens (Marinara Engine, staging): `buildLockedInventoryTrackerPatch` in `packages/server/src/routes/generate/generate-route-utils.ts` reads only `data.currencies`, `data.equipped` and `data.inventory`; with none of them present it returns `{ changed: false }`. In `packages/server/src/services/agents/agent-executor.ts`, a bare envelope is tolerated only for single-group trackers (`SINGLE_GROUP_TRACKER_KEYS`: custom tracker and character tracker). The three-group Inventory tracker has no such tolerance. ## Steps to reproduce Intermittent, since it depends on the shape the model chooses: 1. Roleplay chat with the Inventory Tracker active, a currency and a couple of items, and a small fast model on the agent connection. 2. Play several turns with purchases, drops and pickups. 3. After each reply compare the tracker with the story. For turns where it did not change, open the saved agent run for that message (agent run store) and compare its `resultData` with the tracker snapshot. 4. Look for runs whose `resultData` has top-level `updates` / `removed` and none of `currencies` / `equipped` / `inventory`. ## Environment - Marinara Engine version: staging build v2.5.0-4144-g1a2e4e78c - Package version: inventory-tracker 1.2.1 - Install type: source - OS + version: Linux - Browser or app shell: browser - Agent: `post_processing`, `contextSize` 5, same connection as the chat (deepseek-v4.1-flash). This instance appends four extra currency rules (numbered 9-12) to the package prompt. They do not concern the output shape, but the unmodified package prompt has not been tested. ## Logs, screenshots, or video Generic example of a dropped result (values changed): ``` {"updates":[{"name":"Coins","qty":5}]} ``` Tracker change: none. Run status: success. The saved runs are in the agent run store; I found no route that returns a built-in tracker agent's runs, so they can only be read from the data files. ## Additional context Likely cause (my inference): the package prompt introduces the incremental format as `{"updates": [rows], "removed": ["existing identity"]}` without naming the group, while its legacy schema example nests rows under `currencies` / `equipped` / `inventory`. A model can reasonably emit the bare form, and the host does not accept it for the three-group tracker. Suggested: - Package prompt (this repo): show the nested incremental shape explicitly, for example `{"currencies": {"updates": [...], "removed": [...]}, "inventory": {"updates": [...]}}`. - Host side (Marinara-Engine, separate issue, not yet filed): treat an Inventory result with unrecognised top-level keys as invalid (retry like invalid JSON) or accept the bare form, and log a warning either way. Closed issues I found that do not cover this: Pasta-Devs/Marinara-Agents#976, Pasta-Devs/Marinara-Engine#6387 and Pasta-Devs/Marinara-Engine#5125. The Engine-side issue will be linked here once it is filed. ## Template check - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Nov 3, 2026):

The host half is filed as Pasta-Devs/Marinara-Engine#8714: the Engine applies a bare envelope's rows when their group is unambiguous, and treats one with no usable group as an invalid result rather than a successful no-change. The package prompt fix stays here.

<!-- gh-comment-id:6602931474 --> @SpicyMarinara commented on GitHub (Nov 3, 2026): The host half is filed as Pasta-Devs/Marinara-Engine#8714: the Engine applies a bare envelope's rows when their group is unambiguous, and treats one with no usable group as an invalid result rather than a successful no-change. The package prompt fix stays here.
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-Agents#1903
No description provided.