[GH-ISSUE #414] [Issue]: Game Mode keeps reusing first library bg instead of generating a new one #172

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

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

Summary

When starting a new scene in Game Mode (with image generation enabled), the client never asks the server to generate a fresh background — it pins the scene to whichever library bg comes first in iteration order. On installs that include the legacy SillyTavern bg pack, this is backgrounds:user:ancient_library, so unrelated scenes appear to "stick" to the ancient library image.

Expected behavior

A novel scene location emitted by the scene model (e.g. backgrounds:fantasy:tavern-interior) should trigger generation through /game/generate-assets and the freshly generated image should render. A scene whose location genuinely overlaps an existing library bg (e.g. one containing both "dark" and "forest" → backgrounds:user:dark_forest) should still reuse the library bg.

Actual behavior

The client's resolveAssetTag always returns a library tag with score 1 — because tagScore counts the universal category prefix word (backgrounds) on both sides as a +1 match. Then bestMatch accepts any score > 0 and returns the first tag it walked, which on most installs is backgrounds:user:ancient_library (alphabetically first in the legacy bg folder).

The downstream effect inside applySceneResult:

  1. setCurrentBackground(resolved) is called with the wrong library tag immediately — the user sees the wrong bg.
  2. The unresolvedBg find then concludes the bg is already resolved (it lives in the manifest) and backgroundTag is omitted from the /game/generate-assets payload — so no generation is ever requested.

Server logs [game/scene-wrap] bg "<chosen>" not in manifest; generation will be deferred, but the deferred follow-up call from the client never names the bg, so nothing is generated.

Steps to reproduce

  1. Have the legacy data/backgrounds/ SillyTavern bg pack populated (any install where the user dropped in or kept the default 13 jpgs — ancient_library.jpg, dark_forest.jpg, etc.).
  2. Have empty data/game-assets/backgrounds/{fantasy,modern,scifi}/.
  3. Start a fresh Game Mode chat with sprite/image generation enabled and a configured image connection.
  4. Send the first user input that should land in a brand-new location (e.g. a bustling tavern).
  5. Observe: the displayed background is ancient_library.jpg (or whichever bg is first in the manifest), and /game/generate-assets is called without backgroundTag, so nothing is generated.

Environment

  • Marinara Engine version: 1.5.7
  • Install type: docker (EasyPanel-deployed Dockerfile build of fork main)
  • OS + version: Linux x86_64 container on Linode (host Ubuntu 22.04)
  • Browser or app shell: Chromium-based browser

Logs, screenshots, or video

Server stdout for the affected turns shows [game/scene-wrap] bg "X" not in manifest; generation will be deferred followed by no [game/generate-assets] background generation entry. The client console emits [asset-resolve] "<scene-tag>" → "backgrounds:user:ancient_library" (or whichever stock bg won the score=1 tie).

Additional context

A previous attempt to address a similar-sounding "wrong/sticking-bg" symptom on the multi-segment server path (commit 00e97fe) was reverted (4afed2d) when the deployed instance still showed the bug, because the actual root cause is on the client-side fuzzy matcher rather than in scene-wrap's multi-tag generation. PR coming.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (May 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/414 ## Summary When starting a new scene in Game Mode (with image generation enabled), the client never asks the server to generate a fresh background — it pins the scene to whichever library bg comes first in iteration order. On installs that include the legacy SillyTavern bg pack, this is `backgrounds:user:ancient_library`, so unrelated scenes appear to "stick" to the ancient library image. ## Expected behavior A novel scene location emitted by the scene model (e.g. `backgrounds:fantasy:tavern-interior`) should trigger generation through `/game/generate-assets` and the freshly generated image should render. A scene whose location genuinely overlaps an existing library bg (e.g. one containing both "dark" and "forest" → `backgrounds:user:dark_forest`) should still reuse the library bg. ## Actual behavior The client's `resolveAssetTag` always returns a library tag with score 1 — because `tagScore` counts the universal category prefix word (`backgrounds`) on both sides as a +1 match. Then `bestMatch` accepts any score > 0 and returns the first tag it walked, which on most installs is `backgrounds:user:ancient_library` (alphabetically first in the legacy bg folder). The downstream effect inside `applySceneResult`: 1. `setCurrentBackground(resolved)` is called with the wrong library tag immediately — the user sees the wrong bg. 2. The `unresolvedBg` find then concludes the bg is already resolved (it lives in the manifest) and `backgroundTag` is **omitted** from the `/game/generate-assets` payload — so no generation is ever requested. Server logs `[game/scene-wrap] bg "<chosen>" not in manifest; generation will be deferred`, but the deferred follow-up call from the client never names the bg, so nothing is generated. ## Steps to reproduce 1. Have the legacy `data/backgrounds/` SillyTavern bg pack populated (any install where the user dropped in or kept the default 13 jpgs — `ancient_library.jpg`, `dark_forest.jpg`, etc.). 2. Have empty `data/game-assets/backgrounds/{fantasy,modern,scifi}/`. 3. Start a fresh Game Mode chat with sprite/image generation enabled and a configured image connection. 4. Send the first user input that should land in a brand-new location (e.g. a bustling tavern). 5. Observe: the displayed background is `ancient_library.jpg` (or whichever bg is first in the manifest), and `/game/generate-assets` is called without `backgroundTag`, so nothing is generated. ## Environment - Marinara Engine version: 1.5.7 - Install type: docker (EasyPanel-deployed Dockerfile build of fork main) - OS + version: Linux x86_64 container on Linode (host Ubuntu 22.04) - Browser or app shell: Chromium-based browser ## Logs, screenshots, or video Server stdout for the affected turns shows `[game/scene-wrap] bg "X" not in manifest; generation will be deferred` followed by no `[game/generate-assets]` background generation entry. The client console emits `[asset-resolve] "<scene-tag>" → "backgrounds:user:ancient_library"` (or whichever stock bg won the score=1 tie). ## Additional context A previous attempt to address a similar-sounding "wrong/sticking-bg" symptom on the multi-segment server path (commit `00e97fe`) was reverted (`4afed2d`) when the deployed instance still showed the bug, because the actual root cause is on the client-side fuzzy matcher rather than in scene-wrap's multi-tag generation. PR coming. ## Template check - [ ] I DID NOT read this template and provide the requested details.
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#172
No description provided.