mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2753] [Issue]: Stability v2 img2img always 400 (aspect_ratio + image-to-image) and ComfyUI failures hang for the full timeout #1394
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#1394
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/2753
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Two image providers have generation-path defects: every Stability v2 reference-image request is rejected by the API, and several ComfyUI failure modes turn into a 5-minute hang plus a misleading generic timeout that discards the real error. The ComfyUI poll loop also can't be cancelled and never reaches its own per-backend budget.
Sub-bug 1: Stability v2 img2img always 400s (#52) [primary]
generateStability(v2 branch) appendsaspect_ratiounconditionally when width/height exist (1040-1041), then for a reference image also appendsmode=image-to-image+ image + strength (1042-1058). Stability's v2beta sd3/ultra/core endpoints acceptaspect_ratioonly in text-to-image mode; in image-to-image the dimensions come from the input image andaspect_ratiois disallowed -> 400.Sub-bug 2: ComfyUI execution error hangs (#53)
entry?.outputs(1937-1938if (!entry?.outputs) continue;) and never readsentry.status. A failed workflow (bad checkpoint, OOM, missing node) returns astatus: { status_str: 'error', messages: [...] }with no outputs, indistinguishable from in-progress; the loop spins the full COMFYUI_GEN_TIMEOUT (300s) then throws a generic timeout, discardingstatus.messages. Same for terminal nodes that emit no images/gifs (e.g. SaveImageWebsocket).Sub-bug 3: Missing prompt_id hang (#23)
const { prompt_id } = await queueResp.json()(1924) is unguarded. On an HTTP 200 body lacking prompt_id (auth gateway / reverse proxy / fork), the poll URL becomes/history/undefined, every iterationcontinues, and the loop runs the full timeout then throws the generic message.prompt_id. 5-minute hang, misleading error.Sub-bug 4: Unreachable per-backend timeout + orphaned loop (#19)
withImageGenerationDeadlinerace (300s) always preempts the 300-iteration poll loop (each iteration sleeps 1s + fetches), soCOMFYUI_GEN_TIMEOUT_SECONDSis effectively dead and a job finishing near 290-300s is reported as a timeout.Promise.racedoesn't cancel the loser andimageRequestSignalrebuilds a fresh 300s signal each call, so after the deadline rejects the loop keeps polling the local backend (result discarded).Suggested Fix
aspect_ratiowhen no reference image is present (if (aspectRatio && !hasReference)).entry.status; ifstatus_str === 'error'(or completed with no image outputs) throw immediately with joinedstatus.messagesviasanitizeErrorText. Validateprompt_idis a non-empty string after parsing the queue response and surfacenode_errors/errorif absent. Make the deadline abort the work via a shared AbortController and derive the poll bound from elapsed wall-clock (or set COMFYUI timeout below IMAGE_GEN_TIMEOUT).Verification checklist (all manual)
pnpm checkAffected files
packages/server/src/services/image/image-generation.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. Stability v2 now omits aspect_ratio for reference/image-to-image requests while preserving it for text-to-image. Image generation uses one deadline-scoped abort signal for provider work, so ComfyUI polling is cancelled by timeout/abort instead of continuing in the background. ComfyUI now validates prompt_id immediately, surfaces workflow status errors from history, treats completed workflows without image outputs as failures, and uses elapsed-time polling with abortable sleeps. Validated with git diff --check for the touched file; full pnpm validation is deferred until the end of the issue sweep per maintainer request.