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(edit): Qwen edit strength is back and reaches the graph (B46)

purpled491d0fe9730
diff --git a/e2e/qwen-edit-strength.spec.ts b/e2e/qwen-edit-strength.spec.ts
new file mode 100644
index 00000000..f721e85e
--- /dev/null
+++ b/e2e/qwen-edit-strength.spec.ts
@@ -0,0 +1,154 @@
+import { test, expect, type Page } from '@playwright/test'
+import { writeFileSync } from 'fs'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { seedOnboardingDone } from './support/cloud-mock'
+import { gradientPng } from './support/png'
+import { appModules, type AppWindow } from './support/ui'
+
+/**
+ * 3.0.9 D6 / B46 (Discord boromirofgeo 30.10.2026): the Edit strength of a
+ * Qwen-Image 2.1 edit through ComfyUI is back, and it reaches the graph.
+ * Windows or Linux, local: a Mac runs this model on MLX, where the slider was
+ * never gone.
+ *
+ * The stand-in ComfyUI lists the Qwen-Image 2.1 nodes and records every graph
+ * posted to /prompt. LU_SHOTS=<folder> writes the screenshots and the posted
+ * graphs there.
+ */
+
+const QWEN = 'qwen_image_2.1_int8_convrot.safetensors'
+const SHOTS = process.env.LU_SHOTS
+const PNG = gradientPng(768, 512).toString('base64')
+
+type Graph = Record<string, { class_type: string; inputs: Record<string, unknown> }>
+
+async function boot(page: Page) {
+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, platform: 'windows' as const })
+ await seedOnboardingDone(page)
+ await page.addInitScript((model) => {
+ const w = window as unknown as { __PROMPTS__: string[]; __TAURI_INTERNALS__: { invoke: (c: string, a: { url?: string; method?: string; body?: string }) => Promise<unknown> } }
+ if (!localStorage.getItem('create-store')) {
+ localStorage.setItem('create-store', JSON.stringify({ state: { backend: 'local', imageModel: model }, version: 2 }))
+ }
+ w.__PROMPTS__ = []
+ const bridge = w.__TAURI_INTERNALS__
+ const invoke = bridge.invoke
+ const combo = (v: string[]) => [v]
+ const nodes: Record<string, unknown> = {
+ UNETLoader: { input: { required: { unet_name: combo([model as string]) } } },
+ CLIPLoader: { input: { required: { clip_name: combo(['qwen3vl_8b_int8_convrot.safetensors']) } } },
+ VAELoader: { input: { required: { vae_name: combo(['qwen_image_2.1_vae_bf16.safetensors']) } } },
+ KSampler: { input: { required: { sampler_name: combo(['euler']), scheduler: combo(['simple']) } } },
+ TextEncodeQwenImage21: { input: { required: { clip: ['CLIP'], prompt: ['STRING'], negative_prompt: ['STRING'], resolution: ['INT'] }, optional: { vae: ['VAE'], 'images.image_1': ['IMAGE'] } } },
+ ImageScaleToTotalPixels: { input: { required: {} } },
+ EmptyLatentImage: { input: { required: {} } }, VAEEncode: { input: { required: {} } }, VAEDecode: { input: { required: {} } },
+ SaveImage: { input: { required: {} } }, LoadImage: { input: { required: { image: combo(['source.png']) } } },
+ VAEEncodeForInpaint: { input: { required: {} } }, InpaintModelConditioning: { input: { required: {} } }, LoadImageMask: { input: { required: {} } },
+ }
+ bridge.invoke = (command, args) => {
+ if (command === 'sniff_model_files') return Promise.resolve([])
+ if (command !== 'proxy_localhost' || !args?.url?.includes(':8188')) return invoke(command, args)
+ const url = args.url
+ if (url.includes('/system_stats')) return Promise.resolve(JSON.stringify({ devices: [{ name: 'RTX 4090', type: 'cuda', vram_total: 24 * 1024 ** 3 }] }))
+ if (url.endsWith('/prompt') && args.method === 'POST') {
+ w.__PROMPTS__.push(String(args.body))
+ return Promise.resolve(JSON.stringify({ prompt_id: `p${w.__PROMPTS__.length}`, number: 1, node_errors: {} }))
+ }
+ const hist = /\/history\/(p\d+)/.exec(url)
+ if (hist) {
+ const images = [{ filename: `d6_${hist[1]}.png`, subfolder: '', type: 'output' }]
+ return Promise.resolve(JSON.stringify({ [hist[1]]: { status: { status_str: 'success', completed: true, messages: [] }, outputs: { '9': { images } } } }))
+ }
+ if (url.includes('/queue')) return Promise.resolve(JSON.stringify({ queue_running: [], queue_pending: [] }))
+ const one = /\/object_info\/([^/?]+)/.exec(url)
+ if (one) return Promise.resolve(JSON.stringify(one[1] in nodes ? { [one[1]]: nodes[one[1]] } : {}))
+ if (url.includes('/object_info')) return Promise.resolve(JSON.stringify(nodes))
+ return Promise.resolve('{}')
+ }
+ }, QWEN)
+ await page.route(/:8188\/view/, (route) => route.fulfill({ status: 200, contentType: 'image/png', body: Buffer.from(PNG, 'base64') }))
+}
+
+const shot = async (page: Page, name: string) => {
+ if (!SHOTS) return
+ await page.waitForTimeout(600)
+ await page.screenshot({ path: `${SHOTS}/${name}.png` })
+}
+
+/** A source picture on the Edit stage, as ComfyUI's upload would leave it. */
+const stageSource = (page: Page) => page.evaluate((png) => {
+ const s = (window as unknown as AppWindow).__APP__['/src/stores/createStore.ts'].useCreateStore
+ s.setState({ source: { filename: 'source.png', url: `data:image/png;base64,${png}`, width: 768, height: 512 }, sourceSetAt: Date.now() })
+}, PNG)
+
+const posted = (page: Page) => page.evaluate(() => (window as unknown as { __PROMPTS__: string[] }).__PROMPTS__.map((p) => (JSON.parse(p) as { prompt: Graph }).prompt))
+
+async function openEdit(page: Page) {
+ await boot(page)
+ await page.goto('/')
+ await page.getByRole('button', { name: /^Create$/ }).click()
+ await page.getByRole('radio', { name: 'Edit / Image to Image', exact: true }).click()
+ await appModules(page, ['/src/stores/createStore.ts'])
+ await stageSource(page)
+}
+
+/** The Edit strength row under the prompt: label, value, range input. */
+const strengthRow = (page: Page) => page.locator('div.space-y-1\\.5').filter({ has: page.getByText('Edit strength', { exact: true }) }).first()
+
+test('B46: Qwen-Image 2.1 Edit through ComfyUI has the Edit strength again, and 0.40 is the denoise of the run', async ({ page }) => {
+ await openEdit(page)
+
+ // At 1.00 by default: the run of today.
+ const row = strengthRow(page)
+ await expect(row).toBeVisible({ timeout: 15_000 })
+ await expect(row).toContainText('1.00')
+ await shot(page, 'D6-B46-1')
+
+ // The real range input, moved down to 0.40 with the keyboard.
+ const range = row.locator('input[type="range"]')
+ await range.focus()
+ for (let i = 0; i < 12; i++) await page.keyboard.press('ArrowLeft')
+ await expect(row).toContainText('0.40')
+ await page.getByRole('textbox').filter({ hasText: '' }).first().fill('make the jacket red')
+ await shot(page, 'D6-B46-2')
+ await page.getByRole('button', { name: /^Create$/ }).last().click()
+
+ await expect.poll(async () => (await posted(page)).length, { timeout: 20_000 }).toBe(1)
+ const low = (await posted(page))[0]
+ const sampler = Object.values(low).find((n) => n.class_type === 'KSampler')!
+ expect(sampler.inputs.denoise).toBe(0.4)
+ const from = low[(sampler.inputs.latent_image as [string, number])[0]]
+ expect(from.class_type).toBe('VAEEncode')
+ const scale = low[(from.inputs.pixels as [string, number])[0]]
+ expect(scale.class_type).toBe('ImageScaleToTotalPixels')
+ expect(low[(scale.inputs.image as [string, number])[0]].inputs.image).toBe('source.png')
+
+ if (SHOTS) {
+ writeFileSync(`${SHOTS}/D6-workflow-staerke-0.40.json`, JSON.stringify(low, null, 2))
+ }
+
+ // The Advanced settings show the same field.
+ await page.getByRole('button', { name: 'Advanced settings' }).click()
+ const expert = page.getByRole('button', { name: 'Expert', exact: true })
+ await expect(expert).toBeVisible({ timeout: 15_000 })
+ const drawer = page.locator('aside').filter({ hasText: 'Advanced settings' })
+ if (!(await drawer.getByText('Edit strength', { exact: true }).isVisible())) await expert.click()
+ await expect(drawer.getByText('Edit strength', { exact: true })).toBeVisible()
+ await expect(drawer.getByText('Denoise (raw)')).toHaveCount(0)
+ await drawer.getByText('Edit strength', { exact: true }).scrollIntoViewIfNeeded()
+ await shot(page, 'D6-B46-3')
+})
+
+test('COUNTER-CHECK B46: at 1.00 (the default) the run is the template edit of today', async ({ page }) => {
+ await openEdit(page)
+ await expect(strengthRow(page)).toContainText('1.00', { timeout: 15_000 })
+ await page.getByRole('textbox').filter({ hasText: '' }).first().fill('make the jacket red')
+ await page.getByRole('button', { name: /^Create$/ }).last().click()
+ await expect.poll(async () => (await posted(page)).length, { timeout: 20_000 }).toBe(1)
+ const full = (await posted(page))[0]
+ const sampler = Object.values(full).find((n) => n.class_type === 'KSampler')!
+ expect(sampler.inputs.denoise).toBe(1)
+ expect(full[(sampler.inputs.latent_image as [string, number])[0]].class_type).toBe('TextEncodeQwenImage21')
+ expect(Object.values(full).some((n) => n.class_type === 'ImageScaleToTotalPixels')).toBe(false)
+ if (SHOTS) writeFileSync(`${SHOTS}/D6-workflow-staerke-1.00.json`, JSON.stringify(full, null, 2))
+})
diff --git a/src/api/__tests__/qwen-edit-strength.test.ts b/src/api/__tests__/qwen-edit-strength.test.ts
new file mode 100644
index 00000000..7363f81a
--- /dev/null
+++ b/src/api/__tests__/qwen-edit-strength.test.ts
@@ -0,0 +1,179 @@
+/**
+ * B46 (Discord #bug-reports 30.10.2026, boromirofgeo; back in 3.0.9 on
+ * David's word 01.11.): the Edit strength of a Qwen edit through ComfyUI.
+ *
+ * Up to 3.0.7 the slider showed on a Qwen-Image 2.1 edit, but it set
+ * `denoise`, and the graph sampled at 1.0 from the empty latent of
+ * TextEncodeQwenImage21 whatever it said; 3.0.8 took it out as dead. Now it
+ * is the Edit strength (`editStrength`, 1 = as before): below 1 the sampler
+ * starts from the source, scaled to exactly the latent the encoder hands
+ * over, at that denoise. Qwen-Image-Edit 2509/2511 already samples from the
+ * encoded source and only needs the denoise.
+ *
+ * Run: npx vitest run src/api/__tests__/qwen-edit-strength.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+vi.mock('../comfyui-nodes', async (o) => ({ ...(await o<typeof import('../comfyui-nodes')>()), getAllNodeInfo: vi.fn() }))
+vi.mock('../comfyui', async (o) => ({
+ ...(await o<typeof import('../comfyui')>()),
+ findMatchingCLIP: vi.fn(async () => 'qwen_2.5_vl_7b_fp8_scaled.safetensors'),
+ findMatchingVAE: vi.fn(async () => 'qwen_image_vae.safetensors'),
+ getSystemVRAM: vi.fn(async () => null),
+}))
+vi.mock('../backend', async (o) => ({
+ ...(await o<typeof import('../backend')>()),
+ isMacOS: vi.fn(() => false),
+ localFetch: vi.fn(),
+ comfyuiUrl: (p: string) => `http://test${p}`,
+}))
+
+import { buildDynamicWorkflow, WorkflowUnavailableError } from '../dynamic-workflow'
+import { getAllNodeInfo } from '../comfyui-nodes'
+import { localFetch } from '../backend'
+import { nodeOf, nodeAt, classTypes } from './graph-test-support'
+import { QWEN21_OFFICIAL_MODEL } from './qwen21-weights'
+import type { ComfyApiGraph } from '../../types/comfy-graph'
+
+const EDIT_PLUS = 'qwen_image_edit_2509_fp8_e4m3fn.safetensors'
+const TURBO = 'qwen_image_2.1_turbo_int8_convrot.safetensors'
+const SDXL = 'sdxl.safetensors'
+const ENCODER = 'qwen3vl_8b_int8_convrot.safetensors'
+const VAE_FILE = 'qwen_image_2.1_vae_bf16.safetensors'
+
+function nodes(without: string[] = []): Record<string, unknown> {
+ const n: Record<string, unknown> = {}
+ for (const k of ['CLIPTextEncode', 'KSampler', 'EmptyLatentImage', 'EmptySD3LatentImage', 'LoadImage', 'VAEEncode', 'VAEDecode',
+ 'SaveImage', 'ModelSamplingAuraFlow', 'TextEncodeQwenImageEditPlus', 'CFGNorm', 'FluxKontextImageScale', 'ImageScaleToTotalPixels',
+ 'RandomNoise', 'KSamplerSelect', 'CFGGuider', 'ManualSigmas', 'SamplerCustomAdvanced', 'SplitSigmasDenoise'])
+ n[k] = { input: { required: {} } }
+ n.UNETLoader = { input: { required: { unet_name: [[EDIT_PLUS, QWEN21_OFFICIAL_MODEL, TURBO]] } } }
+ n.CheckpointLoaderSimple = { input: { required: { ckpt_name: [[SDXL]] } } }
+ n.CLIPLoader = { input: { required: { clip_name: [[ENCODER, 'qwen_2.5_vl_7b_fp8_scaled.safetensors']], type: [['qwen_image', 'stable_diffusion']] } } }
+ n.VAELoader = { input: { required: { vae_name: [[VAE_FILE, 'qwen_image_vae.safetensors']] } } }
+ n.TextEncodeQwenImage21 = { input: { required: { clip: ['CLIP'], prompt: ['STRING'], negative_prompt: ['STRING'], resolution: ['INT'] }, optional: { vae: ['VAE'], 'images.image_1': ['IMAGE'] } } }
+ for (const k of without) delete n[k]
+ return n
+}
+
+const edit = (model: string, extra: Record<string, unknown> = {}) => ({
+ model, prompt: 'make the jacket red', negativePrompt: '', sampler: 'euler', scheduler: 'simple',
+ width: 1328, height: 1328, steps: 20, cfgScale: 4, seed: 7, batchSize: 1,
+ // The img2img denoise rides along on every edit (0.7 is its default);
+ // a Qwen edit must not read it.
+ inputImage: 'jacket.png', denoise: 0.7, ...extra,
+}) as never
+
+async function build(model: string, type: string, extra: Record<string, unknown> = {}, without: string[] = []): Promise<ComfyApiGraph> {
+ vi.mocked(getAllNodeInfo).mockResolvedValue(nodes(without) as never)
+ return buildDynamicWorkflow(edit(model, extra), type as never)
+}
+
+const classAt = (wf: ComfyApiGraph, ref: unknown) => nodeAt(wf, String((ref as [string, number])[0]))?.class_type
+
+beforeEach(() => {
+ vi.mocked(localFetch).mockResolvedValue({
+ ok: true,
+ json: async () => ({
+ CLIPLoader: { input: { required: { clip_name: [[ENCODER]] } } },
+ VAELoader: { input: { required: { vae_name: [[VAE_FILE]] } } },
+ }),
+ } as never)
+})
+
+describe('Qwen-Image 2.1 edit: the Edit strength reaches the graph', () => {
+ it('0.4: the KSampler runs at denoise 0.4 from the encoded source, not the empty latent', async () => {
+ const wf = await build(QWEN21_OFFICIAL_MODEL, 'qwenimage', { editStrength: 0.4 })
+ const [encId, enc] = nodeOf(wf, 'TextEncodeQwenImage21')!
+ const [, sampler] = nodeOf(wf, 'KSampler')!
+ expect(sampler.inputs.denoise).toBe(0.4)
+ expect(sampler.inputs.latent_image).not.toEqual([encId, 2])
+ expect(classAt(wf, sampler.inputs.latent_image)).toBe('VAEEncode')
+ const [, vaeEnc] = nodeOf(wf, 'VAEEncode')!
+ expect(vaeEnc.inputs.vae).toEqual(enc.inputs.vae)
+ // The source the encoder reads as image_1, scaled the way the encoder
+ // scales it: side² pixels, multiples of 32, lanczos.
+ const [scaleId, scale] = nodeOf(wf, 'ImageScaleToTotalPixels')!
+ expect(vaeEnc.inputs.pixels).toEqual([scaleId, 0])
+ expect(scale.inputs.image).toEqual(enc.inputs['images.image_1'])
+ expect(nodeAt(wf, String((scale.inputs.image as [string, number])[0]))!.inputs.image).toBe('jacket.png')
+ expect(scale.inputs.resolution_steps).toBe(32)
+ expect(scale.inputs.upscale_method).toBe('lanczos')
+ const side = enc.inputs.resolution as number
+ expect(side).toBe(1344) // 1328 on the grid of 32 (qwenEditResolution)
+ expect((scale.inputs.megapixels as number) * 1024 * 1024).toBeCloseTo(side * side, 6)
+ })
+
+ it('the shared side of many images is the side the source is scaled to', async () => {
+ const refs = Array.from({ length: 6 }, (_, i) => `ref${i + 2}.png`)
+ const wf = await build(QWEN21_OFFICIAL_MODEL, 'qwenimage', { editStrength: 0.5, referenceImages: refs })
+ const side = nodeOf(wf, 'TextEncodeQwenImage21')![1].inputs.resolution as number
+ expect(side).toBeLessThan(1328)
+ expect((nodeOf(wf, 'ImageScaleToTotalPixels')![1].inputs.megapixels as number) * 1024 * 1024).toBeCloseTo(side * side, 6)
+ })
+
+ it('COUNTER-CHECK: 1 or unset is the graph of today, denoise 1.0 on the encoder latent', async () => {
+ for (const extra of [{}, { editStrength: 1 }]) {
+ const wf = await build(QWEN21_OFFICIAL_MODEL, 'qwenimage', extra)
+ const [encId] = nodeOf(wf, 'TextEncodeQwenImage21')!
+ const [, sampler] = nodeOf(wf, 'KSampler')!
+ expect(sampler.inputs.denoise).toBe(1)
+ expect(sampler.inputs.latent_image).toEqual([encId, 2])
+ expect(classTypes(wf)).not.toContain('VAEEncode')
+ expect(classTypes(wf)).not.toContain('ImageScaleToTotalPixels')
+ }
+ })
+
+ it('COUNTER-CHECK: the img2img denoise alone changes nothing on a Qwen edit', async () => {
+ const wf = await build(QWEN21_OFFICIAL_MODEL, 'qwenimage', { denoise: 0.3 })
+ expect(nodeOf(wf, 'KSampler')![1].inputs.denoise).toBe(1)
+ })
+
+ it('below 0.05 it holds at 0.05', async () => {
+ const wf = await build(QWEN21_OFFICIAL_MODEL, 'qwenimage', { editStrength: 0.01 })
+ expect(nodeOf(wf, 'KSampler')![1].inputs.denoise).toBe(0.05)
+ })
+
+ it('a ComfyUI without ImageScaleToTotalPixels says so instead of failing in the run', async () => {
+ const err = await build(QWEN21_OFFICIAL_MODEL, 'qwenimage', { editStrength: 0.4 }, ['ImageScaleToTotalPixels']).catch((e: unknown) => e)
+ expect(err).toBeInstanceOf(WorkflowUnavailableError)
+ expect(String((err as Error).message)).toMatch(/Edit strength below 1 needs a newer ComfyUI/)
+ })
+
+ it('Turbo: its own sigmas, cut to the strength by SplitSigmasDenoise (low sigmas)', async () => {
+ const wf = await build(TURBO, 'qwenimage', { editStrength: 0.5 })
+ const [, custom] = nodeOf(wf, 'SamplerCustomAdvanced')!
+ const [splitId, split] = nodeOf(wf, 'SplitSigmasDenoise')!
+ expect(custom.inputs.sigmas).toEqual([splitId, 1])
+ expect(split.inputs.denoise).toBe(0.5)
+ expect(classAt(wf, split.inputs.sigmas)).toBe('ManualSigmas')
+ expect(classAt(wf, custom.inputs.latent_image)).toBe('VAEEncode')
+ })
+
+ it('COUNTER-CHECK Turbo at 1: the template chain as before', async () => {
+ const wf = await build(TURBO, 'qwenimage', { editStrength: 1 })
+ expect(classTypes(wf)).not.toContain('SplitSigmasDenoise')
+ expect(classAt(wf, nodeOf(wf, 'SamplerCustomAdvanced')![1].inputs.sigmas)).toBe('ManualSigmas')
+ })
+})
+
+describe('Qwen-Image-Edit 2509/2511: the same field', () => {
+ it('0.4 is the denoise of its KSampler, still on the encoded source', async () => {
+ const wf = await build(EDIT_PLUS, 'qwenimage1', { editStrength: 0.4 })
+ const [, sampler] = nodeOf(wf, 'KSampler')!
+ expect(sampler.inputs.denoise).toBe(0.4)
+ expect(classAt(wf, sampler.inputs.latent_image)).toBe('VAEEncode')
+ })
+
+ it('COUNTER-CHECK: unset stays at 1.0, the template', async () => {
+ const wf = await build(EDIT_PLUS, 'qwenimage1')
+ expect(nodeOf(wf, 'KSampler')![1].inputs.denoise).toBe(1)
+ })
+})
+
+describe('every other edit ignores it', () => {
+ it('SDXL keeps the img2img denoise', async () => {
+ const wf = await build(SDXL, 'sdxl', { editStrength: 0.2 })
+ expect(nodeOf(wf, 'KSampler')![1].inputs.denoise).toBe(0.7)
+ })
+})
diff --git a/src/api/__tests__/wrapper-node-names.test.ts b/src/api/__tests__/wrapper-node-names.test.ts
index 4d921f18..02be0a8d 100644
--- a/src/api/__tests__/wrapper-node-names.test.ts
+++ b/src/api/__tests__/wrapper-node-names.test.ts
@@ -101,6 +101,10 @@ const CORE_NODES = new Set([
// [nodes_edit_model.py], ImageScaleToTotalPixels [nodes_post_processing.py 234].
'WanFirstLastFrameToVideo', 'FluxKontextMultiReferenceLatentMethod', 'ModelSamplingFlux', 'ReferenceLatent',
'ImageScaleToTotalPixels',
+ // B46 (Qwen edit strength on Turbo), read in ComfyUI master on 01.11.2026:
+ // SplitSigmasDenoise [nodes_custom_sampler.py 228, outputs high_sigmas,
+ // low_sigmas].
+ 'SplitSigmasDenoise',
'YuE2GenerateMusic', 'EmptyYuE2LatentAudio',
// lora
'LoraLoader', 'LoraLoaderModelOnly',
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 15eb5425..7d2901dd 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -63,6 +63,10 @@ export interface GenerateParams {
* Lets an all-in-one file in models/checkpoints use its own encoder/VAE. */
modelParts?: { textEncoder: boolean; vae: boolean }
denoise?: number // I2I denoise strength (0.0–1.0, default 1.0 = full txt2img)
+ /** Qwen edits only (Qwen-Image 2.1, Qwen-Image-Edit 2509/2511): the Edit
+ * strength, 0.05 to 1. 1 or unset is the template's edit from noise;
+ * lower starts the sampler from the source and keeps more of it (B46). */
+ editStrength?: number
removebg?: boolean // Background removal: LoadImage → RMBG → SaveImage cutout (no diffusion)
/** Qwen-Image 2.1 text-to-image only: ask for an RGBA picture with a
* transparent background (lib/transparent-image.ts). Ignored elsewhere. */
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 3f68b8e8..af74bbc5 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -1159,6 +1159,21 @@ export async function buildDynamicWorkflow(
? await getSystemVRAM().catch(() => null)
: null
const fullImages = comfyEditFullImages(cardGb)
+ // B46 (Discord 30.10.2026, back in 3.0.9): the Edit strength of a Qwen
+ // edit. 1 is the template's edit from the empty latent, as before; below 1
+ // the sampler starts from the source itself at that denoise, so less of
+ // the picture changes. Up to 3.0.7 the slider showed here but its value
+ // never reached the graph (denoise stayed 1.0 on an empty latent).
+ const qwenEditStrength = (isQwenEdit || isQwen1Edit) && Number.isFinite(gp.editStrength) && gp.editStrength! < 1
+ ? Math.max(0.05, gp.editStrength!)
+ : 1
+ // The source and the side the encoder scales it to, for that start.
+ let qwenEditSource: [string, number] | null = null
+ let qwenEditSide = 0
+ if (isQwenEdit && qwenEditStrength < 1) {
+ requireRelease(allNodes, ['ImageScaleToTotalPixels', 'VAEEncode'],
+ 'An Edit strength below 1 needs a newer ComfyUI. Update ComfyUI, or set the Edit strength to 1.', strategy)
+ }
if (isQwen1Edit) {
const over = qwenEditPlusOverCard(1 + references.length, cardGb)
if (over) throw new WorkflowUnavailableError(over, strategy)
@@ -1230,6 +1245,8 @@ export async function buildDynamicWorkflow(
qwenInputs[`images.image_${i + 1}`] = [loadId, 0]
}
qwenInputs.vae = [vaeSourceId, vaeOutputSlot]
+ qwenEditSource = qwenInputs['images.image_1'] as [string, number]
+ qwenEditSide = qwenInputs.resolution as number
} else if (createRefs.length > 0) {
// B45: references without a source. They are image_1 and up; the
// picture still comes from the empty latent at the canvas size below.
@@ -1446,6 +1463,20 @@ export async function buildDynamicWorkflow(
// calls out as required, because any other size shifts the edit.
latentRef = [posId, 2]
delete workflow[latentId]
+ if (qwenEditStrength < 1 && qwenEditSource) {
+ // B46: the source at exactly the size of that latent. The encoder
+ // scales image_1 to about side x side pixels on multiples of 32 in
+ // its own shape (nodes_qwen.py); ImageScaleToTotalPixels does the
+ // same sum with side² pixels and steps of 32.
+ const scaleId = String(n++)
+ workflow[scaleId] = {
+ class_type: 'ImageScaleToTotalPixels',
+ inputs: { image: qwenEditSource, upscale_method: 'lanczos', megapixels: (qwenEditSide * qwenEditSide) / (1024 * 1024), resolution_steps: 32 },
+ }
+ const encId = String(n++)
+ workflow[encId] = { class_type: 'VAEEncode', inputs: { pixels: [scaleId, 0], vae: [vaeSourceId, vaeOutputSlot] } }
+ latentRef = [encId, 0]
+ }
}
}
@@ -1824,6 +1855,10 @@ export async function buildDynamicWorkflow(
sampler: part({ class_type: 'KSamplerSelect', inputs: { sampler_name: QWEN21_TURBO_SAMPLING.sampler } }),
sigmas: part({ class_type: 'ManualSigmas', inputs: { sigmas: QWEN21_TURBO_SIGMAS } }),
}
+ if (qwenEditStrength < 1) {
+ // B46 on Turbo: its own schedule, cut to the strength (low_sigmas).
+ qwenTurboCustom.sigmas = [part({ class_type: 'SplitSigmasDenoise', inputs: { sigmas: qwenTurboCustom.sigmas, denoise: qwenEditStrength } })[0], 1]
+ }
}
const samplerId = String(n++)
@@ -1856,7 +1891,8 @@ export async function buildDynamicWorkflow(
cfg: params.cfgScale,
sampler_name: qwenTurbo ? QWEN21_TURBO_SAMPLING.sampler : params.sampler,
scheduler: qwenTurbo ? QWEN21_TURBO_SAMPLING.scheduler : params.scheduler,
- denoise: isInpaint ? (params.denoise ?? 0.85) : isI2I ? (params.denoise ?? 0.7) : 1.0, // Qwen-Image-Edit: 1.0, like its template
+ // Qwen edits: 1.0 like their templates, or the Edit strength (B46).
+ denoise: isInpaint ? (params.denoise ?? 0.85) : isI2I ? (params.denoise ?? 0.7) : qwenEditStrength,
},
}
diff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsx
index 4aa54e6f..3cdc41f9 100644
--- a/src/components/create/experimental/Composer.tsx
+++ b/src/components/create/experimental/Composer.tsx
@@ -8,7 +8,7 @@ import { useMacMemoryGb } from '../../../lib/mac-memory'
import { applyAspect } from '../../../lib/create-resolution'
import { useCreateStore, MODEL_TYPE_DEFAULTS, EDIT_MAX_DENOISE, imageQualityLadder, type ImageQuality } from '../../../stores/createStore'
import { classifyModel, resolveLocalOpPick } from '../../../api/comfyui'
-import { editIgnoresStrength } from '../../../lib/edit-references'
+import { readsEditStrength } from '../../../lib/edit-references'
import { useCreateExp } from './CreateContext'
import { intentToJob } from '../../../lib/render/cloud-jobs'
import { meterState } from '../../../lib/render/credits-meter'
@@ -662,6 +662,8 @@ function LaneControls() {
const setSteps = useCreateStore((s) => s.setSteps)
const denoise = useCreateStore((s) => s.denoise)
const setDenoise = useCreateStore((s) => s.setDenoise)
+ const editStrength = useCreateStore((s) => s.editStrength)
+ const setEditStrength = useCreateStore((s) => s.setEditStrength)
const imageModelType = useCreateStore((s) => s.imageModelType)
const imageModel = useCreateStore((s) => s.imageModel)
const setImageQuality = useCreateStore((s) => s.setImageQuality)
@@ -697,10 +699,10 @@ function LaneControls() {
const macMemoryGb = useMacMemoryGb(mlxLocal)
const macLengthGb = intent === 'motion' ? null : macMemoryGb
const ownSampling = mlxLocal && runsAtOwnSampling(imageModelList, laneImageModel(imageModelList, imageModel, intent))
- // A Qwen edit through ComfyUI samples at denoise 1.0 like its template, so
- // an Edit strength there would be a dead control (lib/edit-references).
+ // A Qwen edit through ComfyUI reads its own Edit strength, 1 = the
+ // template's edit, as on the Mac (lib/edit-references, B46).
const listedImageType = imageModelList.find((m) => m.name === imageModel)?.type
- const strengthUnread = backend === 'local' && !mlxLocal && editIgnoresStrength(listedImageType ?? classifyModel(imageModel), imageModel)
+ const qwenStrength = backend === 'local' && !mlxLocal && readsEditStrength(listedImageType ?? classifyModel(imageModel), imageModel)
const videoModelList = useCreateStore((s) => s.videoModelList)
// Motion Control on the Mac runs the model of its own list.
const motionModelList = useCreateStore((s) => s.motionModelList)
@@ -815,11 +817,16 @@ function LaneControls() {
)}
</div>
- {meta.id === 'edit' && !mlxLocal && !strengthUnread && (
+ {meta.id === 'edit' && !mlxLocal && !qwenStrength && (
<div className="w-44">
<Slider label="Edit strength" min={0.05} max={EDIT_MAX_DENOISE} step={0.05} value={Math.min(denoise, EDIT_MAX_DENOISE)} onChange={setDenoise} format={(v) => v.toFixed(2)} />
</div>
)}
+ {meta.id === 'edit' && qwenStrength && (
+ <div className="w-44">
+ <Slider label="Edit strength" min={0.05} max={1} step={0.05} value={editStrength} onChange={setEditStrength} format={(v) => v.toFixed(2)} />
+ </div>
+ )}
</div>
)
}
diff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsx
index 57c3ebe4..2a7f43a6 100644
--- a/src/components/create/experimental/ParamGroups.tsx
+++ b/src/components/create/experimental/ParamGroups.tsx
@@ -5,7 +5,7 @@ import { useCreateStore } from '../../../stores/createStore'
import { useCreateExp } from './CreateContext'
import { cloudModelById, defaultCloudModel } from '../../../stores/cloudCatalogStore'
import { classifyModel } from '../../../api/comfyui'
-import { editIgnoresStrength } from '../../../lib/edit-references'
+import { readsEditStrength } from '../../../lib/edit-references'
import { latentDownscale, nativeHiresFinalSize, type HiresUpscaleMethod } from '../../../api/hires-fix'
import { isMlxImageHost } from '../../../api/mlx-image'
import { macHiresPass } from '../../../lib/mac-hires'
@@ -492,12 +492,13 @@ export function ParamGroups() {
</>
)}
- {isEdit && !isMlxLocal && !(!isCloud && editIgnoresStrength(laneType, laneModel)) && (
+ {isEdit && !isMlxLocal && !(!isCloud && readsEditStrength(laneType, laneModel)) && (
<Slider label="Denoise (raw)" min={0.05} max={1} step={0.05} value={s.denoise} onChange={s.setDenoise} format={(v) => v.toFixed(2)} />
)}
- {macEdit && (
+ {(macEdit || (isEdit && !isCloud && readsEditStrength(laneType, laneModel))) && (
// 1.00 is the edit from the prompt alone, as before. Lower starts
- // from the image and keeps more of it.
+ // from the image and keeps more of it. A Qwen edit through ComfyUI
+ // reads the same field (B46).
<Slider label="Edit strength" min={0.05} max={1} step={0.05} value={s.editStrength} onChange={s.setEditStrength} format={(v) => v.toFixed(2)} />
)}
{meta.allowsMask && !isCloud && (
diff --git a/src/components/create/experimental/__tests__/image-refs-in-the-strip.test.tsx b/src/components/create/experimental/__tests__/image-refs-in-the-strip.test.tsx
index dffeac53..5225b273 100644
--- a/src/components/create/experimental/__tests__/image-refs-in-the-strip.test.tsx
+++ b/src/components/create/experimental/__tests__/image-refs-in-the-strip.test.tsx
@@ -5,9 +5,10 @@
* image 2, or IMAGE 2.?" Each tile now carries its name, says how to use
* it, and a click adds it to the prompt.
* - #general: "even with strength at 95% and cfg 3" on Qwen Image 2.1
- * Edit. Through ComfyUI both Qwen edit families sample at denoise 1.0,
- * so the Edit strength slider set nothing there and is gone; an edit that
- * does read it keeps it.
+ * Edit. Through ComfyUI both Qwen edit families sampled at denoise 1.0,
+ * so the slider set nothing there and 3.0.8 took it out. B46 (3.0.9,
+ * Discord 30.10.2026): it is back on its own field, `editStrength`
+ * (1 = as before), which the graph now reads (qwen-edit-strength.test.ts).
*
* Run: npx vitest run src/components/create/experimental/__tests__/image-refs-in-the-strip.test.tsx
*/
@@ -37,7 +38,7 @@ vi.mock('../../../../hooks/useGraphicsMemory', () => ({ useGraphicsCardGb: () =>
import { Composer } from '../Composer'
import { ReferenceStrip } from '../ReferenceStrip'
import { useCreateStore } from '../../../../stores/createStore'
-import { editIgnoresStrength } from '../../../../lib/edit-references'
+import { readsEditStrength } from '../../../../lib/edit-references'
const SOURCE = { filename: 'scene.png', url: 'data:image/png;base64,scene', width: 8, height: 8 }
const QWEN21 = 'qwen_image_2.1_int8_convrot.safetensors'
@@ -97,37 +98,44 @@ describe('each reference tile names itself', () => {
})
describe('the Edit strength shows only where the run reads it', () => {
- const slider = () => screen.queryByText('Edit strength')
+ const slider = () => screen.queryByRole('slider', { name: 'Edit strength' }) ?? screen.queryByText('Edit strength')
const composer = () => render(<Composer onOpenAdvanced={() => {}} onOpenWorkflows={() => {}} />)
+ const value = () => screen.getByText('Edit strength').parentElement!.parentElement!.textContent
- it('Qwen-Image 2.1 through ComfyUI: no slider, the edit runs at denoise 1.0', () => {
+ it('B46: Qwen-Image 2.1 through ComfyUI has it again, on editStrength, at 1.00 by default', () => {
editWith(QWEN21, 'qwenimage')
+ useCreateStore.setState({ editStrength: 1, denoise: 0.7 })
composer()
- expect(slider()).toBeNull()
+ expect(slider()).toBeTruthy()
+ // Not the img2img denoise (0.70): the Qwen edit's own field.
+ expect(value()).toContain('1.00')
+ expect(value()).not.toContain('0.70')
})
- it('Qwen-Image-Edit 2509 through ComfyUI: no slider either', () => {
+ it('B46: Qwen-Image-Edit 2509 through ComfyUI has it too', () => {
editWith(EDIT_PLUS, 'qwenimage1')
+ useCreateStore.setState({ editStrength: 0.4 })
composer()
- expect(slider()).toBeNull()
+ expect(value()).toContain('0.40')
})
- it('COUNTER-CHECK: an SDXL edit and plain Qwen-Image keep it, they repaint at that strength', () => {
+ it('COUNTER-CHECK: an SDXL edit and plain Qwen-Image keep the denoise slider', () => {
editWith(SDXL, 'sdxl')
+ useCreateStore.setState({ editStrength: 1, denoise: 0.7 })
const first = composer()
- expect(slider()).toBeTruthy()
+ expect(value()).toContain('0.70')
first.unmount()
editWith(QWEN1, 'qwenimage1')
composer()
- expect(slider()).toBeTruthy()
+ expect(value()).toContain('0.70')
})
- it('which families leave it unread', () => {
- expect(editIgnoresStrength('qwenimage', QWEN21)).toBe(true)
- expect(editIgnoresStrength('qwenimage1', EDIT_PLUS)).toBe(true)
- expect(editIgnoresStrength('qwenimage1', QWEN1)).toBe(false)
- expect(editIgnoresStrength('sdxl', SDXL)).toBe(false)
- expect(editIgnoresStrength(null, QWEN21)).toBe(false)
+ it('which families read editStrength', () => {
+ expect(readsEditStrength('qwenimage', QWEN21)).toBe(true)
+ expect(readsEditStrength('qwenimage1', EDIT_PLUS)).toBe(true)
+ expect(readsEditStrength('qwenimage1', QWEN1)).toBe(false)
+ expect(readsEditStrength('sdxl', SDXL)).toBe(false)
+ expect(readsEditStrength(null, QWEN21)).toBe(false)
})
})
diff --git a/src/hooks/__tests__/useCreate-qwen-edit-strength.test.ts b/src/hooks/__tests__/useCreate-qwen-edit-strength.test.ts
new file mode 100644
index 00000000..a8b66e74
--- /dev/null
+++ b/src/hooks/__tests__/useCreate-qwen-edit-strength.test.ts
@@ -0,0 +1,107 @@
+// @vitest-environment jsdom
+/**
+ * B46 (3.0.9): the Edit strength of a local Qwen edit, through the real
+ * generate path of useCreate up to the builder. What the builder does with it
+ * is api/__tests__/qwen-edit-strength.test.ts.
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+import { renderHook } from '@testing-library/react'
+
+type Built = { prompt: string; inputImage?: string; denoise?: number; editStrength?: number }
+const seen = vi.hoisted(() => ({
+ order: [] as string[],
+ built: [] as Built[],
+ enhancer: [] as { file: string; mode: string }[],
+}))
+
+vi.mock('../../api/mlx-image', () => ({
+ isMlxImageHost: () => false,
+ isMlxImageModel: () => false,
+ mlxStatus: vi.fn(async () => ({ installed: false })),
+ listMlxImageModels: vi.fn(async () => []),
+ buildMlxImageModels: vi.fn(() => []),
+ mergeImageModels: vi.fn((a: unknown[]) => a),
+ mlxModelIdFor: vi.fn(() => ''),
+ generateMlxImageDataUrl: vi.fn(),
+}))
+vi.mock('../../api/comfyui', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ checkComfyConnection: vi.fn(async () => true),
+ submitWorkflow: vi.fn(async () => { seen.order.push('submit-picture'); throw new Error('stop here') }),
+}))
+vi.mock('../../api/comfyui-ws', () => ({
+ CLIENT_ID: 'lu-test',
+ comfyWS: { connect: vi.fn(async () => { throw new Error('no socket') }), mark: () => 0, onPreview: () => () => {} },
+}))
+vi.mock('../../api/vram-handoff', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ evictChatBackendsForRender: vi.fn(async () => null),
+ restoreChatBackendsAfterRender: vi.fn(),
+}))
+vi.mock('../../api/dynamic-workflow', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ buildDynamicWorkflow: vi.fn(async (params: Built) => {
+ seen.order.push('build-picture')
+ seen.built.push({ prompt: params.prompt, inputImage: params.inputImage, denoise: params.denoise, editStrength: params.editStrength })
+ return { '1': { class_type: 'SaveImage', inputs: {} } }
+ }),
+}))
+vi.mock('../../api/qwen-enhancer', () => ({
+ buildQwenEnhancerWorkflow: vi.fn(async (req: { file: string; mode: string }) => {
+ seen.order.push('build-enhancer')
+ seen.enhancer.push({ file: req.file, mode: req.mode })
+ return { '4': { class_type: 'TextGenerate', inputs: {} } }
+ }),
+ runQwenEnhancer: vi.fn(async () => ({ status: 'improved', prompt: 'A long rewritten prompt from the enhancer.' })),
+}))
+
+import { useCreate } from '../useCreate'
+import { useCreateStore } from '../../stores/createStore'
+import { classifyModel } from '../../api/comfyui'
+import { QWEN21_OFFICIAL_MODEL } from '../../api/__tests__/qwen21-weights'
+
+const image = (filename: string) => ({ filename, url: `blob:${filename}`, width: 1024, height: 1024 })
+
+function setup(model: string) {
+ seen.order.length = 0
+ seen.built.length = 0
+ useCreateStore.setState({
+ backend: 'local', isGenerating: false, error: null, gallery: [], promptHistory: [],
+ improvePrompt: false, cloudOp: null, utilityOp: null, removebg: false, source: null, mask: null, references: [],
+ selectedLoras: [], hiresFixEnabled: false, transparentBackground: false, seed: 42,
+ imageModel: model, imageModelList: [{ name: model, type: classifyModel(model) }],
+ denoise: 0.7, editStrength: 1,
+ } as never)
+ const s = useCreateStore.getState()
+ s.setIntent('edit')
+ s.setPrompt('make the jacket red')
+ useCreateStore.setState({ source: image('jacket.png') } as never)
+}
+
+async function run() {
+ const { result } = renderHook(() => useCreate())
+ await result.current.generate()
+}
+
+describe('B46: the Edit strength of a local Qwen edit reaches the builder', () => {
+ beforeEach(() => setup(QWEN21_OFFICIAL_MODEL))
+
+ it('0.4 set on the slider is sent as editStrength', async () => {
+ useCreateStore.getState().setEditStrength(0.4)
+ await run()
+ expect(seen.built).toHaveLength(1)
+ expect(seen.built[0]).toMatchObject({ inputImage: 'jacket.png', editStrength: 0.4 })
+ })
+
+ it('COUNTER-CHECK: at 1 (the default) nothing is sent, the run is the one of today', async () => {
+ await run()
+ expect(seen.built[0].editStrength).toBeUndefined()
+ })
+
+ it('COUNTER-CHECK: a new picture never carries it', async () => {
+ useCreateStore.getState().setEditStrength(0.4)
+ useCreateStore.getState().setIntent('image')
+ await run()
+ expect(seen.built[0].editStrength).toBeUndefined()
+ })
+})
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 1ba59e66..7540815b 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -1857,6 +1857,9 @@ export function useCreate() {
// dropped the source without a word. Edit always keeps the source;
// 0.95 is the most it repaints (the slider tops out there too).
...(isI2I && !isRemoveBg && effInputImage ? { inputImage: effInputImage, denoise: Math.min(denoise, EDIT_MAX_DENOISE) } : {}),
+ // B46: a Qwen edit reads its own Edit strength (1 = as before); the
+ // builder ignores it on every other family.
+ ...(isI2I && !isRemoveBg && effInputImage && state.editStrength < 1 ? { editStrength: state.editStrength } : {}),
// GH #144: further references ride along; the builder keeps only as
// many as the model's family takes (lib/edit-references).
...(isI2I && !isRemoveBg && effInputImage && references.some((r) => r.filename)
diff --git a/src/lib/edit-references.ts b/src/lib/edit-references.ts
index 8d2c28c0..89a45194 100644
--- a/src/lib/edit-references.ts
+++ b/src/lib/edit-references.ts
@@ -94,13 +94,15 @@ export const MANY_REFERENCES = 4
export const MANY_REFERENCES_LINE = 'With this many images, say what each one brings, for example "the scarf from image 3".'
/**
- * Whether a local ComfyUI edit with this model leaves the Edit strength
- * unread. Both Qwen edit families sample at denoise 1.0 from the latent their
- * encoder hands over, as the official templates do (dynamic-workflow.ts), so
- * a strength slider there set nothing (Discord #general 23.10.2026: "even
- * with strength at 95%" on Qwen Image 2.1 Edit). How close the result stays
- * to the images is set by the prompt and the images themselves.
+ * Whether a local ComfyUI edit with this model takes its strength from
+ * `editStrength` (the Mac's field, 1 = the template's edit) instead of the
+ * img2img `denoise`. Both Qwen edit families sample at denoise 1.0 from the
+ * latent their encoder hands over, as the official templates do. Up to 3.0.7
+ * the slider here set `denoise`, which the graph never read (Discord #general
+ * 23.10.2026: "even with strength at 95%"); 3.0.8 took it out. B46 (3.0.9):
+ * below 1 the run starts from the source at that denoise (dynamic-workflow.ts),
+ * so the slider is back and does what it says.
*/
-export function editIgnoresStrength(type: ModelType | null | undefined, modelName: string): boolean {
+export function readsEditStrength(type: ModelType | null | undefined, modelName: string): boolean {
return type === 'qwenimage' || (type === 'qwenimage1' && isQwenImageEditModel(modelName))
}