[PR #1120] [MERGED] Fix stale Game Mode backgrounds between sessions #4935

Closed
opened 2026-10-22 04:11:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1120
Author: @cha1latte
Created: 5/23/2026
Status: ✅ Merged
Merged: 5/23/2026
Merged by: @cha1latte

Base: staging ← Head: fix/issue-1108-stale-game-backgrounds


📝 Commits (1)

  • 1897507 Fix stale game session backgrounds

📊 Changes

6 files changed (+48 additions, -0 deletions)

View changed files

📝 packages/client/src/hooks/use-game.ts (+2 -0)
📝 packages/server/src/routes/game.routes.ts (+10 -0)
➕ pr-evidence/issue-1108/issue-1108-after.json (+16 -0)
➕ pr-evidence/issue-1108/issue-1108-after.png (+0 -0)
➕ pr-evidence/issue-1108/issue-1108-before.json (+20 -0)
➕ pr-evidence/issue-1108/issue-1108-before.png (+0 -0)

📄 Description

Linked issue

Closes #1108

Why this change

  • New Game Mode sessions could briefly show the previous session's background because next-session creation carried prior scene-media metadata and the client switched sessions before clearing the runtime asset store.

What changed

  • Clear Game Mode scene media metadata (gameSceneBackground, music, ambient, and recent media history) when /api/game/session/start creates a new session.
  • Reset the client Game Mode asset store before useStartSession switches the active chat to the new session.
  • Added scoped PR evidence for the before/after route proof under pr-evidence/issue-1108/.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Codex reproduced the bug with pnpm --filter @marinara-engine/server exec tsx ..\..\scratch\issue-1108-session-start-repro.ts --expect=buggy --label=before: the new session response carried gameSceneBackground, gameSceneMusic, gameSceneAmbient, gameRecentMusic, and gameRecentSpotifyTracks from the concluded session.
  • Codex verified the fix with pnpm --filter @marinara-engine/server exec tsx ..\..\scratch\issue-1108-session-start-repro.ts --expect=fixed --label=after: the new session response clears those scene-media fields while the negative-control gameInventory still carries forward.
  • Codex ran pnpm check; it passed.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json; it passed.
  • Codex Bunny review passed before opening this PR.
  • Not run by Codex: Docker/Raspberry Pi/Tailscale manual repro. The proved path is the route/client session-switch mechanism, not platform-specific rendering.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Before route proof:

Before route proof

After route proof:

After route proof

Raw proof JSON:


🔄 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/1120 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/23/2026 **Status:** ✅ Merged **Merged:** 5/23/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/issue-1108-stale-game-backgrounds` --- ### 📝 Commits (1) - [`1897507`](https://github.com/Pasta-Devs/Marinara-Engine/commit/18975074a12160457ecc1a634424acefe8f4bc3a) Fix stale game session backgrounds ### 📊 Changes **6 files changed** (+48 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/hooks/use-game.ts` (+2 -0) 📝 `packages/server/src/routes/game.routes.ts` (+10 -0) ➕ `pr-evidence/issue-1108/issue-1108-after.json` (+16 -0) ➕ `pr-evidence/issue-1108/issue-1108-after.png` (+0 -0) ➕ `pr-evidence/issue-1108/issue-1108-before.json` (+20 -0) ➕ `pr-evidence/issue-1108/issue-1108-before.png` (+0 -0) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #1108 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - New Game Mode sessions could briefly show the previous session's background because next-session creation carried prior scene-media metadata and the client switched sessions before clearing the runtime asset store. ## What changed <!-- List the key changes in this PR --> - Clear Game Mode scene media metadata (`gameSceneBackground`, music, ambient, and recent media history) when `/api/game/session/start` creates a new session. - Reset the client Game Mode asset store before `useStartSession` switches the active chat to the new session. - Added scoped PR evidence for the before/after route proof under `pr-evidence/issue-1108/`. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Codex reproduced the bug with `pnpm --filter @marinara-engine/server exec tsx ..\..\scratch\issue-1108-session-start-repro.ts --expect=buggy --label=before`: the new session response carried `gameSceneBackground`, `gameSceneMusic`, `gameSceneAmbient`, `gameRecentMusic`, and `gameRecentSpotifyTracks` from the concluded session. - Codex verified the fix with `pnpm --filter @marinara-engine/server exec tsx ..\..\scratch\issue-1108-session-start-repro.ts --expect=fixed --label=after`: the new session response clears those scene-media fields while the negative-control `gameInventory` still carries forward. - Codex ran `pnpm check`; it passed. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json`; it passed. - Codex Bunny review passed before opening this PR. - Not run by Codex: Docker/Raspberry Pi/Tailscale manual repro. The proved path is the route/client session-switch mechanism, not platform-specific rendering. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <!-- Add before/after screenshots or recordings for UI changes --> Before route proof: ![Before route proof](https://raw.githubusercontent.com/cha1latte/Marinara-Engine/18975074a12160457ecc1a634424acefe8f4bc3a/pr-evidence/issue-1108/issue-1108-before.png) After route proof: ![After route proof](https://raw.githubusercontent.com/cha1latte/Marinara-Engine/18975074a12160457ecc1a634424acefe8f4bc3a/pr-evidence/issue-1108/issue-1108-after.png) Raw proof JSON: - Before: https://raw.githubusercontent.com/cha1latte/Marinara-Engine/18975074a12160457ecc1a634424acefe8f4bc3a/pr-evidence/issue-1108/issue-1108-before.json - After: https://raw.githubusercontent.com/cha1latte/Marinara-Engine/18975074a12160457ecc1a634424acefe8f4bc3a/pr-evidence/issue-1108/issue-1108-after.json --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:50 +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#4935
No description provided.