mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3120] [Issue]: Manual Game background generation skips the prompt-review setting and reuses the same image across locations #1672
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1672
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3120
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
The manual "generate background" button in Game mode behaves differently from the automatic Illustrator, in two visible ways:
Both come from one root cause: the manual button uses a separate code path (
/backgrounds/generate-scene→generateChatBackground) instead of the Illustrator's path (/game/generate-assets→generateBackground), and that separate path has neither the prompt-review gate nor per-location cache keying.How to reproduce (try it yourself)
Review-bypass:
reviewImagePromptsBeforeSend).You'll see: it generates immediately with no review modal.
Expected: the manual button shows the same prompt-review modal the Illustrator does.
Image reuse:
You'll see: the same image is returned for each location (especially when the GM hasn't emitted a fresh
[state: location: ...]for the new place).Expected: each manual generation produces a new background for the current scene.
Where it is
packages/client/src/components/game/GameSurface.tsxhandleManualSceneBackground(line 4770) POSTs/backgrounds/generate-scene(4801) withlocationSlug: gameSnapshot?.location || chat.name(4804). It never referencesreviewImagePromptsBeforeSend. (The roleplay manual buttonhandleGenerateRoleplayBackground,ChatArea.tsx:914, hits the same endpoint and has the same bypass.)packages/server/src/routes/backgrounds.routes.ts/generate-scene(~241-316) callsgenerateChatBackground(~277) with no preview/confirmation step.packages/server/src/services/game/game-asset-generation.tsgenerateChatBackground(885):baseSlug = safeGeneratedAssetSlug(req.locationSlug || …)(886),slug = generated-${baseSlug}(889), thenconst existingPath = existingGeneratedBackgroundPath(...)(892) andif (existingPath) return basename(existingPath);(893) — an unconditional cache hit with noforceflag and no per-request uniqueness.GameState.locationisstring | null(packages/shared/src/types/game-state.ts:18), so when it's empty the client'slocationSlugfalls back tochat.name— constant for the whole chat — and every manual generation resolves to sluggenerated-<chat-name>and returns the first image.runGameAssetGenerationinGameSurface.tsx:4424, gated at ~4438 onreviewImagePromptsBeforeSendand openingGameImagePromptReviewModal) keys its background by the per-scenebackgroundTag(game.routes.ts~8226), so it both reviews and varies per location — which is why the user sees correct behavior there.What's happening
The manual button was wired to a standalone background endpoint that predates / sits outside the Illustrator's review + per-location-keying logic. So it skips the review modal, and its cache key is too coarse (location-or-chat-name) with an unconditional early-return, so distinct locations collide onto one cached file.
Suggested fix
Cleanest: route the manual background button through
runGameAssetGeneration(the Illustrator path) so it inherits both the prompt-review gate and per-location keying. If keeping the standalone/generate-sceneendpoint:handleManualSceneBackground, gate onuseUIStore.getState().reviewImagePromptsBeforeSendand, when on, fetch a prompt preview and openGameImagePromptReviewModalbefore POSTing (add a/generate-scene/previewcompanion, or accept apromptOverride— the route already importsbuildBackgroundProviderPrompt).forceflag toChatBackgroundGenRequest, plumb it from the manual path, and skip the line 892-893 early-return for user-initiated generations; and/or make the slug unique per scene (include weather/time or a short hash /Date.now()suffix likegenerateSceneIllustrationalready does), and stop falling back to the barechat.nameinGameSurface.tsx:4804.AI-investigated against the current tree (v2.0.9); manual handler + cache lookup lines read and confirmed. Reported on v2.0.8. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jul 2, 2026):
Codex is taking this in branch codex/issue-sweep-3119-3135 for a staging-targeted fix sweep.
@SpicyMarinara commented on GitHub (Jul 2, 2026):
Fix is ready in PR #3138 with CI passing. This issue will close automatically when the PR merges into staging.