[GH-ISSUE #872] [Issue]: Automation data expunge deletes saved game state from surviving chats #427

Closed
opened 2026-10-20 17:28:44 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @NeoKazuya on GitHub (May 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/872

Originally assigned to: @cha1latte on GitHub.

Summary

Clearing the "Automation & Themes" data scope deletes saved game-state snapshots even though chats and messages are preserved. Existing game chats remain visible, but their saved scene/progress state can return null afterward.

Expected behavior

The "Automation & Themes" scope should clear the data named by that scope: agents, custom tools, regex scripts, synced themes, and automation state. It should not delete durable chat/game runtime state for chats that survive the operation.

Game-state snapshots should be deleted only when the Chats & Messages scope is selected, or when Clear All Data selects all scopes.

Actual behavior

Using Settings -> Advanced -> Danger Zone to clear only "Automation & Themes" sends POST /api/admin/expunge with scopes: ["automation"]. That route deletes game_state_snapshots. The affected game chat still exists, but GET /api/chats/:id/game-state returns null.

Steps to reproduce

  1. Create or open a game chat that has saved game state, such as a location.
  2. Open Settings -> Advanced -> Danger Zone.
  3. Select only "Automation & Themes".
  4. Click "Clear Selected Data" and confirm.
  5. Reopen the same game chat or call GET /api/chats/:id/game-state.
  6. Observe that the game state is gone even though the chat was not deleted.

Environment

  • Marinara Engine version: 1.5.9+ed59b87df901
  • Install type: Source
  • OS + version: Windows 11 Pro 10.0.26200
  • Browser or app shell: Chrome 148.0.7778.168

Logs, screenshots, or video

Reproduced on 1.5.9+ed59b87df901 by clearing only "Automation & Themes" from Settings. The chat still existed afterward, but GET /api/chats/:id/game-state changed from returning the saved state to returning null.

Additional context

Likely cause: packages/server/src/routes/admin.routes.ts deletes game_state_snapshots in both the chats scope and the automation scope. The chats scope delete is expected; the automation scope delete causes the data loss.

Checked current main at 8a18a8c7; the relevant Settings label and admin expunge route are unchanged there.

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 @NeoKazuya on GitHub (May 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/872 Originally assigned to: @cha1latte on GitHub. ## Summary Clearing the "Automation & Themes" data scope deletes saved game-state snapshots even though chats and messages are preserved. Existing game chats remain visible, but their saved scene/progress state can return `null` afterward. ## Expected behavior The "Automation & Themes" scope should clear the data named by that scope: agents, custom tools, regex scripts, synced themes, and automation state. It should not delete durable chat/game runtime state for chats that survive the operation. Game-state snapshots should be deleted only when the Chats & Messages scope is selected, or when Clear All Data selects all scopes. ## Actual behavior Using Settings -> Advanced -> Danger Zone to clear only "Automation & Themes" sends `POST /api/admin/expunge` with `scopes: ["automation"]`. That route deletes `game_state_snapshots`. The affected game chat still exists, but `GET /api/chats/:id/game-state` returns `null`. ## Steps to reproduce 1. Create or open a game chat that has saved game state, such as a location. 2. Open Settings -> Advanced -> Danger Zone. 3. Select only "Automation & Themes". 4. Click "Clear Selected Data" and confirm. 5. Reopen the same game chat or call `GET /api/chats/:id/game-state`. 6. Observe that the game state is gone even though the chat was not deleted. ## Environment - Marinara Engine version: `1.5.9+ed59b87df901` - Install type: Source - OS + version: Windows 11 Pro 10.0.26200 - Browser or app shell: Chrome 148.0.7778.168 ## Logs, screenshots, or video Reproduced on `1.5.9+ed59b87df901` by clearing only "Automation & Themes" from Settings. The chat still existed afterward, but `GET /api/chats/:id/game-state` changed from returning the saved state to returning `null`. ## Additional context Likely cause: `packages/server/src/routes/admin.routes.ts` deletes `game_state_snapshots` in both the `chats` scope and the `automation` scope. The `chats` scope delete is expected; the `automation` scope delete causes the data loss. Checked current `main` at `8a18a8c7`; the relevant Settings label and admin expunge route are unchanged there. ## 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-20 17:28:44 +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#427
No description provided.