[PR #5984] [MERGED] fix: report actual tool write outcomes and show failures #7015

Closed
opened 2026-10-23 04:15:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5984
Author: @SpicyMarinara
Created: 9/9/2026
Status: ✅ Merged
Merged: 9/9/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/game-tool-outcomes-5898-5901


📝 Commits (7)

  • 1df6319 chore: reserve tool outcome honesty issue sweep
  • 573c648 fix: report stored Game tool outcomes and surface refusals
  • fb351ac fix: save Game tool changes on the generated message and swipe
  • 68c6e3d Merge branch 'fix/capability-persistence-permissions-5899' into fix/game-tool-outcomes-5898-5901
  • a928a67 Merge remote-tracking branch 'origin/staging' into fix/game-tool-outcomes-5898-5901
  • a1867b1 fix: preserve authoritative locations in tool-created snapshots
  • 163fca6 Merge remote-tracking branch 'origin/staging' into fix/game-tool-outcomes-5898-5901

📊 Changes

10 files changed (+554 additions, -66 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
➕ e2e/game-tool-outcomes.e2e.ts (+109 -0)
📝 packages/client/src/hooks/use-generate.ts (+21 -1)
📝 packages/client/src/localization/locales/en.json (+3 -0)
📝 packages/server/src/routes/generate.routes.ts (+57 -36)
📝 packages/server/src/services/storage/game-state.storage.ts (+35 -0)
📝 packages/server/src/services/tools/tool-executor.ts (+19 -8)
📝 packages/shared/src/features/function-calls/tools/update-game-state/manifest.ts (+2 -4)
📝 scripts/regressions/game-mode-dice-tool.regression.ts (+28 -17)
➕ scripts/regressions/game-tool-outcomes.regression.ts (+279 -0)

📄 Description

Linked issue

Closes #5898. Closes #5901.

Why this change

A Game tool could tell the model a location or time change was applied before storage ran, even when a lock, missing snapshot, or Spatial Context ownership prevented the write. Tool refusals also disappeared unless debug mode was enabled.

What changed

Keep the existing location/time surface. During model tool rounds, valid requests receive an explicit pending receipt. After the response is saved, reuse the existing message/swipe snapshot writer and report the actual stored result to the client. The lock check and write share one transaction and recheck the current lock state. Earlier turns and sibling swipes stay unchanged; unsaved responses apply nothing. Tool-only turns reuse the hidden command anchor. Unavailable, unsupported, failed, and Spatial Context-owned writes return refusals. Removed unused target/key schema fields.

Failed or denied tool results now use the existing error notification in every chat mode. Repeated failures from the same tool share a notification, and only a short error explanation is shown. Raw results remain in debug output; existing dice cards are preserved.

Validation

Passed pnpm check, pnpm regression:prompt, the existing Game dice-tool regression, and the new game-tool-outcomes.regression.ts. The new proof fails against the old executor's false applied receipt and passes with the fix. It exercises actual file storage and the Fastify generation route, with only the model transport stubbed: accepted writes, locks, missing snapshots, Spatial Context ownership, storage failure, unsupported types and invalid receipts. CodeRabbit's snapshot-targeting finding was reproduced against the first implementation. The added proof covers new messages, regenerations, continuations, command-only anchors, failed narration, and a lock added between planning and saving. It verifies pending model receipts, final applied/refused events, and preserved earlier snapshots. Clock-only writes also retain Spatial Context's projected location when cloning a snapshot, while an existing target location remains unchanged.

Passed all 9 browser cases across Game, Roleplay and Conversation on desktop Chromium, mobile Chromium and mobile WebKit with debug disabled. Checked concise error text, notification deduplication and both themes; inspected captured mobile screenshots. Browser notification tests inject SSE fixtures; the server regression separately verifies the actual generation route and saved state. Screenshots are attached to the browser test artifacts.

  • Manually verify accepted and refused Game state changes with a live provider and installed Experience.
  • Manually verify notification readability on physical mobile hardware.

Docs and release impact

Added an Unreleased entry and localized notification copy. No new state schema or optional-package changes; no claim of live provider or physical-device testing.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5984 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/9/2026 **Status:** ✅ Merged **Merged:** 9/9/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/game-tool-outcomes-5898-5901` --- ### 📝 Commits (7) - [`1df6319`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1df63199f404792a96374120b5999d043a6766b8) chore: reserve tool outcome honesty issue sweep - [`573c648`](https://github.com/Pasta-Devs/Marinara-Engine/commit/573c648ef930190714c55a05f6769f369f376825) fix: report stored Game tool outcomes and surface refusals - [`fb351ac`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fb351acb53bba1fe65b7fe56a5b7cb6d7c6f9ad9) fix: save Game tool changes on the generated message and swipe - [`68c6e3d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/68c6e3dc5e692f13174ff99b716aeef03bea946f) Merge branch 'fix/capability-persistence-permissions-5899' into fix/game-tool-outcomes-5898-5901 - [`a928a67`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a928a6717dd93eb4da4f1d0373bc03253f435312) Merge remote-tracking branch 'origin/staging' into fix/game-tool-outcomes-5898-5901 - [`a1867b1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a1867b17979bcc6ba5942394769838d0ef4414c2) fix: preserve authoritative locations in tool-created snapshots - [`163fca6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/163fca6001ffdb9115b203a58074acec8e280444) Merge remote-tracking branch 'origin/staging' into fix/game-tool-outcomes-5898-5901 ### 📊 Changes **10 files changed** (+554 additions, -66 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) ➕ `e2e/game-tool-outcomes.e2e.ts` (+109 -0) 📝 `packages/client/src/hooks/use-generate.ts` (+21 -1) 📝 `packages/client/src/localization/locales/en.json` (+3 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+57 -36) 📝 `packages/server/src/services/storage/game-state.storage.ts` (+35 -0) 📝 `packages/server/src/services/tools/tool-executor.ts` (+19 -8) 📝 `packages/shared/src/features/function-calls/tools/update-game-state/manifest.ts` (+2 -4) 📝 `scripts/regressions/game-mode-dice-tool.regression.ts` (+28 -17) ➕ `scripts/regressions/game-tool-outcomes.regression.ts` (+279 -0) </details> ### 📄 Description ## Linked issue Closes #5898. Closes #5901. ## Why this change A Game tool could tell the model a location or time change was applied before storage ran, even when a lock, missing snapshot, or Spatial Context ownership prevented the write. Tool refusals also disappeared unless debug mode was enabled. ## What changed Keep the existing location/time surface. During model tool rounds, valid requests receive an explicit pending receipt. After the response is saved, reuse the existing message/swipe snapshot writer and report the actual stored result to the client. The lock check and write share one transaction and recheck the current lock state. Earlier turns and sibling swipes stay unchanged; unsaved responses apply nothing. Tool-only turns reuse the hidden command anchor. Unavailable, unsupported, failed, and Spatial Context-owned writes return refusals. Removed unused target/key schema fields. Failed or denied tool results now use the existing error notification in every chat mode. Repeated failures from the same tool share a notification, and only a short error explanation is shown. Raw results remain in debug output; existing dice cards are preserved. ## Validation Passed `pnpm check`, `pnpm regression:prompt`, the existing Game dice-tool regression, and the new `game-tool-outcomes.regression.ts`. The new proof fails against the old executor's false applied receipt and passes with the fix. It exercises actual file storage and the Fastify generation route, with only the model transport stubbed: accepted writes, locks, missing snapshots, Spatial Context ownership, storage failure, unsupported types and invalid receipts. CodeRabbit's snapshot-targeting finding was reproduced against the first implementation. The added proof covers new messages, regenerations, continuations, command-only anchors, failed narration, and a lock added between planning and saving. It verifies pending model receipts, final applied/refused events, and preserved earlier snapshots. Clock-only writes also retain Spatial Context's projected location when cloning a snapshot, while an existing target location remains unchanged. Passed all 9 browser cases across Game, Roleplay and Conversation on desktop Chromium, mobile Chromium and mobile WebKit with debug disabled. Checked concise error text, notification deduplication and both themes; inspected captured mobile screenshots. Browser notification tests inject SSE fixtures; the server regression separately verifies the actual generation route and saved state. Screenshots are attached to the browser test artifacts. - [ ] Manually verify accepted and refused Game state changes with a live provider and installed Experience. - [ ] Manually verify notification readability on physical mobile hardware. ## Docs and release impact Added an Unreleased entry and localized notification copy. No new state schema or optional-package changes; no claim of live provider or physical-device testing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:15:45 +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#7015
No description provided.