Worker rejects restyle-into-preset (empty prompt + style) — empty-prompt guard runs before prompt.Apply #14
Reference in New Issue
Block a user
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?
Severity: live-breaking (restyle's canonical path)
Found by a live smoke restyle right after #13 shipped. A job with
prompt=""+style="watercolor"+init_image_id(exactly what flexsiebels' restyle UI sends when you pick a preset and type nothing) is rejected by the worker:Root cause
cmd/imagen/worker.go:225guards on the RAW job prompt:but the style preset isn't folded into the prompt until line 238:
prompt.Apply("", "watercolor")correctly returns the watercolor suffix (see internal/prompt/prompt.go:60 — empty prompt + style => suffix becomes the prompt). The CLI does it in the right order (generate.go applies first); the worker checks first. So the empty-prompt-plus-style restyle — the primary case — dies before the style can become the prompt.Fix
Move the empty check to AFTER
prompt.Applyand test the RESULT:if job.Prompt == ""early guard.finalPrompt, err := prompt.Apply(...), add:if strings.TrimSpace(finalPrompt) == "" { return worker.Outcome{Err: fmt.Errorf("job %s: empty prompt (no prompt and no style)", job.ID)} }.Result: empty prompt + style => OK (canonical restyle); empty prompt + empty style => still rejected; this matches the CLI exactly.
Tests
workerpipeline test: empty prompt + valid style => Run proceeds (finalPrompt == style suffix), does NOT fail with empty-prompt.Refs
shift-1 — fix landed
Commit:
1f3e163onmai/hotfix/hotfix-worker-rejectsRoot cause confirmed exactly as described:
cmd/imagen/worker.goguarded on the rawjob.Promptbeforeprompt.Applyfolded the style preset in (line 238), so a preset-only restyle (prompt=""+style="watercolor") died withempty promptbefore the style could become the prompt. The CLI (generate.go) applies first, then names off the result — the worker checked first. Mismatch fixed.Fix:
if job.Prompt == ""early guard.finalPrompt, err := prompt.Apply(job.Prompt, job.Style)addedif strings.TrimSpace(finalPrompt) == "" { return ...empty prompt (no prompt and no style)... }.Regression tests (
cmd/imagen/worker_emptyprompt_test.go, via a recording test backend):watercolor=> Run proceeds, backend receives the folded style suffix as the prompt (no empty-prompt error).go build ./...,go vet ./...,go test ./...all clean (incl.-race -count=2on the new tests). Per house rules I do not close the issue — head merges and m closes. Setting work as done on my side.Refs #14, #13.
Fixed + merged to main (
a5b5fed), worker rebuilt + redeployed. Verified the fix end-to-end: a preset-only restyle job (empty prompt +style=watercolor+init_image_id) now passes the prompt guard, the worker builds the img2img workflow, fetches the source image from Storage, and ComfyUI accepts the graph (executes all loaders + the source VAEEncode).The smoke restyle did not produce an image, but for an environmental reason, not a code one: ComfyUI hit
torch.OutOfMemoryErrorat the KSampler — mRock's GPU was at 15.8/16 GB (ollama 5.7G + mVoice 2.6G + whisper 2.0G + a running game 2.5G), leaving no room for FLUX to load. Nothing would generate in that state, txt2img included. So the restyle pipeline is correct; live verification (the pending part of #12) is gated on GPU headroom on mRock. This is the GPU-contention case mGPUmanager is meant to arbitrate.