Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(create): let the Edit lane do what its own copy promises

purple6726aae8819a
diff --git a/src/api/__tests__/dynamic-workflow-inpaint.test.ts b/src/api/__tests__/dynamic-workflow-inpaint.test.ts
index 63724de0..6b7e7201 100644
--- a/src/api/__tests__/dynamic-workflow-inpaint.test.ts
+++ b/src/api/__tests__/dynamic-workflow-inpaint.test.ts
@@ -113,6 +113,33 @@ describe('buildDynamicWorkflow — local Edit (mask inpaint, checkpoint path)',
expect(Object.values(wf).some((n: any) => n.class_type === 'VAEEncodeForInpaint')).toBe(false)
})
+ // 2.5.9: the Edit lane is "Edit / Image to Image" and its canvas says "leave
+ // the mask empty to restyle the whole image". useCreate used to refuse that
+ // with "Paint a mask first" — the gate contradicted the copy directly above
+ // it (found by live E2E on the ship exe, 2026-07-24). The builder was never
+ // the problem; this pins the exact params the lane submits with no mask.
+ it('the Edit lane with no mask builds i2i at the Edit strength the slider shows', async () => {
+ const wf = await buildDynamicWorkflow({
+ ...(baseParams as object),
+ inputImage: 'apple.png',
+ denoise: 0.8, // Edit strength slider default
+ } as never)
+
+ const types = Object.values(wf).map((n: any) => n.class_type)
+ expect(types).toContain('VAEEncode')
+ expect(types).not.toContain('LoadImageMask')
+ expect(types).not.toContain('VAEEncodeForInpaint')
+ expect(types).not.toContain('EmptyLatentImage')
+
+ const [loadId, load] = node(wf, 'LoadImage')!
+ const [encId, enc] = node(wf, 'VAEEncode')!
+ const [, sampler] = node(wf, 'KSampler')!
+ expect(load.inputs.image).toBe('apple.png')
+ expect(enc.inputs.pixels).toEqual([loadId, 0])
+ expect(sampler.inputs.latent_image).toEqual([encId, 0])
+ expect(sampler.inputs.denoise).toBe(0.8)
+ })
+
it('rejects a masked edit on a non-checkpoint strategy instead of dropping the mask', async () => {
vi.mocked(getAllNodeInfo).mockResolvedValue({
...CHECKPOINT_NODES,
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 60e44140..b4c877f3 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -432,12 +432,16 @@ export function useCreate() {
setError('Please add a source image first.')
return
}
- // Local Edit is mask inpaint — without a painted mask it would silently
- // degrade to plain img2img and repaint the WHOLE image.
- if (intent === 'edit' && !maskFilename) {
- setError('Paint a mask first, open the mask editor and mark the area to change.')
- return
- }
+ // No mask-required gate on Edit. In 2.5.8 this lane was inpaint-only and
+ // the guard existed because an empty mask SILENTLY became plain img2img and
+ // repainted the whole picture. 2.5.9 renamed the lane "Edit / Image to
+ // Image" and states the rule on the canvas ("leave the mask empty to
+ // restyle the whole image, or paint an area to change just that"), so that
+ // path is now the advertised behaviour rather than a surprise — and the
+ // guard was refusing exactly what the copy above it promises. The builder
+ // already routes it correctly: no mask means isInpaint is false and the
+ // request falls into the LoadImage → VAEEncode → KSampler(denoise) i2i
+ // branch, driven by the Edit strength slider.
if (!isRemoveBg && !activeModel) {
if (localOp === 'music') {
setError('No music model installed. Use Download & install above to get ACE Step, then generate.')