mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2752] [Issue]: Sprite Generation Modal — in-flight generation not abortable on close, stale/lost state, partial saves (orphaned requests + wasted image cost) #1390
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#1390
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 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2752
Originally assigned to: @SpicyMarinara on GitHub.
Summary
SpriteGenerationModalis rendered permanently mounted by both parent editors (open={spriteGenOpen}), and its lifecycle is not wired to the open/close transition. This yields a cluster of bugs: generation can't be cancelled, state leaks across opens, an avatar edit destroys unsaved work, and saves are non-atomic with silent overwrites.Sub-bug 1: No abort on close; multi-batch cost amplification (#32)
AbortControllerlives insidepostSpriteGenerationRequest(374) and is reachable only by its own 305s timeout — never stored in a ref, never aborted on close/unmount. The modal never unmounts (Modal.tsx nulls only its portal). For matched full-body mode,runMatchedFullBodyBatcheskeeps issuing NEW paid/sprites/generate-sheetrequests after the user closed. ServerwithSpriteGenerationDeadlineonly rejects the race; the underlying provider call isn't aborted.Sub-bug 2: Stale step/result on reopen (#33)
open; theopen-keyed effect (680) resets only config fields. Closing without Save retains step 2 + cells.Sub-bug 3: Avatar/appearance change wipes unsaved sprites (#34)
avatarPreview(a plain string prop) and wipes the in-progress batch with no warning.Sub-bug 4: Partial save on first failure (#35)
handleSave(1275-1314) seriallyawait api.post('/sprites/{id}', ...)per cell; the first rejection throws out of the loop, skippingonSpritesGenerated/onClose/reset. Earlier sprites persisted, later ones never attempted; generic error, no per-item status, re-clicking re-POSTs already-saved ones.Sub-bug 5: Duplicate expression overwrite (#66)
${expression}.${ext}andwriteFilewith no collision handling -> the second write clobbers the first while the UI reports N saved.Suggested Fix
open-transition (or wrap onClose to call handleReset).Promise.allSettled(or accumulate per-cell results), report 'Saved X, failed Y', mark already-saved cells, onlyonCloseon full success.Verification checklist (all manual)
pnpm checkAffected files
packages/client/src/components/ui/SpriteGenerationModal.tsxpackages/client/src/components/characters/CharacterEditor.tsxpackages/client/src/components/personas/PersonaEditor.tsxpackages/server/src/routes/sprites.routes.tsAudit provenance
Found by a multi-agent static audit of the TTS/voice + image-generation subsystems (Round 1 + round-2 gap sweep + completeness critic, each finding adversarially verified) against the merged
stagingtree. Severity: HIGH.@SpicyMarinara commented on GitHub (Jun 21, 2026):
Addressed on PR #2747. SpriteGenerationModal now owns an abortable generation run, cancels on close/unmount and via a visible Cancel button, passes the abort signal through prompt preview and generation requests, checks cancellation between matched full-body batches, resets generated preview state on fresh open, and no longer wipes generated sprites just because same-entity avatar/appearance props change. Saving now blocks duplicate/empty normalized labels and uses all-settled saves so partial failures report saved/failed counts and leave failed cells selected for retry. Validated with git diff --check for the touched file; full pnpm validation is deferred until the end of the issue sweep per maintainer request.