[GH-ISSUE #5898] update_game_state tells the model a change was applied when four of its six change types are written nowhere #3255

Closed
opened 2026-10-21 06:01:21 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

The built-in update_game_state tool accepts six change types and always answers applied: true, but
only two of them — location_change and time_advance — are ever written to anything. stat_change,
inventory_add, inventory_remove and quest_update are echoed back to the model as successes and
then dropped. On a chat owned by an Experience package in Game Mode, location_change is deliberately
ignored too, so time_advance is the only type on that path that does anything at all. Nothing tells
the model, the user, or the log that the other changes went nowhere.

Where it is. The tool's own handler is a pass-through stub that validates nothing and returns
applied: true for whatever type/target/key/value the model supplied
(packages/server/src/services/tools/tool-executor.ts:526-539, comment: "Returns the update
instruction — the client/agent pipeline applies it"). The only place that actually persists anything
is packages/server/src/routes/generate.routes.ts:6595-6628, which maps location_change → location
and time_advance → time into gameStateStore.updateLatest() and emits a game_state_patch SSE.
The four remaining enum values (declared at
packages/shared/src/features/function-calls/tools/update-game-state/manifest.ts:12) appear in no
other write path — the quest_update hits elsewhere in generate.routes.ts:9340 belong to the Quest
Tracker agent result pipeline, which is a different mechanism with a different payload. The
Experience suppression is generate.routes.ts:6604-6611, which logs at debug and drops the location.
The tool is on by default whenever tool use is enabled: it is in neither the agent-only set
(packages/server/src/services/generation/tool-resolution-runtime.ts:111-118) nor the default-off set
(:126), and isChatToolEnabledByDefault (:128-130) is what an unfiltered chat is filtered by
(:450), so a plain "Enable Tool Use" with no per-chat filter offers it. To see it: turn on tool use
in a Game chat and ask the GM to give you an item or raise a stat. With debug mode on you will watch
the call go out and come back applied: true; the inventory and the stats do not move.

Why it matters. The model is being lied to about its own effects, and it acts on the lie — it will
narrate the sword you now own and the strength you just gained, then keep referring to both, while the
HUD and the saved game state never heard about either. The player sees the story and the sheet drift
apart with nothing to explain it, and there is no error, no warning line, and no user-visible signal
that a change was discarded. It is also the exact failure the write-back channel in #5798 is designed
to avoid, sitting in the tree as a shipped counter-example.

The smallest honest fix is to stop declaring what the engine does not do, which means deciding one
question first: are the four missing types supposed to be persisted, or were they always aspirational?
If they are meant to work, they need real write paths and real targets — target/key are free-form
strings today with nothing checking that they name anything that exists. If they were never going to
work, the enum should shrink to the two that do, so the model is offered a tool whose whole surface is
honest. Either way the pass-through applied: true should stop being unconditional: a type the server
does not handle should come back as a refusal the model can read, not a success. A related PR narrows
the enum to location_change + time_advance as a stopgap; the persist-or-delete decision is this
issue's, not that PR's.

Originally created by @kolacheee on GitHub (Sep 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5898 Originally assigned to: @SpicyMarinara on GitHub. The built-in `update_game_state` tool accepts six change types and always answers `applied: true`, but only two of them — `location_change` and `time_advance` — are ever written to anything. `stat_change`, `inventory_add`, `inventory_remove` and `quest_update` are echoed back to the model as successes and then dropped. On a chat owned by an Experience package in Game Mode, `location_change` is deliberately ignored too, so `time_advance` is the only type on that path that does anything at all. Nothing tells the model, the user, or the log that the other changes went nowhere. Where it is. The tool's own handler is a pass-through stub that validates nothing and returns `applied: true` for whatever `type`/`target`/`key`/`value` the model supplied (`packages/server/src/services/tools/tool-executor.ts:526-539`, comment: "Returns the update instruction — the client/agent pipeline applies it"). The only place that actually persists anything is `packages/server/src/routes/generate.routes.ts:6595-6628`, which maps `location_change → location` and `time_advance → time` into `gameStateStore.updateLatest()` and emits a `game_state_patch` SSE. The four remaining enum values (declared at `packages/shared/src/features/function-calls/tools/update-game-state/manifest.ts:12`) appear in no other write path — the `quest_update` hits elsewhere in `generate.routes.ts:9340` belong to the Quest Tracker *agent* result pipeline, which is a different mechanism with a different payload. The Experience suppression is `generate.routes.ts:6604-6611`, which logs at debug and drops the location. The tool is on by default whenever tool use is enabled: it is in neither the agent-only set (`packages/server/src/services/generation/tool-resolution-runtime.ts:111-118`) nor the default-off set (`:126`), and `isChatToolEnabledByDefault` (`:128-130`) is what an unfiltered chat is filtered by (`:450`), so a plain "Enable Tool Use" with no per-chat filter offers it. To see it: turn on tool use in a Game chat and ask the GM to give you an item or raise a stat. With debug mode on you will watch the call go out and come back `applied: true`; the inventory and the stats do not move. Why it matters. The model is being lied to about its own effects, and it acts on the lie — it will narrate the sword you now own and the strength you just gained, then keep referring to both, while the HUD and the saved game state never heard about either. The player sees the story and the sheet drift apart with nothing to explain it, and there is no error, no warning line, and no user-visible signal that a change was discarded. It is also the exact failure the write-back channel in #5798 is designed to avoid, sitting in the tree as a shipped counter-example. The smallest honest fix is to stop declaring what the engine does not do, which means deciding one question first: are the four missing types supposed to be persisted, or were they always aspirational? If they are meant to work, they need real write paths and real targets — `target`/`key` are free-form strings today with nothing checking that they name anything that exists. If they were never going to work, the enum should shrink to the two that do, so the model is offered a tool whose whole surface is honest. Either way the pass-through `applied: true` should stop being unconditional: a type the server does not handle should come back as a refusal the model can read, not a success. A related PR narrows the enum to `location_change` + `time_advance` as a stopgap; the persist-or-delete decision is this issue's, not that PR's.
bsakaguchi 2026-10-21 06:01:21 +07:00
  • closed this issue
  • added the
    in-pr
    label
Author
Owner

@SpicyMarinara commented on GitHub (Sep 9, 2026):

@SpicyMarinara owns the remaining persistence-honesty work in draft #5984. I am keeping the two supported location/time updates, removing the optimistic applied receipt, and returning a refusal for unavailable, locked, or Experience-owned writes.

<!-- gh-comment-id:5594322824 --> @SpicyMarinara commented on GitHub (Sep 9, 2026): @SpicyMarinara owns the remaining persistence-honesty work in draft #5984. I am keeping the two supported location/time updates, removing the optimistic applied receipt, and returning a refusal for unavailable, locked, or Experience-owned writes.
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#3255
No description provided.